• 1 Post
  • 1.27K Comments
Joined 3 years ago
cake
Cake day: June 12th, 2023

help-circle

  • You know what? Rather than over-complicate things you can probably just check that filenames contain a small set of white-listed chars. [a-zA-z-._] (and != ‘…’ or ‘.’) or something.

    And one other nit-pick if you’re up for more code-review - your authentication logic should probably be inverted:

    if !ok || user != session.config.username ||
    				pass != session.config.password
    

    I’d change that to be something like

    if ok && user == session.config.username && pass == session.config.password {
       // do login
    } else {
       // not auth
    }
    

    There’s a whole category of security errors where an exception in logic like that causes the code to skip the “you’re not allowed” logic and go right to the “you’re allowed!” block. It’s more of an issue with languages that support exceptions but it’s still considered a best practice generally (it’s also typically easier to read).















  • But even without , the arch way isn’t insane either: when something kernel-related breaks, boot with a live system on USB and fix it.

    That is not a replacement for “arrow-key down during boot to select an older kernel”.

    I have a server with a RAID card and the kernel at some point introduced a bug with the driver that prevented that server from booting. So I select the older kernel at boot, get the system up and running, mark that kernel as the default until the bug is fixed.

    It’s not crazy, it doesn’t take long, you just need to know how the system works.

    I know how the system works very well thankyouverymuch. But that’s an insane option when having multiple older kernels is so easy to do and common.



  • Don’t feel silly! It’s a common mistake, easy to fix, and easy to make. I’ve seen experienced developers do something similar.

    It seems you’ve resolved the issue at this point but remember you can always run commands by specifying their full path as well (should you end up in a similar situation). All the PATH variable does is set the default locations to search when you don’t provide a full path to a binary.

    e.g. /bin/ls or /usr/bin/vi