Developers: I will never ever do that, no one should ever do that, and you should be ashamed for guiding people to. I get that you want to make things easy for end users, but at least exercise some bare minimum common sense.

The worst part is that bun is just a single binary, so the install script is bloody pointless.

Bonus mildly infuriating is the mere existence of the .sh TLD.

Edit b/c I’m not going to answer the same goddamned questions 100 times from people who blindly copy/paste the question from StackOverflow into their code/terminal:

WhY iS ThaT woRSe thAn jUst DoWnlOADing a BinAary???

  1. Downloading the compiled binary from the release page (if you don’t want to build yourself) has been a way to acquire software since shortly after the dawn of time. You already know what you’re getting yourself into
  2. There are SHA256 checksums of each binary file available in each release on Github. You can confirm the binary was not tampered with by comparing a locally computed checksum to the value in the release’s checksums file.
  3. Binaries can also be signed (not that signing keys have never leaked, but it’s still one step in the chain of trust)
  4. The install script they’re telling you to pipe is not hosted on Github. A misconfigured / compromised server can allow a bad actor to tamper with the install script that gets piped directly into your shell. The domain could also lapse and be re-registered by a bad actor to point to a malicious script. Really, there’s lots of things that can go wrong with that.

The point is that it is bad practice to just pipe a script to be directly executed in your shell. Developers should not normalize that bad practice.

  • Godort@lemm.ee
    link
    fedilink
    English
    arrow-up
    61
    arrow-down
    1
    ·
    9 months ago

    It’s bad practice to do it, but it makes it especially easy for end users who already trust both the source and the script.

    On the flip side, you can also just download the script from the site without piping it directly to bash if you want to review what it’s going to do before you run it.

    • Deello@lemm.ee
      link
      fedilink
      English
      arrow-up
      21
      arrow-down
      3
      ·
      9 months ago

      It’s bad practice to do it, but it makes it especially easy for end users who already trust both the source and the script.

      You’re not wrong but this is what lead to the xz “hack” not to long ago. When it comes to data, trust is a fickle mistress.

  • Scrubbles@poptalk.scrubbles.tech
    link
    fedilink
    English
    arrow-up
    18
    arrow-down
    1
    ·
    9 months ago

    I’ve seen a lot of projects doing this lately. Just run this script, I made it so easy!

    Please, devs, stop this. There are defined ways to distribute your apps. If it’s local provide a binary, or a flatpak or exe. For docker, provide a docker image with well documented environments, ports, and volumes. I do not want arbitrary scripts that set all this up for me, I want the defined ways to do this.

  • aesthelete@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    ·
    9 months ago

    That’s becoming alarmingly common, and I’d like to see it go away entirely.

    Random question: do you happen to be downloading all of your Kindle books? 😜

    • Admiral Patrick@dubvee.orgOP
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      1
      ·
      9 months ago

      I mean, how about:

      1. Download the release for your arch from the releases page.
      2. Extract to ~/.local/bin
      3. Run
        • Admiral Patrick@dubvee.orgOP
          link
          fedilink
          English
          arrow-up
          5
          arrow-down
          4
          ·
          9 months ago
          1. That’s been the way to acquire software since shortly after the dawn of time. You already know what you’re getting yourself into.
          2. There are SHA256 checksums of each binary file available in each release on Github. You can confirm the binary was not tampered with by comparing a locally computed checksum to the value in the release’s checksums file.
          3. Binaries can also be signed (not that signing keys have never leaked, but it’s still one step in the chain of trust)
          4. The install script is not hosted on Github. A misconfigured / compromised server can allow a bad actor to tamper with the install script that gets piped directly into your shell. The domain could also lapse and be re-registered by a bad actor to point to a malicious script. Really, there’s lots of things that can go wrong with that.

          The point is that it is bad practice to just pipe a script to be directly executed in your shell. Developers should not normalize that bad practice

          • branch@lemmy.world
            link
            fedilink
            English
            arrow-up
            7
            arrow-down
            4
            ·
            9 months ago

            If you trust them enough to use their binary, why don’t you trust them enough to run their install scripts as well?

            • moonpiedumplings@programming.dev
              link
              fedilink
              English
              arrow-up
              4
              ·
              9 months ago

              Trust and security aren’t just about protecting from malice, but also mistakes.

              For example, AUR packages are basically install scripts, and there have been a few that have done crazy things like delete a users /bin — not out of any malice, but rather simple human error.

              Binaries are going to be much, much less prone to these mistakes because they are in languages the creators have more experience with, and are comfortable in. Just because I trust someone to write code that runs on my computer, doesn’t mean I trust them to write an install script, especially given how many footguns bash has.

              Steam once deleted someone’s home directory.

              • branch@lemmy.world
                link
                fedilink
                English
                arrow-up
                0
                ·
                9 months ago

                How do you know the script hasnt been compromised?

                You don’t, same as you don’t know if the binary has been compromised, just like when a npm package deleted files for russian users. I get that running scripts from the internet without looking at them first to understand what they do is not secure, but downloading and running anything from the internet is coupled with some amount of risk. How do you know that you won’t be mining crypto currency in addition to the original purpose of the binary? You don’t unless you read the source code.

                It all comes down to if you trust the provider or not. Personally, if I trust them enough to run binary files on my computer, I trust them enough to use their scripts for installation. I don’t agree that something is more unsafe just because it is a script.

                package manager

                Not everything is provided with a package manager, and not everything is up to update with the OS provided package manager. I agree that one should ideally use a package manager with third party validation if that is an option.

  • tgt@programming.dev
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    9 months ago

    What’s that? A connection problem? Ah, it’s already running the part that it did get… Oops right on the boundary of rm -rf /thing/that/got/cut/off. I’m angry now. I expected the script maintainer to keep in mind that their script could be cut off at litterally any point… (Now what is that set -e the maintainer keeps yapping about?)

    Can you really expect maintainers to keep network error in mind when writing a Bash script?? I’ll just download your script first like I would your binary. Opening yourself up to more issues like this is just plain dumb.

      • Ziglin (it/they)@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        9 months ago

        It runs the curl command which tries to fetch the entire script. Then no matter what it got (the intended script, half the script, something else because somebody tampered with it) it just runs it without any extra checks.

  • gandalf_der_12te@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    5
    ·
    9 months ago

    tbf, every time you’re installing basically anything at all, you basically trust whoever hosts the stuff that they don’t temper with it. you’re already putting a lot of faith out there, and i’m sure a lot of the software actually contains crypto-mineware or something else.

  • Azzu@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    2
    ·
    9 months ago

    You are being irrational about this.

    You’re absolutely correct that it is bad practice, however, 98% of people already follow bad practice out of convenience. All the points you mentioned against “DoWnlOADing a BinAary” are true, but it’s simply what people do and already don’t care about.

    You can offer only your way of installing and people will complain about the inconvenience of it. Especially if there’s another similar project that does offer the more convenient way.

    The only thing you can rationally recommend is to not make the install script the “recommended” way, and recommend they download the binaries from the source code page and verify checksums. But most people won’t care and use the install script anyway.

    If the install script were “bloody pointless”, it would not exist. Most people don’t know their architecture, the script selects it for them. Most people don’t know what “adding to path” means, this script does it for them. Most people don’t know how to install shell completions, this script does it for them.

    You massively overestimate the average competence of software developers and how much they care. Now, a project can try to educate them and lose potential users, or a project can follow user behavior. It’s not entirely wrong to follow user behavior and offer the better alternatives to competent people, which this project does. It explains that it’s possible and how to download the release from the Github page.

  • TrickDacy@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 months ago

    I’m curious, op, do you think it’s bad to install tools this way in an automated fashion, such as when developing a composed docker image?

    • Moonrise2473@feddit.it
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      Protect from accidental data damage: for example the dev might have accidentally pushed an untested change where there’s a space in the path

      rm -rf / ~/.thatappconfig/locatedinhome/nothin.config

      a single typo that will wipe the whole drive instead of just the app config (yes, it happened, I remember clearly more a decade ago there was a commit on GitHub with lots of snarky comments on a script with such a typo)

      Also: malicious developers that will befriend the honest dev in order to sneak an exploit.

      Those scripts need to be universal, so there are hundreds of lines checking the Linux distro and what tools are installed, and ask the user to install them with a package manager. They require hours and hours of testing with multiple distros and they aren’t easy to understand too… isn’t it better to use that time to simply write a clear documentation how to install it?

      Like: “this app requires to have x, y and z preinstalled. [Instructions to install said tools on various distros], then copy it in said subdirectory and create config in ~/.ofcourseinhome/”

      It’s also easier for the user to uninstall it, as they can follow the steps in reverse

      • TrickDacy@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 months ago

        Yes I understand all of that, but also in the context of my docker containers I wouldn’t be losing any data that isn’t reproducible

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    3
    ·
    9 months ago

    I’ll die on the hill that curl | bash is fine if you’re installing software that self updates - very common for package managers like other comments already illustrated.

    If you don’t trust the authors, don’t install it (duh).

    • moonpiedumplings@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      If you don’t trust the authors, don’t install it (duh).

      Just because I trust the authors to write good rust/javascript/etc code, doesn’t mean I trust them to write good bash, especially given how many footguns bash has.

      Steam once deleted a users home directory.

      But: I do agree with you. I think curl | bash is reasonable for package managers like nix or brew. And then once those are installed, it’s better to get software like the Bun OP mentions from them, rather than from curl | bash.

  • IceFoxX@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    9 months ago

    4.Since MS bought github, github is no longer trustworthy. Databreaches etc have increased since MS owns github. Distribution of malware via github as well. What is the 4 point supposed to say?