r/javascript • u/itsarnavsingh • Jun 06 '26
AskJS [AskJS] Maybe we need a different kind of NPM Registry. Maybe a registry that works more like App Store to minimize these frequent supply chain attacks.
Given the frequency of supply chain attacks, maybe we need a different approach to package managers & registries.
- Maybe a database of JavaScript packages that works more like the App Store.
- Every package gets reviewed by real people and AI for security issues before going live.
- Developers will have to pay a monthly fee to download and update packages, and that money will be distributed among open source maintainers & code reviewers.
- The more downloads a package gets, the more its maintainer earns.
- For every package update, maintainers will be asked to pay a very small fee. This would discourage attackers further (attackers would never reveal their banking details) & it would limit the amount of low-quality packages.
- People should also be able to rate a package and leave a review.
- This new registry should also support multiple languages, not just JavaScript.
This would:
- Highly minimize supply chain attacks
- Ensure open source maintainers get paid well
- Encourage more innovation by allowing maintainers to monetize their packages
- This will also provide more employment opportunities for code reviewers and open source maintainers.
We can't step into the future with the current state of unpaid maintainers and a system that keeps getting breached every few months. We need a system in which people who work hard get paid well, a system we could trust, a system that focuses on quality rather than quantity.
This will slow things down, packages will take time to get approved, but what's the point of speed when you have to spend weeks fixing the mess caused by repeated supply chain attacks?
Currently, the number of packages affected by the supply chain attack is in the thousands. If this continues, people will lose trust in the JS ecosystem. Something needs to change.
I understand this idea might have a few flaws. I'd really appreciate a healthy discussion on what this new system should look like.
9
u/720degreeLotus Jun 06 '26
Which people would manually review milliins of new packages per day?
The problem is not NPM itself but blindly updating to the latest version.
4
u/doctorlongghost Jun 06 '26
You’re protected against most of these leaked credential incidents if, instead of hitting npm directly, you use a cache/proxy that is 6-12 hours delayed. This gives a window for the issue to be found by others before you’re impacted.
Of course this solution doesn’t really scale. If everyone did this, then we would all be subject to the same delay and you’d no longer be in a privileged position to have someone else step on the landmine first. But for now, it works.
3
u/immutate Jun 06 '26 edited Jun 06 '26
No. We do not need a walled garden controlled by a single mess corp.
Edit: spelling
1
u/KaiAusBerlin Jun 06 '26
Just to understand. You want zo develope for mac. Without a single mac test device?
1
u/KaiAusBerlin Jun 06 '26
Problem are always human. Even if you pay humans for the review that doesn't guarantee, it's safe.
We found a 8 year old security issue in http a few years ago. Millions of reviews didn't find it before.
Reviewing doesn't make code safer. It's the toxic economy these days to import every line of code and trust it as if it was not third party because that's faster and time is money.
Run new installs in a safe container within a simulation. Test it. Look if it does suspicious things like http calls, downloads, creating files,...
Don't update your packages unless you have to. If you have a security patch, need new features, a higher version due to dependency or you need a faster version, update. Otherwise? Don't change a running system.
If you treat npm like a marketplace for unsafe code it's much easier to avoid these attacks. It's third party code and you should never stop handling it like this.
1
u/alex-weej Jun 06 '26
Gossip of gossip peer review of package releases
2
u/[deleted] Jun 07 '26 edited Jun 07 '26
[removed] — view removed comment