kuuhana
  • Communities
  • Multi-communities
  • Support Lemmy
  • Search
  • Login
  • Sign Up
Programmer Humor@programming.devbyMHLoppy@fedia.io
1 year

isInHell = 'true'

fedia.io

Original post: hachyderm.io (Mastodon)

82
    You must log in or register to comment.

    • Lucy :3@feddit.org
      1 year

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

        • janonymous@lemmy.world
          1 year

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

            • Bezier@suppo.fi
              1 year

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

              • Lovable Sidekick@lemmy.worldEnglish
                1 year

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

                  • Trainguyrom@reddthat.comEnglish
                    1 year

                    There’s a double-i in “settings” in the documentation screenshot

                      • Lovable Sidekick@lemmy.worldEnglish
                        1 year

                        That’s what I get for having sucky vision.

                          • far_university190@feddit.orgEnglish
                            1 year

                            That why you only sidekick. MC need perfect vision.

                    • mexicancartel@lemmy.dbzer0.comEnglish
                      1 year

                      They specifically said “this is not a typo”!!!

                    • jjjalljs@ttrpg.network
                      1 year

                      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
                          1 year

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

                            • LostXOR@fedia.io
                              1 year

                              deleted by creator

                                • MajorHavoc@programming.dev
                                  1 year

                                  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
                                  1 year

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

                                    • raldone01@lemmy.world
                                      1 year

                                      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
                                          1 year

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

                                            • MajorHavoc@programming.dev
                                              1 year

                                              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.

                                            • mmddmm@lemm.ee
                                              1 year

                                              Every environment has plenty of good places to put persistent malware. Even if you run your docker images as ro.

                                          • Trailblazing Braille Taser@lemmy.dbzer0.com
                                            1 year

                                            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
                                                1 year

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

                                              • SchwertImStein@lemmy.dbzer0.comEnglish
                                                1 year

                                                It’s not User input, it’s config file

                                              • shortrounddev@lemmy.worldEnglish
                                                1 year

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

                                                  • jdeath@lemm.ee
                                                    1 year

                                                    guido, why did you make python so weird?

                                                      • palordrolap@fedia.io
                                                        1 year

                                                        In this instance, I think there was some suggestion to write code in mostly lower case, including all user variables, or at least inCamelCaseLikeThis with a leading lower case letter, and so to make True and False stand out, they’ve got to be capitalised.

                                                        I mean. They could have been TRUE and FALSE. Would that have been preferable? Or how about a slightly more Pythonic style: __true__ and __false__

                                                          • jdeath@lemm.ee
                                                            1 year

                                                            i would go with lowercase and just have it be a reserved word like the other ones. but I’m not super picky, i generally like to stick to what people are used to, and i can understand the reasoning behind the choice.

                                                      • Aatube@kbin.melroy.org
                                                        1 year

                                                        Can’t they just convert a “true” input to backend to uppercase

                                                          • PotatoesFall@discuss.tchncs.de
                                                            1 year

                                                            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)

                                                            • jjjalljs@ttrpg.network
                                                              1 year

                                                              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.

                                                                • Fushuan [he/him]@lemm.ee
                                                                  1 year

                                                                  Fyi, using a condition to assign a boolean is equivalent to assigning the condition itself. No need for the IF.

                                                                    • jjjalljs@ttrpg.network
                                                                      1 year

                                                                      true, though sometimes i find the more verbose style easier to read, and more maintainable (eg: you want to do something else in the block, you can just add a line instead of changing your ternary / etc). Small things

                                                                  • hersh@literature.cafe
                                                                    1 year

                                                                    I refer you to #7 on Bruce Tognazzini’s evergreen top ten list of design bugs.

                                                                    https://www.asktog.com/Bughouse/10MostWantedDesignBugs.html

                                                                  • MHLoppy@fedia.io
                                                                    1 year

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

                                                                  • SatyrSack@feddit.orgEnglish
                                                                    1 year

                                                                    Could be worse. At least it’s documented

                                                                      • owl@infosec.pubEnglish
                                                                        1 year

                                                                        To me the biggest problem, that AI might solve is documentation.

                                                                          • EvilCartyen@feddit.dk
                                                                            1 year

                                                                            Have you tried to use AI for documentation? It’s pretty shit.

                                                                              • Hupf@feddit.org
                                                                                1 year

                                                                                Have you tried to use AI for <thing>? It’s pretty shit.

                                                                                  • Tja@programming.dev
                                                                                    1 year

                                                                                    Translation, proofreading, summarizing, brainstorming, boilerplate code, protein folding…

                                                                                      • stetech@lemmy.world
                                                                                        1 year

                                                                                        protein folding

                                                                                        We’re at the point where, due to how b2c tech services work, I think a lot of people think AI === LLM

                                                                                    • milicent_bystandr@lemm.ee
                                                                                      1 year

                                                                                      I’ve used AI to give me a good enough guess that I know the right keywords to search for too find the real documentation.

                                                                                      • Appoxo@lemmy.dbzer0.com
                                                                                        1 year

                                                                                        How about this:
                                                                                        Humans (or humans assisted by AI) write documentation
                                                                                        Users (devs included) can either choose to read the manual the old fashioned way or utilize it like a sort of swagger api documentation to give

                                                                                        1. Information to a question (How to do x)
                                                                                        2. Provide a general example
                                                                                        3. (Assuming it’s used with an IDE or has information about the project) Provide a personalized example on the implementation.
                                                                                        • thedeadwalking4242@lemmy.world
                                                                                          1 year

                                                                                          I’ve had pretty good experience with using AI to find what I’m looking for in documentation, especially if the docs are in context

                                                                                            • SatyrSack@feddit.orgEnglish
                                                                                              1 year

                                                                                              I think they mean having an AI read code and then write documentation for it. Not having an AI read documentation.

                                                                                      • Aurenkin@sh.itjust.works
                                                                                        1 year

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

                                                                                          • SpaceNoodle@lemmy.world
                                                                                            1 year

                                                                                            settiings is spelled differently on the backend

                                                                                            • themaninblack@lemmy.world
                                                                                              1 year

                                                                                              I swear, spelling mistakes are such an indicator for a codebase and the overall quality of the software team, and maybe the whole company. No attention paid to detail leaks out into other areas.

                                                                                            • fibojoly@sh.itjust.works
                                                                                              1 year

                                                                                              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
                                                                                                  1 year

                                                                                                  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.

                                                                                                  • sushibowl@feddit.nl
                                                                                                    1 year

                                                                                                    A system I work with gives all keys a string value of “Not_set” when the key is intended to be unset. The team decided to put this in because of a connection with a different, legacy system, whose developers (somehow) could not distinguish between a key being missing or being present but with a null value. So now every team that integrates with this system has to deal with these unset values.

                                                                                                    Of course, it’s up to individual developers to never forget to set a key to “Not_Set”. Also, they forgot to standardise capitalisation and such so there are all sorts of variations “NOT_SET”, “Not_set”, “NotSet”, etc. floating around the API responses. Also null is still a possible value you need to handle as well, though what it means is context dependent (usually it means someone fucked up).

                                                                                                  • dpflug@kbin.earth
                                                                                                    1 year

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

                                                                                                      • Robust Mirror@aussie.zone
                                                                                                        1 year

                                                                                                        Baseball, huh?

                                                                                                      • Tja@programming.dev
                                                                                                        1 year

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

                                                                                                          • npcknapsack@lemmy.caEnglish
                                                                                                            1 year

                                                                                                            We use 0 and not 0…

                                                                                                              • Tja@programming.dev
                                                                                                                1 year

                                                                                                                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…

                                                                                                                  • npcknapsack@lemmy.caEnglish
                                                                                                                    1 year

                                                                                                                    Damn you for correcting me correctly! :D

                                                                                                              • BeigeAgenda@lemmy.ca
                                                                                                                1 year

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

                                                                                                                  • UnfortunateShort@lemmy.world
                                                                                                                    1 year

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

                                                                                                                    • MajorHavoc@programming.dev
                                                                                                                      1 year

                                                                                                                      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.

                                                                                                                    • oldfart@lemm.ee
                                                                                                                      1 year

                                                                                                                      What happened to the good old 1

                                                                                                                        • LeFrog@discuss.tchncs.de
                                                                                                                          1 year

                                                                                                                          Backend: 1

                                                                                                                          Frontend: ¹

                                                                                                                          • anton@lemmy.blahaj.zone
                                                                                                                            1 year

                                                                                                                            2 happened

                                                                                                                          • katy ✨@lemmy.blahaj.zone
                                                                                                                            1 year

                                                                                                                            var true = false;

                                                                                                                            var false = true;

                                                                                                                            • lily33@lemm.ee
                                                                                                                              1 year

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

                                                                                                                              • ramble81@lemm.ee
                                                                                                                                1 year

                                                                                                                                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
                                                                                                                                    1 year

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

                                                                                                                                      • ramble81@lemm.ee
                                                                                                                                        1 year

                                                                                                                                        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.

                                                                                                                                          • WordBox@lemmy.world
                                                                                                                                            1 year

                                                                                                                                            Humans have to make it do the work. And that’s how Mr; DROP TABLE makes his money.

                                                                                                                                            • lengau@midwest.social
                                                                                                                                              1 year

                                                                                                                                              ✋ Case insensitive filesystem
                                                                                                                                              👉 Case insensitive file sorting

                                                                                                                                              • calcopiritus@lemmy.world
                                                                                                                                                1 year

                                                                                                                                                For some reason we decided that a lot of formats written by computers and read by computers would use ASCII encoding instead of raw data.

                                                                                                                                                Making a json or XML deserializer case insensitive would just make it slower for almost 0 benefit.

                                                                                                                                            • fibojoly@sh.itjust.works
                                                                                                                                              1 year

                                                                                                                                              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.

                                                                                                                                            • Lovable Sidekick@lemmy.worldEnglish
                                                                                                                                              1 year

                                                                                                                                              isInHell = '(x + 1 > x)'

                                                                                                                                                • Flipper@feddit.org
                                                                                                                                                  1 year

                                                                                                                                                  Fun and games till x overflows.

                                                                                                                                                    • Lovable Sidekick@lemmy.worldEnglish
                                                                                                                                                      1 year

                                                                                                                                                      LOL but it was ’ x + 1’ not ‘x += 1’ tho.

                                                                                                                                                        • Flipper@feddit.org
                                                                                                                                                          1 year

                                                                                                                                                          We don’t know what value X has. If it isn’t initialised it could have any value including the maximum. Then it would overflow.

                                                                                                                                                          But let’s be honest, that is unlikely.

                                                                                                                                                    • Cyrus Draegur@lemm.eeEnglish
                                                                                                                                                      1 year

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

                                                                                                                                                      • pHr34kY@lemmy.world
                                                                                                                                                        1 year

                                                                                                                                                        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.worldEnglish
                                                                                                                                                            1 year

                                                                                                                                                            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.

                                                                                                                                                          Programmer Humor@programming.dev

                                                                                                                                                          programmer_humor@programming.dev

                                                                                                                                                          Subscribe from remote instance

                                                                                                                                                          Create post

                                                                                                                                                          Report community

                                                                                                                                                          Modlog
                                                                                                                                                          You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

                                                                                                                                                          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
                                                                                                                                                          Visibility: Public

                                                                                                                                                          This community is visible to everyone.

                                                                                                                                                          • 401 users / Day
                                                                                                                                                          • 2.65K users / Week
                                                                                                                                                          • 2.71K users / Month
                                                                                                                                                          • 14.7K users / 6 months
                                                                                                                                                          • 2.35K posts
                                                                                                                                                          • 90K comments
                                                                                                                                                          • 2 local subscribers
                                                                                                                                                          • 31.9K subscribers
                                                                                                                                                          • UI: 1.0.0-beta.0
                                                                                                                                                          • BE: 1.0.0-alpha.20
                                                                                                                                                          • Modlog
                                                                                                                                                          • Instances
                                                                                                                                                          • Docs
                                                                                                                                                          • Code
                                                                                                                                                          • join-lemmy.org