So we need to be careful with upper- and lowercase. Meanwhile the docs: > settiings
Programmer Humor
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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
Yes, the settiings are different than the settings. You also need to be careful with those.
had to use a different spelliings at backend and frontend, otherwise it wouldn't work.
no, settings = settings but settings != Settings, as we all know.
There's a double-i in "settings" in the documentation screenshot
Is the backend Python and the frontend JavaScript? Because then that would happen and just be normal, because Boolean true is True
in python.
Probably, but if you're interpreting user inputs as raw code, you've got much much worse problems going on, lol.
[...]®ister=import os; os.system("sudo rm -rf /"); return True
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...
It's the settiings file... It's probably supposed to only be written by the system admin.
A good place to put persistent malware. That's why when using docker images always mount as ro if at all possible.
It’s you can modify the settings file you sure as hell can put the malware anywhere you want
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.
Yeah. Maybe .to_lower() is really expensive in their environment, lol.
Can't they just convert a "true" input to backend to uppercase
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)
Depends on how it's set up. If the setting is going into the env it's a string, so I'd expect some sort of
if os.getenv("this_variable", "false").lower() == "true": # or maybe "in true, yes, on, 1" if you want to be weird like yaml
this_variable = True
else:
this_variable = False
Except maybe a little more elegant and not typed on my phone.
But if the instructions are telling the user to edit the settings directly, like where I wrote this_variable=True, they'd need to case it correctly there.
The cherry on top is that they didn't even spell settings correctly.
settiings is spelled differently on the backend
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!
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.
Hear me out, what about using JSON to store the configuration in the Python backend?
You need to use as many different formats as possible, otherwise you look unprofessional
I like your idea, but hear me out:
A Python file for configuration is the best way to guarantee that any friendly code I write to help the user with config usually won't execute. And I hate my users.
And you all complained when in C we used 1 and 0...
That makes me think, perhaps, you might be able to set it to exec("stuff") or True
...
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?
You stated the reason yourself. Those are different values and matching in a case-insensitive manner is more work under the hood.
We do plenty of stuff for human consumption. Computers work for us, not the other way around. Insensitivity should be the default. It’s okay to give options. I’m not saying take that away.
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.
Cap in the back, low-key up front. Got it.
!!true
't'+'r'+'u'+'e'