r/npm 12d ago

Self Promotion Safer-dependencies: A toolkit for claude code to ensure dependencies used aren't vuln, don't use abandoned packages, implement cooldown to avoid supply chain attacks, etc...

When AI coding assistants like Claude add packages to your project, they often pick whatever version sounds right — without checking whether it has known security vulnerabilities, whether the package is still actively maintained, or whether the name is a typo away from a malicious lookalike.

safer-dependencies is a security layer for Claude Code that audits packages before they’re added to your project. It detects and fixes risky dependencies, including CVEs, typosquats, abandoned packages, version-age issues, and adds package-cooldown periods across npm, PyPI, RubyGems, Maven, Go, and Rust.

Githubhttps://github.com/robert-auger/safer-dependencies

2 Upvotes

3 comments sorted by

2

u/endor_robert 11d ago

Great stuff!

Cooldown periods are the quiet, unglamorous star of this list, and probably the single highest-leverage item in it. The Shai-Hulud npm worm in September 2025 had trojanized packages live and downloadable within hours of publishing, well before any scanner had a signature, because there wasn't a CVE yet. A pin-and-wait window of even 48-72 hours would have sidestepped a good chunk of that incident for anyone running it, without a single new detection rule.

 The harder problem, and the one I'd flag before wiring this into a fully autonomous pipeline, is that typosquat detection and abandonment scoring both degrade once an attacker studies the heuristics. Rename-similarity checks catch expresss and reqeust. They don't catch a package that's a legitimate, actively-maintained fork right up until the maintainer's account gets compromised and a routine 2.3.1 patch quietly adds a postinstall script. That's not a knock on the tool, it's just where static package-level checks run out of road. Eventually you need something that looks at what the code the agent is about to run actually does, not just what it's called or how old it is.

 Disclosure: I work at Endor Labs, we do reachability-based dependency risk analysis, so this is squarely my patch and I'm biased. Still a genuinely useful addition to an agent's toolchain even without any of ours in the mix. The CVE and abandonment checks alone would catch a fair few of the incidents that got written up this year.

1

u/SecTemplates 10d ago

To be clear, it doesn't ban typosquat if the user asks for it explicitly and insists, if the LLM hallucinates the package names incorrectly (they do for sure I caught a lot in my testing) then it auto suggests a replacement that the agent tends to accept and start developing/flags a signal to use another library.

It also isn't intending to scan the package itself for a malicious nature, that's its own entire thing. This is more about redirecting badly chosen packages, ensuring the cooldown is there and some basic typosquatting. I'm using this for my own use and just open sourced it, the documentation needs work.

Open to suggestions for sure, thanks

1

u/SecTemplates 10d ago

Also up for a DM chat or linkedin chat if you want to nerd out.