| ▲ | Show HN: Safe-NPM – only install packages that are +90 days old(github.com) | ||||||||||||||||||||||
| 32 points by kevinslin 3 days ago | 25 comments | |||||||||||||||||||||||
This past quarter has been awash with sophisticated npm supply chain attacks like [Shai-Hulud](https://www.cisa.gov/news-events/alerts/2025/09/23/widesprea...() and the [Chalk/debug Compromise](https://www.wiz.io/blog/widespread-npm-supply-chain-attack-b...). This CLI helps protect users from recently compromised packages by only downloading packages that have been public for a while (default is 90 days or older). Install: npm install -g @dendronhq/safe-npm Usage: safe-npm install react@^18 lodash How it works: - Queries npm registry for all versions matching your semver range - Filters out anything published in the last 90 days - Installs the newest "aged" version Limitations: - Won't protect against packages malicious from day one - Doesn't control transitive dependencies (yet - looking into overrides) - Delays access to legitimate new features This is meant as a 80/20 measure against recently compromised NPM packages and is not a silver bullet. Please give it a try and let me know if you have feedback. | |||||||||||||||||||||||
| ▲ | sebmellen an hour ago | parent | next [-] | ||||||||||||||||||||||
"Here, install my new 1-day old NPM package that doesn't let you install packages younger than 90 days." Pardon me, I couldn’t help myself :D | |||||||||||||||||||||||
| ▲ | tkzed49 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Not controlling transitive deps makes this vastly less useful because direct deps can specify version ranges (e.g. latest minor version). Personally I'd stick with pnpm's feature. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | moritzwarhier 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
As someotherguyy already mentioned, this is a default feature in pnpm. And as far as cat-and-mouse-games go in other package managers, I'd say that pinning dependencies and disabling postinstall scripts is a much better option. Sure, not a foolproof one either, but as good as it gets. edit: misspelled someotherguyy's user name | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | zelphirkalt 20 minutes ago | parent | prev | next [-] | ||||||||||||||||||||||
This works only if there are some other people, who will use a dependency "too early" to fall victim to some exploit and then notice it, within those 90 days. Imagine, if everyone only used packages older than 90 days. Then we would have no frontrunner to run into the issues before us. A cooldown time alone is not actually a sufficient solution. What people really need to stop doing, is not properly pinning their versions and checksums, and installing whatever newer version is available. That would cause a problem even, if the date line is moved 90 days into the future for all packages. If however, one only updates versions of dependencies when one consciously makes that choice, there are far fewer points in time, when versions change, and therefore the chance of catching something is also much lower. Combine that with a cooldown time/minimum age for versions, and you got an approach. | |||||||||||||||||||||||
| ▲ | mrconter11 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
But safe-npm is not 90 days old yet.. :/ | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | someothherguyy 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
| ▲ | arrty88 39 minutes ago | parent | prev | next [-] | ||||||||||||||||||||||
With the help of AI, i see no reason to install most deps nowadays besides types and react and mui framework. Everything can be built from scratch quickly. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | ttoinou an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
If everybody does that, won't we take 90 days more to detect problems / hacks of npm packages ? | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | pr0xyb0i 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
How does it differ from: https://docs.npmjs.com/cli/v11/commands/npm-install#before | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | codezero an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
Does anyone have any statistics on how long a compromised package has been in the wild on average? | |||||||||||||||||||||||
| ▲ | asdkkthrowaway 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Doesn't this just mean you're 90 days late on any patches? | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | robkop 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
You could dual brand as vibe-npm, only install packages that are in your models training dataset | |||||||||||||||||||||||
| ▲ | cheesekunator 2 hours ago | parent | prev [-] | ||||||||||||||||||||||
Why does elapsed time mean a library is safe? This is so ridiculous. It doesn't protect you against anything. I'm sure there are 1000s of old libraries out there with hidden vulnerabilities or malicious code. | |||||||||||||||||||||||
| |||||||||||||||||||||||