Safeguard
Developer Tools•

Why did pnpm block a dependency's build script, and how do I approve it?

pnpm holds dependency build scripts until you approve them. Learn allowBuilds, strictDepBuilds, the v11 change to onlyBuiltDependencies, and what to skip.

Safeguard Security Team
3 min read

Current pnpm treats dependency build scripts as unreviewed and blocks them until you approve each package. The allowBuilds setting lists which packages may run scripts. With strictDepBuilds on, an install that finds unreviewed scripts exits with an error. Approve only packages you have checked, and avoid the allow-all switch.

What the docs say

The pnpm build settings page states that dependency build scripts do not run unless approved. Packages not listed in allowBuilds are disallowed by default and treated as unreviewed. The page does not name the release where blocking became default, so check your own version.

Version notes from the page: strictDepBuilds was added in v10.3.0, allowBuilds in v10.26.0, and in v11 the older settings onlyBuiltDependencies, onlyBuiltDependenciesFile, neverBuiltDependencies, ignoredBuiltDependencies and ignoreDepScripts were removed. Their entries map to true or false in allowBuilds. A codemod, run through pnpx as pnpm-v10-to-v11, migrates them.

How the settings work

allowBuilds is a map of package matchers to true (allow) or false (deny). During install, unreviewed packages are added to pnpm-workspace.yaml with placeholder values for you to set. A package name alone does not approve a git or tarball dependency. You approve it by exact resolved path or repository URL.

strictDepBuilds defaults to true, so install exits non-zero when dependencies have unreviewed scripts. Setting it to false prints a warning instead. ignoreScripts defaults to false, and setting it to true stops all scripts, though it does not stop the pnpmfile from running.

The setting to avoid

dangerouslyAllowAllBuilds runs every dependency build script without approval, including future ones. The pnpm page warns that this trusts the entire dependency graph, now and later, and recommends explicit review.

An approval routine

  1. Run install and read the list of blocked packages.
  2. For each, ask whether it genuinely needs a build step, such as compiling a native addon or downloading a binary.
  3. Check the package publisher and recent versions.
  4. Set it to true in allowBuilds, and commit the change so reviewers see it.
  5. Set denied packages to false so the decision is recorded.
  6. Treat a new entry in that map like a new dependency in code review.
SettingEffect
allowBuilds truePackage may run its build script
allowBuilds falsePackage is denied
strictDepBuilds trueInstall fails on unreviewed scripts
dangerouslyAllowAllBuilds trueAll scripts run, including future ones

Try it yourself

Click through it at your own pace, or open it full screen.

See how a pull request is held until a policy passes. An allowBuilds change deserves the same review step.

Quick check

What replaced onlyBuiltDependencies?

The allowBuilds map. In pnpm v11 the older settings were removed and their entries map to true or false in allowBuilds.

Is dangerouslyAllowAllBuilds a good shortcut?

No. It trusts the whole dependency graph, now and in the future. The docs recommend explicit review.

Safeguard policies and gates can review dependency changes in pull requests, and the free scan at gold.safeguard.sh/scan inventories your packages.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.