News for hackers. Stuff that matters.
Re:NPM packages from Red Hat have been compromised by an0malous on Monday June 01, 2026 @10:45AM (#48357532)
What other package managers do this? I don’t think Ruby does
Re:NPM packages from Red Hat have been compromised by matheusmoreira on Monday June 01, 2026 @10:49AM (#48357566)
Re:NPM packages from Red Hat have been compromised by dns_snek on Monday June 01, 2026 @11:09AM (#48357883)
Most of them? Ruby gems have hooks, Python has setup.py, deb, rpm have them too (relevant if you're installing from 3rd party sources). Elixir/Mix doesn't technically execute code on install, but your language server builds the dependencies as soon as you open the project, which can execute arbitrary code.

Either way it misses the point, nobody just fetches code and removing post-install scripts wouldn't change much because you're going to run `npm run something` 5 seconds after you run `npm install`.

Re:NPM packages from Red Hat have been compromised by IshKebab on Monday June 01, 2026 @11:00AM (#48357708)
Python does too I believe.

Really the reason not to allow that is for robustness, not security. You ideally don't want package installs doing random stuff to your system because package authors are generally bad at doing that sort of thing cleanly.

The security impact is relatively minimal because as other people have said, you just installed a package. What's the very next thing you're going to do? Compile/run it obviously.

Re:NPM packages from Red Hat have been compromised by oblio on Monday June 01, 2026 @11:14AM (#48357947)
A lot of packages are pulled in to call minimal bits of the actual library. I obviously don't have any statistics on this but my instinct would say that for the average application only 5% of an average package is actually used.

So not running package installation scripts is a huge, massive problem.

Re:NPM packages from Red Hat have been compromised by IshKebab on Monday June 01, 2026 @12:27PM (#48359028)
So what? Packages can just put their backdoors in some initialisation code that is always used.

It is possible that not running package installation scripts could improve security, but for that you need really good sandboxing/compartmentalisation of library code, e.g. with CHERI, WASI component model, or if all of your code must run in a secure context it probably helps.

But those situations are unfortunately rare in my experience.

Re:NPM packages from Red Hat have been compromised by dns_snek on Monday June 01, 2026 @02:44PM (#48360935)
It doesn't matter how much of the package you use. Here, you can use literally 0% of Koa and get pwned by one of its transitive dependencies (koa > cookies > keygrip > tsscmp) by simply importing the parent package:

    mkdir demo && cd demo
    npm install --save [email protected]
    echo 'console.log("--- pwned by a transitive dependency ---")' >> node_modules/tsscmp/lib/index.js
    node -e "import 'koa'"

--- pwned by a transitive dependency ---
Re:NPM packages from Red Hat have been compromised by oblio on Tuesday June 02, 2026 @04:19AM (#48367427)
My point was for proper package management tools that don't allow running scripts.
Re:NPM packages from Red Hat have been compromised by IshKebab on Tuesday June 02, 2026 @05:40AM (#48367956)
His example did not involve running any post-install scripts.