4 ms·
A while back I wrote a opt-in tool called npl-lint[1] that would allow some CI-level enforcement of rules in package.json although I didn't go too far with it -
by tanepiper 6y ago
A while back I wrote a opt-in tool called npl-lint[1] that would allow some CI-level enforcement of rules in package.json although I didn't go too far with it - one thing was to check the scripts section and allow whitelisted apps, or whitelisted sources for dependencies.
It came about because I ended up having a spat with one of the NPM engineers at the time because they launched npx with the ability to run arbitrary gists[2] and this was before 2FA (FWIW you can still absolutely do this with npx).
I wrote a proof of concept[3] that showed you could, inside a package.json add a command to install another package from a gist location, and then use that to steal credentials, bash history, etc.
[1] https://github.com/tanepiper/npm-lint https://github.com/tanepiper/npm-lint
[2] https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b https://medium.com/@maybekatz/introducing-npx-an-npm-package...
[3] https://github.com/tanepiper/steal-ur-stuff https://github.com/tanepiper/steal-ur-stuff
- efortis 6y agoThis is a valid approach. In rules.js, besides `.split('&&')`, I'd try other separators like ';' and '||' and encodings like '\046'