You can mitigate similar attacks by editing your .npmrc
min-release-age=7 # days
ignore-scripts=true
You can mitigate similar attacks by editing your .npmrc
min-release-age=7 # days
ignore-scripts=true
I always advocate switching to pnpm where install scripts are disabled by default. It has plenty of security features to ward off most supply chain attacks.
Does disabling install scripts actually do anything though? The attack would still work if put in the code itself, no? The only difference I can see is that it would run when the project is run instead of when the package is installed.
Minimum age would have prevented it in this case.
On closer inspection, preventing post-install would have fixed it too: "The attack exploited a transitive dependency, plain-crypto-js@4.2.1, which executed a postinstall script to deploy the RAT."
I was trying to figure out why people still use Axios, when the built-in fetch works just fine. Is it because people are still sending XML requests?
It provides a lot of nice syntactic sugar that you would otherwise have to write a wrapper for on top of Fetch. Built in request interception, request transformation, (de)serialization, shared request config, timeout/retries management, ...
Though this definitely comes with bloat and supply chain risks.
I was reading through the thread, and it looks like the package mangers have implemented an option that says "only install package versions that are X minutes/days old". The idea is NPM has had time to act before your package manager installs that new version.
all 12 comments