Show HN: Safe-install – safer NPM installs with trusted build dependencies

Hacker News Top Tools

Summary

A new npm package called safe-install is introduced to enhance supply chain security by allowing developers to disable install scripts by default and block exotic sub-dependencies, addressing ongoing vulnerabilities.

In light of the ongoing npm supply chain compromises, I built safe-install:<p><a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@gkiely&#x2F;safe-install" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@gkiely&#x2F;safe-install</a><p>It brings a couple of protections I wanted from npm but are not built in.<p>Similar to Bun’s trusted dependencies, it lets you disable install scripts by default and define a list of dependencies that are allowed to run build&#x2F;install scripts:<p><a href="https:&#x2F;&#x2F;bun.com&#x2F;docs&#x2F;guides&#x2F;install&#x2F;trusted" rel="nofollow">https:&#x2F;&#x2F;bun.com&#x2F;docs&#x2F;guides&#x2F;install&#x2F;trusted</a><p>It also supports blocking exotic sub-dependencies, similar to pnpm’s `blockExoticSubdeps` setting:<p><a href="https:&#x2F;&#x2F;gajus.com&#x2F;blog&#x2F;3-pnpm-settings-to-protect-yourself-from-supply-chain-attacks#2-set-blockexoticsubdeps" rel="nofollow">https:&#x2F;&#x2F;gajus.com&#x2F;blog&#x2F;3-pnpm-settings-to-protect-yourself-f...</a><p>I was hoping npm would eventually add something like this, but it does not seem to be happening soon, so I made a small package for it.
Original Article

Similar Articles

Upcoming breaking changes for NPM v12

Hacker News Top

npm v12 introduces security-related breaking changes to npm install that disable automatic execution of scripts, git dependencies, and remote URL dependencies by default. Users can prepare by upgrading to npm 11.16.0+ and reviewing warnings to explicitly opt into trusted behaviors.

Staged publishing and new install-time controls for npm

Hacker News Top

npm introduces staged publishing, requiring human approval via 2FA for package releases, and new `--allow-*` flags (file, remote, directory) to control install sources, improving supply-chain security in npm CLI 11.15.0.

Features everyone should steal from npmx

Lobsters Hottest

npmx is an MIT-licensed alternative web frontend for the npm registry that adds security and usability features—like transitive install sizes, install-script disclosure, and outdated/vulnerable-dependency trees—spurring npmjs.com to finally ship dark mode.