This type of thing needs to stop
This type of thing needs to stop
Now we're getting to the real questions in life. :)
(Incidentally, this is probably the most fundamental software supply chain attack vector - manipulate the compiler binary used to compile the compiler used to compile the kernel and userspace. The attack payload would never appear in any sources, but would always be present in binaries.)
https://www.quora.com/What-is-a-coders-worst-nightmare/answe...
It'd be nice to know what and how I should manage updates.
Both of those just push the overall security a bit down the line, but both are ultimately not completely safe. The only truly safe action to take is to not download it at all.
It can be the difference between `rm -rf ~/.cache/foo` and `rm -rf ~/`
The standard way to solve this problem is to put the entire script inside a function, invoke that function in the last line of the script (as the only other top-level statement other than the function definition), and name it in such a way that substrings of the name are unlikely to map to anything that already exists. Note that the bun.sh script does not do this, but also from a quick glance the only thing that could noticeably go wrong is this line:
rmdir $bin_dir/bun-${target}
A truncated download could make it run `rmdir $bin_dir` instead, in which case it'll end up deleting ~/.bun instead of ~/.bun/bin/bun-${target}, which is probably not a big deal.thanks to dementiapatien below for the link https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...
Going through package registries/repositories is a slow process, so obviously want something faster.
Just GitHub releases? Would you be fine if the URL instead pointed to GitHub in that case?
The previous HN discussion said it better than I can: https://news.ycombinator.com/item?id=17636032
`sponge` reads the full input before passing it on
`vipe` inserts your editor inline, so you can view/modify the input before passing it on to bash (change an install directory, etc)