Third-party package dependencies · Install-time execution

Block install-time scripts except for an allowlist

When it fails: Any dependency can run code when it is installed. Install hooks run with the user's or the pipeline's privileges, before any test or review, and are the most common way malicious packages steal credentials.

CB-DEP-EXEC-001highdraftpartialprofile baseline

Status draft: not part of any release yet, may still change.

Description

Package lifecycle scripts that run at install time (pre-install, post-install, build hooks) are disabled by default. Only packages on an explicit, reviewed allowlist may run them.

Rationale

Most malicious packages do their work in an install hook: they steal tokens and keys from the environment the moment the package is installed, without ever being imported by the application.

Impact

Packages that compile native code or download binaries at install time break until they are added to the allowlist or replaced.

Audit

  1. Check that install-time scripts are disabled in committed package manager configuration.
  2. Review the allowlist: each entry must have a reason.
  3. Check that pipelines do not re-enable scripts with a flag.

Automated: every check must pass. Scanners report each check by its id.

postmortem

script policy of npm, pnpm, yarn, bun and composer plugins

command: postmortem harden --json
control: CB-DEP-EXEC-001
coverage: auto

Remediation

  1. Disable install-time scripts in committed configuration.
  2. Run an install, list the packages whose scripts were skipped, and allowlist only those needed.

References

Mappings

FrameworkIDRelationNote
NIST SP 800-53 Rev. 55.1.1CM-7related
NIST SP 800-53 Rev. 55.1.1SR-11related

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

  • related CB-DEP-EXEC-002 Prefer prebuilt packages over packages built from source at install
  • related CB-DEP-CI-001 Install dependencies in a step without secrets

People and lifecycle

AuthorsAlice
Introduced inv1.0.0
Created, updated2026-10-16, 2026-10-16