679

Original post: hachyderm.io (Mastodon)

top 50 comments
sorted by: hot top controversial new old
[-] 30p87@feddit.org 191 points 6 days ago* (last edited 6 days ago)

So we need to be careful with upper- and lowercase. Meanwhile the docs: > settiings

[-] janonymous@lemmy.world 106 points 6 days ago

Yes, the settiings are different than the settings. You also need to be careful with those.

[-] Bezier@suppo.fi 36 points 6 days ago

had to use a different spelliings at backend and frontend, otherwise it wouldn't work.

[-] LovableSidekick@lemmy.world 12 points 6 days ago* (last edited 6 days ago)

no, settings = settings but settings != Settings, as we all know.

load more comments (3 replies)
[-] mexicancartel@lemmy.dbzer0.com 6 points 6 days ago

They specifically said "this is not a typo"!!!

[-] SatyrSack@feddit.org 87 points 6 days ago

Could be worse. At least it's documented

load more comments (9 replies)
[-] jjjalljs@ttrpg.network 90 points 6 days ago

Is the backend Python and the frontend JavaScript? Because then that would happen and just be normal, because Boolean true is True in python.

[-] testfactor@lemmy.world 137 points 6 days ago

Probably, but if you're interpreting user inputs as raw code, you've got much much worse problems going on, lol.

[-] LostXOR@fedia.io 36 points 6 days ago

[...]&register=import os; os.system("sudo rm -rf /"); return True

[-] MajorHavoc@programming.dev 17 points 6 days ago

Hey, that's my username too. Or it was going to be, while the site was still up.

What a coincidence!

I guess I'll wait for the site to come back, and see if it's still available...

[-] mmddmm@lemm.ee 18 points 6 days ago

It's the settiings file... It's probably supposed to only be written by the system admin.

[-] raldone01@lemmy.world 9 points 6 days ago* (last edited 6 days ago)

A good place to put persistent malware. That's why when using docker images always mount as ro if at all possible.

[-] ashley@lemmy.ca 9 points 6 days ago

It’s you can modify the settings file you sure as hell can put the malware anywhere you want

[-] MajorHavoc@programming.dev 1 points 3 days ago* (last edited 3 days ago)

It’s you can modify the settings file you sure as hell can put the malware anywhere you want

True. (But in case it amuses you or others reading along:) But a code settings file still carries it's own special risk, as an executable file, in a predictable place, that gets run regularly.

An executable settings file is particularly nice for the attacker, as it's a great place to ensure that any injected code gets executed without much effort.

In particular, if an attacker can force a reboot, they know the settings file will get read reasonably early during the start-up process.

So a settings file that's written in code can be useful for an attacker who can write to the disk (like through a poorly secured upload prompt), but doesn't have full shell access yet.

They will typically upload a reverse shell, and use a line added to settings to ensure the reverse shell gets executed and starts listening for connections.

Edit (because it may also amuse anyone reading along): The same attack can be accomplished with a JSON or YAML settings file, but it relies on the JSON or YAML interpreter having a known critical security flaw. Thankfully most of them don't usually have one, most of the time, if they're kept up to date.

load more comments (1 replies)
[-] 0x0@lemmy.dbzer0.com 8 points 6 days ago

Given the warning about capitalization, the best possible case is that they're using ast.literal_eval() rather than throwing untrusted input into eval().

Err, I guess they might be comparing strings to 'True' and are choosing to be really strict about capitalization for some reason.

[-] MajorHavoc@programming.dev 12 points 6 days ago

Yeah. Maybe .to_lower() is really expensive in their environment, lol.

load more comments (1 replies)
[-] shortrounddev@lemmy.world 21 points 6 days ago

I curse the sadist who decided True should be uppercase in Python

load more comments (3 replies)
[-] Aatube@kbin.melroy.org 16 points 6 days ago

Can't they just convert a "true" input to backend to uppercase

[-] PotatoesFall@discuss.tchncs.de 28 points 6 days ago

Yep they should use a config file format like JSON or TOML or YAML or what have you, and then decode that into python objects. Using an actual programming language for config is dumb as hell IMO. (inb4 pissed off suckless fans)

load more comments (4 replies)
[-] MHLoppy@fedia.io 9 points 6 days ago

Searching for the phrase, documentation matches for Taiga so maybe you're right!

load more comments (1 replies)
[-] Tja@programming.dev 16 points 6 days ago

And you all complained when in C we used 1 and 0...

[-] npcknapsack@lemmy.ca 7 points 5 days ago
[-] Tja@programming.dev 4 points 5 days ago

Akcshually we use 0 and "not equal 0", since "not 0" would be 0xFF..FF, and (at least gcc) gives back a 1 for a true expression. No idea about the spec, probably undefined...

load more comments (1 replies)
[-] Aurenkin@sh.itjust.works 33 points 6 days ago

The cherry on top is that they didn't even spell settings correctly.

[-] SpaceNoodle@lemmy.world 25 points 6 days ago

settiings is spelled differently on the backend

load more comments (1 replies)
[-] fibojoly@sh.itjust.works 20 points 6 days ago

Glorious. I remember some hilarious nonsense in an API where the devs I worked with hadn't known they could just use boolean in JSON and had badly implemented it through strings, but this... This is amazing!

[-] jimmux@programming.dev 8 points 6 days ago

At my last job we had a lot of old code, and our supposedly smartest framework people couldn't be bothered learning front end properly. So there was a mix of methods for passing values to the front end, but nobody seemed to think of just passing JSON and parsing it into a single source of truth. There was so much digging for data in hidden columns of nested HTML tables, and you never knew if booleans would be "true", "TRUE", "1", or "Y" strings.

Never mind having to unformat currency strings to check the value then format them back to strings after updating values.

I fixed this stuff when I could, but it was half baked into the custom framework.

load more comments (1 replies)
[-] dpflug@kbin.earth 18 points 6 days ago

Implying Hell is frontend.... yeah, actually, that tracks.

[-] Robust_Mirror@aussie.zone 4 points 6 days ago

Baseball, huh?

[-] cupcakezealot@lemmy.blahaj.zone 11 points 5 days ago

var true = false;

var false = true;

[-] oldfart@lemm.ee 14 points 6 days ago

What happened to the good old 1

[-] LeFrog@discuss.tchncs.de 21 points 6 days ago

Backend: 1

Frontend: ¹

load more comments (1 replies)
[-] BeigeAgenda@lemmy.ca 14 points 6 days ago

Hear me out, what about using JSON to store the configuration in the Python backend?

[-] UnfortunateShort@lemmy.world 9 points 6 days ago

You need to use as many different formats as possible, otherwise you look unprofessional

load more comments (1 replies)
[-] ramble81@lemm.ee 10 points 6 days ago

I’ve always hated case sensitivity. I know that at an ASCII level “variable” != “Variable” but is there really a reason to have a distinction between them?

[-] vithigar@lemmy.ca 22 points 6 days ago

You stated the reason yourself. Those are different values and matching in a case-insensitive manner is more work under the hood.

load more comments (4 replies)
[-] fibojoly@sh.itjust.works 19 points 6 days ago

You are thinking it's easy because you only think of e == E, but I'll let you look up collation and accents and, you know, Unicode and let you think about it.

There is nothing trivial about case sensitivity, except in trivial cases.

[-] pHr34kY@lemmy.world 6 points 6 days ago

The backend and frontend on the product I work on are like this.

As long as you remember that booleans are not strings and should always be parsed if they are, this won't be a problem.

I am yet to see a boolean.parse() implementation in the wild that is case sensitive.

[-] computergeek125@lemmy.world 2 points 4 days ago

The could be using .js and .py files directly as config files and letting the language interpreter so the heavy lifting. Just like ye olde config.php.

And yes this absolutely will allow code injection by a config admin.

[-] lily33@lemm.ee 10 points 6 days ago

That makes me think, perhaps, you might be able to set it to exec("stuff") or True...

[-] LovableSidekick@lemmy.world 8 points 6 days ago* (last edited 6 days ago)
load more comments (3 replies)
[-] Draegur@lemm.ee 7 points 6 days ago

Cap in the back, low-key up front. Got it.

load more comments
view more: next ›
this post was submitted on 21 Mar 2025
679 points (99.4% liked)

Programmer Humor

21900 readers
2708 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS