Re:“Curl Bash piping” wall of shame
by edwintorok on Saturday October 22, 2016 @03:18AM
(#12767636)
What if the download gets interrupted due to network error and bash runs something else than what was intended.
E.g. the script has:
But when the pipe gets interrupted it executes:
[ Parent
| on HN ]
Re:“Curl Bash piping” wall of shame
by plorkyeran on Saturday October 22, 2016 @03:59AM
(#12767731)
The body of the shell script should be wrapped in a function which is invoked at the end. If you do not trust them to get this incredibly basic thing right, how can you possibly trust any of the other code they have written?
sandstorm.io said: «If the connection dies mid-line, bash will execute the incomplete line – however, this can be mitigated by wrapping the whole script in a bash function executed on the last line, as we do.» (Source: https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-p...)
The same way thousands of people trust Steam. You would expect a company of Valve's size to get their Linux uninstaller right, but people found out the hard way that it was removing their entire home directories.
People make mistakes. Mistakes contained to programs is one thing. Mistakes in shell scripts tend to have bigger consequences.
Re:“Curl Bash piping” wall of shame
by RealityVoid on Saturday October 22, 2016 @05:15AM
(#12767960)
Soo, maybe a silly question... but are downloads from the internet always "linear"? Meaning they go uninterrupted from start to end and if it drops it will stop in the middle of the downloaded file? Doesn't it get "pieces" and then place them together?
It depends on your download program, but that's irrelevant because of the pipe. It has to be linearized before going through the pipe.
Packets can arrive out of order, yeah. TCP includes ordering information, so lost packets can be retransmitted and in the end everything'll be in proper order.
As for UDP, I'd tell ya a UDP joke, but get it you might not.
It does get pieces, which are sequential. At least, curl does, if you don't tell it otherwise.
Re:“Curl Bash piping” wall of shame
by ahazred8ta on Sunday October 23, 2016 @10:55PM
(#12776549)
The https://github.com/silentbicycle/curlbash utility can check the hash of the script and refuse to run it if there's a mismatch.