I read TFA. Why would a truncated partial download happen and still run the script?
"So that a truncated partial download doesn't end up executing half a script"
41–50 of 87 posts
Re: "So that a truncated partial download doesn't end up executing half a script"
#42I read TFA. Why would a truncated partial download happen and still run the script?
Re: "So that a truncated partial download doesn't end up executing half a script"
#43A serious question for any Linux-heads here, no insult intended. How is it possible that there are ELEVEN different possible package managers that need to be supported by an installation script like this? I can understand that some divergences in philosophical or concrete requirements could lead to two, three, or four opinionated varieties, but ELEVEN? Does that mean that if I want to write an app that runs on Linux…
Re: "So that a truncated partial download doesn't end up executing half a script"
#44Don't pipe curl/wget a script to a shell without reading what you've downloaded. This should be common sense. Do `wget $url; most install.sh` and only if you're satisfied with what you read , execute `sh install.sh`.
Everyone says this, but nearly nobody does it. Just like security through open source, it's more a nice myth than a reality.
Re: "So that a truncated partial download doesn't end up executing half a script"
#45Earlier quoted context omitted.
The xz situation proved the opposite: if you're up against someone smart, you won't read the script (and you'll think you have).
The xz situation proved that while you didn't read the script, someone did detect the problem. It shows the benefit of many-eyes.
Re: "So that a truncated partial download doesn't end up executing half a script"
#46Don't pipe curl/wget a script to a shell without reading what you've downloaded. This should be common sense. Do `wget $url; most install.sh` and only if you're satisfied with what you read , execute `sh install.sh`.
But security!
Re: "So that a truncated partial download doesn't end up executing half a script"
#47A serious question for any Linux-heads here, no insult intended. How is it possible that there are ELEVEN different possible package managers that need to be supported by an installation script like this? I can understand that some divergences in philosophical or concrete requirements could lead to two, three, or four opinionated varieties, but ELEVEN? Does that mean that if I want to write an app that runs on Linux…
Re: "So that a truncated partial download doesn't end up executing half a script"
#48A serious question for any Linux-heads here, no insult intended. How is it possible that there are ELEVEN different possible package managers that need to be supported by an installation script like this? I can understand that some divergences in philosophical or concrete requirements could lead to two, three, or four opinionated varieties, but ELEVEN? Does that mean that if I want to write an app that runs on Linux…
You don't have to do anything, it's just about how convenient you want to make it.
Re: "So that a truncated partial download doesn't end up executing half a script"
#49Earlier quoted context omitted.
As opposed to downloading a binary install file?
Distributors usually give you a way to verify that what you've downloaded is correct, usually through checksums, PGP signatures, code signing... You forego that if you pipe the script to your shell. What if you make a typo and somehow pipe an HTML document to your shell? If you're unlucky this could wreak havoc.
In this case, I assume the reason to inspect the script is not so much that the script might be doing something bad, but rather that you may have downloaded the wrong file to begin with.
With that in mind:
> Distributors usually give you a way to verify that what you've downloaded is correct
The first thing is that not all software is downloaded from Linux distribution repositories. This technique doesn't work if you're just downloading an installer from a website or Github releases page, etc. Sure, many also provide you with a checksum that you need to manually verify, but the shell script in question can also do the same. In fact, it can help by automating the check after it inevitably downloads the application's binary package.
In this case, the vector is you getting something different from what the vendor intended you to download. An example would be if your connection had been MITM'ed and a malicious package had been sent in its place.
This is largely a non-issue these days with TLS certs everywhere, SNI, OCSP stapling and other protections that more or less ensure you're connected to the right server.
> What if you make a typo and somehow pipe an HTML document to your shell?
That's quite the bad luck!
In this case, the user made a typo.
Most `curl | bash` commands are copy-pasted from a website rather than typed out, so this is _mostly_ a non-issue as well.
For those cases where the user typed the command and got it wrong, for it to become a problem, at least these 2 things need to be true:
* the typoed URL actually downloaded something that the shell can interpret
* there are commands in this downloaded document that actually wreak havoc to the system where they ran
I fail to see a scenario where that would happen. Not that it's impossible, but it's so unrealistic that if it happened to me I might just shutdown the computer and go buy a lottery ticket!Re: "So that a truncated partial download doesn't end up executing half a script"
#50Don't pipe curl/wget a script to a shell without reading what you've downloaded. This should be common sense. Do `wget $url; most install.sh` and only if you're satisfied with what you read , execute `sh install.sh`.
Unless you're read to fully analyze all the code and look for problems in the whole code, instead of just the install script, don't be an eager early adopter of every project you see posted somewhere, wait for it to have some social validation, give it sometime so smarter people with more time than us had their time looking for vulnerabilities in the whole code, not only on the script. Or if you really want to check it, use an isolated VM first.