-
-
Notifications
You must be signed in to change notification settings - Fork 110
Description
The postinstall script is known to cause portability issues (#468) or to be kinda broken (#498), but it's also a security liability!
See for example shai-hulud and sha1-hulud in NPM packages for example:
Those releases embedded a
postinstallscript (bundle.js) that attempted to harvest developer tokens (e.g., npm, GitHub, cloud credentials) and exfiltrate secrets. Treat any system that installed these versions as fully compromised.
This is easy to reproduce:
name: "nice"
version: "1.0.0"
scripts:
postinstall: "sh build.sh"Seems fine... until build.sh runs rm -rf $HOME.
Install the nice shard and you'll wipe your HOME directory 💥
Running whatever must require explicit user approval.
At the very least Shards should run the postinstall script on demand only, and take a list of authorized shards:
- the
--skip-postinstallargument shall become a NOOP - add
--run-postintall=<allow,list>for example--run-postinstall=protobuf,grpc,interro
Since installing executables is tightly coupled with the postinstall script having build said executables (#498):
- the
--skip-executablesargument shall become a NOOP - add
--install-executables=<allow,list>argument
This would solve all the issues around the postinstall script and make it harder to use and thus harder to shoot yourself in the foot (or worse).
EDIT: ideally Shards should drop support for the postinstall script altogether, making the entry in shard.yml informational only.