fleetlint Policy for a fleet of repositories
v0.4
Getting started

deps/install-scripts-disabled

Package install scripts are disabled

Severityinfo
Tiers1, 2
Stacksnode
Scopeeach
Kindexpr
Sourcelibrary v0.1.0
Selected byfleetlint-recommended@v0.1.0

Requirement

Install scripts of dependencies do not run by default, set in the project or in a parent directory (for a workspace member, typically the workspace root): ignore-scripts=true in .npmrc, enableScripts: false in .yarnrc.yml, an explicit allowlist (onlyBuiltDependencies for pnpm, trustedDependencies for bun), or a package manager that blocks them by default (pnpm 10 or later named in packageManager, bun).

Why

Install scripts are the usual way a compromised package executes code on developer machines and in CI.

Check

["", "../", "../../", "../../../"].exists(d,
  (file(d + ".npmrc") && scan(d + ".npmrc", r'^\s*ignore-scripts\s*=\s*true').size() > 0)
  || (file(d + ".yarnrc.yml") && scan(d + ".yarnrc.yml", r'^\s*enableScripts:\s*false').size() > 0)
  || (file(d + "pnpm-workspace.yaml") && text(d + "pnpm-workspace.yaml").matches(r'onlyBuiltDependencies|allowBuilds'))
  || (file(d + "package.json") && text(d + "package.json").matches(r'onlyBuiltDependencies|trustedDependencies|"packageManager"\s*:\s*"(pnpm@([1-9]\d+)\.|bun@)'))
  || file(d + "bun.lock") || file(d + "bun.lockb"))

Fix

Add ignore-scripts=true to .npmrc and allow the few packages that need a build step explicitly.

Agent instruction: Add ignore-scripts=true to .npmrc (or the package manager’s equivalent), run a clean install and the tests, and list the packages that need their build script allowed.

See: https://fleetlint.org/baseline/#dependencies, https://fleetlint.org/stacks/#nodejs--typescript


Generated by fleetlint docs from catalog v0.1.0.