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.

    • AnyOldName3@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      8 hours ago

      PowerShell has a system to sign scripts, and with its default configuration, will refuse to execute scripts, and with the more sensible configuration you should switch to if you actually use PowerShell, refuses to execute unsigned scripts from the Internet.

      I suspect that most of the scripts you’re referring to just set -ExecutionPolicy Bypass to disable signature checking and run any script, though.

  • aesthelete@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    16 hours 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? 😜

    • DuckWrangler9000@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      16 hours ago

      I think you and a lot of others are late to the idea that mildly is kinda like a joke. Many things are majorly infuriating. On the reddit, many of their top posts aren’t even major. They’re catastrophic, just absurd. I’ve yet to find anything mild

  • gandalf_der_12te@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    18 hours 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.

  • tgt@programming.dev
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    2
    ·
    1 day 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.

  • Godort@lemm.ee
    link
    fedilink
    English
    arrow-up
    103
    arrow-down
    1
    ·
    2 days 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.

    • thebestaquaman@lemmy.world
      link
      fedilink
      English
      arrow-up
      18
      ·
      2 days ago

      Would have been much better if they just pasted the (probably quite short) script into the readme so that I can just paste it into my terminal. I have no issue running commands I can have a quick look at.

      I would never blindly pipe a script to be executed on my machine though. That’s just next level “asking to get pwned”.

      • WolfLink@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        12
        ·
        2 days ago

        These scripts are usually longer than that and do some checking of which distro you are running before doing something distro-specific.

        • zalgotext@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          4
          ·
          21 hours ago

          Doing something distro-specific in an install script for a single binary seems a bit overcomplicated to me, and definitely not something I want to blindly pipe into my shell.

          The bun install script in this post determines what platform you’re on, defines a bunch of logging convenience functions, downloads the latest bun release zip file from GitHub, extracts and manually places the binary in the right spot, then determines what shell you’re using and installs autocompletion scripts.

          Like, c’mon. That’s a shitload of unnecessary stuff to ask the user to blindly pipe into their shell, all of which could be avoided by putting a couple sentences into a readme. Bare minimum, that script should just be checked into their git repo and documented in their Readme/user docs, but they shouldn’t encourage anyone to pipe it into their shell.

    • Deello@lemm.ee
      link
      fedilink
      English
      arrow-up
      29
      arrow-down
      3
      ·
      2 days 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.

    • barsoap@lemm.ee
      link
      fedilink
      English
      arrow-up
      6
      ·
      edit-2
      20 hours ago

      --proto ‘=https’ --tlsv1.2

      That’s how you know they care, no MIMing that stuff without hijacking the CA at which point you have a whole another set of problems, and if you trust rustc to not delete your sources when they fail a typecheck, then you can trust their installer. -f is important to not execute half-downloaded scripts on failure, -s and -S are verbosity options, -L follow redirects.

    • felbane@lemmy.world
      link
      fedilink
      English
      arrow-up
      32
      arrow-down
      7
      ·
      2 days ago

      Common or not, it’s still fucking awful and the people who promote this nonsense should be ashamed of themselves.

    • ChaoticNeutralCzech@feddit.org
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      1 day ago

      There is even a Windows (Powershell) example for Winutil:

      Stable Branch (Recommended)

      irm "https://christitus.com/win" | iex
      

      Better than explaining how to make a .ps file trusted for execution (thankfully, one of the few executable file extensions that Windows doesn’t trust by default) but why not just use some basic .exe builder at this point?

      Obligatory “they better make it a script that automatically creates a medium for silent Linux Mint installation, modifies the relevant BIOS settings and restarts” to prevent obvious snarky replies

      • perishthethought@lemm.ee
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 days ago

        Yah, when I read this, I was like, pretty sure pi-hole started this as a popular option. I dig it though, so I guess OP and I are not on the same page. (I do usually look over the bash scripts before running them piped to bash, though.

    • PlexSheep@infosec.pub
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 day ago

      For rust at least, those are packaged in Debian and other distros too. I think rustup is in Debian Trixie too.

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    17
    arrow-down
    2
    ·
    edit-2
    2 days ago

    You really should use some sort of package manager that has resistance against supply chain attacks. (Think Linux distros)

    You probably aren’t going to get yourself in trouble by downloading some binary from Github but keep in mind Github has been used for Malware in the past.

  • Scrubbles@poptalk.scrubbles.tech
    link
    fedilink
    English
    arrow-up
    23
    arrow-down
    1
    ·
    2 days 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.

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        9
        ·
        edit-2
        2 days ago

        In most cases the script already installs a pre-compiled binary that can be anything, they wouldn’t need to make the script itself malicious if they were bad actors.

    • Admiral Patrick@dubvee.orgOP
      link
      fedilink
      English
      arrow-up
      8
      arrow-down
      2
      ·
      2 days 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
          8
          arrow-down
          6
          ·
          edit-2
          2 days 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

          • uranibaba@lemmy.world
            link
            fedilink
            English
            arrow-up
            14
            arrow-down
            5
            ·
            2 days 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
              5
              ·
              edit-2
              1 day 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.

            • jatone@lemmy.dbzer0.com
              link
              fedilink
              English
              arrow-up
              6
              arrow-down
              1
              ·
              2 days ago

              How do you know the script hasnt been compromised? Is every user competent enough to evaluate it to ensure its safe to run?

              Using package managers to handle this provides a couple things: First: most package manager have builtin mechanisms to ensure the binary is unmodified Second: they provide a third party validating them.

              • uranibaba@lemmy.world
                link
                fedilink
                English
                arrow-up
                4
                ·
                1 day 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.

                • jatone@lemmy.dbzer0.com
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  arrow-down
                  1
                  ·
                  1 day ago
                  1. no one is talking about NPM libraries. we’re talking about released packages.
                  2. you absolutely can ensure a binary hasnt been tampered with. its called checksumming.
                  3. you’re confusing MITM attacks with supply chain attacks. MITM attacks are far easier to pull off.

                  Not everything is provided with a package manager

                  Yes. thats precisely the problem we’re pointing out to you. if you’re going to provide software over the internet provide a proper package with checksum validation. its not hard, stop providing bash scripts.

  • MicrowavedTea@infosec.pub
    link
    fedilink
    English
    arrow-up
    21
    ·
    2 days ago

    I agree but hey at least you can inspect the script before running it, in contrast to every binary installer you’re called to download.

  • treadful@lemmy.zip
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    1
    ·
    2 days ago

    I’m with you, OP. I’ll never blindly do that.

    Also, to add to the reasons that’s bad:

    • you can put restrictions on a single executable. setuid, SELinux, apparmor, etc.
    • a simple compromise of a Web app altering a hosted text file can fuck you
    • it sets the tone for users making them think executing arbitrary shell commands is safe

    I recoil every time I see this. Most of the time I’ll inspect the shell script but often if they’re doing this, the scripts are convoluted as fuck to support a ton of different *nix systems. So it ends up burning a ton of time when I could’ve just downloaded and verified the executable and have been done with it already.

  • badbytes@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    5
    ·
    20 hours ago

    I wouldn’t call anyone who does this, a developer. No offense, but its a horrible practice, that usually come from hacky projects.