Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree with most of your post, but I do not understand this:

> Post install scripts are still a thing

I cannot find a situation where post-install script actually pose a security issue. I find that you'll always end up running the code you just installed on your machine (either through running unit tests, or running the actual code, or whatever). Hence, the only scenario where post-install scripts are a problem is:

- You install deps on a machine that has access to security sensitive resources (think: your ssh keys)

- BUT you do not run the resulting code on that machine.

Are there really any use-case that satisfies those requirement where post-install scripts would actually result in a security issue?



NPM for compiled frontend JavaScript. The resulting code only gets run in your users browsers, but the post install script could be run on your Jenkins/whatever box.

In general, anyone who gathers dependencies ahead of time before deployment, so they can just copy them over. So most people deploying to multiple machines/containers would be at a greater risk from a post install script


While this makes sense, my experience is that you end up with just a handful of dependencies for your actual product (“dependencies” in NPM parlance), but a whole herd of them for your build toolchain (“dev dependencies”). This happens because front end libraries don’t often have many, if any, dependencies themselves for fear bloating the JS slugs using them, whereas the Node libraries used to build it do not need to sweat that and each comes with a whole tree of transitive dependencies. So the exposure your build server has to supply chain attacks for code it runs directly is huge, much bigger than what’s just passing through. And for those toolchain reps, the GP’s point stands.


Ah, yes, I had totally failed to consider that NPM is now used much more widely than just for nodejs server code, and can be used for browser deps. Thanks for this!


Given the fact that deployments can also include a npm install, depending how you package and run your code. But that is not the point. An attacker can run code in the name of the current user. He can download and inject other code on the host or the project. Which means that even if you bundle your code in a docker image and you never run the install on the same machine, some code could have been injected. And I personally see any attack being against a production system or development machine relevant.


Maintainer scripts lower the bar for the attack.

In order to get the code in scripts executed at a predictable time – you add it there and done. In order to get the code in the library executed on the build box, you have to add it somewhere that's actually used by the environment you want to attack. Scripts allow more coverage more easily.

Plus, it's not unheard for people to run "npm" as root to run some scripts as root.


robabla, are you an NPM maintainer? They all seems to hold the same opinion despite the exploits being enumerated for them over and over again.


No, I am not. I'm just an interested bystander. I don't even code much JavaScript anymore.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: