3 ms·
Can't edit my comment so I'll write as a reply This is to all the people saying no difference between downloading and running right away If the download get
by godelski 3y ago
Can't edit my comment so I'll write as a reply
This is to all the people saying no difference between downloading and running right away
If the download gets interrupted bash will execute the partial line. That means `rm -r /tmp/foo.ext` or `rm -r ${HOME}/.tmp_config` can execute as `rm -r /`. This can be mitigated by wrapping the script. Best way to do this is wrap the whole script into a function and then execute at the last line[0]. Oh, and you can detect `curl|bash` server side[1]
[0] https://archive.is/20160603044800/https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install https://archive.is/20160603044800/https://sandstorm.io/news/...
[1] https://archive.is/20230325190353/https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/ https://archive.is/20230325190353/https://www.idontplaydarts...
Edit: as an example, rust does the warpping. But they still place this stupid shit on in their install instructions. Bad Rust! Bad!
https://www.rust-lang.org/tools/install https://www.rust-lang.org/tools/install
- rezonant 3y agoI agree that it's a risk to pipe to sh but that's not what we're doing here, and I'd hope that most of the people aren't saying there's no difference between piping to man and piping to sh.
- Arnavion 3y ago>Best way to do this is wrap the whole script into a function and then execute at the last line[0]. It's not the best way. If your function is named `lsp_init` and your last line is `lsp_init`, a partial line can result in the execution of `ls`. AFAIK the best way is to just wrap your script in `()`.
- godelski 3y agoYou're right! That's a good thing to point out. Elsewhere I suggested Rust change their install to this though. Solves pretty much all the probems curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rust_install.sh && sh /tmp/rust_install.sh (obviously doesn't solve the problem of inspection, but I think we all know that's not going to happen anyways)
- cyberpunk 3y agoHow will it execute the partial line? Interrupted downloads don't just randomly insert <CR>s into the line?