NPM Build Script Allowlist

0.20250131.0 · active · verified Tue Apr 21

This package provides a curated, manually maintained list of common npm packages that legitimately require build scripts (e.g., `preinstall`, `install`, `postinstall`) to function correctly during installation. Its primary purpose is to enhance supply chain security by enabling package managers like pnpm v10 and Bun (which block build scripts by default) to differentiate between necessary and potentially malicious build script executions. The package uses a date-based versioning scheme (e.g., `0.YYYYMMDD.0`) to indicate the last update date, facilitating easy identification of outdated lists. Currently, it is primarily integrated with pnpm v10 via the `onlyBuiltDependenciesFile` and `configDependencies` fields in `package.json`. While efforts are underway to support other package managers through `@lavamoat/allow-scripts`, its current utility is specific to pnpm's security model. The list is not exhaustive, focusing on widely used packages whose build scripts are deemed essential, and requires manual maintenance and updates by users to stay current and effective. It provides a community-driven approach to maintaining a secure dependency graph where build scripts are an unavoidable necessity.

Common errors

Warnings

Install

Imports

Quickstart

This `package.json` snippet demonstrates how to configure pnpm v10 to utilize `build-scripts-allowlist` for securely managing allowed build scripts. It specifies the exact version and integrity hash for security and points to the `common.json` file.

{
  "name": "my-project",
  "version": "1.0.0",
  "pnpm": {
    "configDependencies": {
      "build-scripts-allowlist": "0.20250131.0+sha512-jog/QKpjOZlMn5wpzrCLjOVkD65jigLQEX86yJdBKxUOPnFjAYlETBhILVVD6UpYFt1WVbHEy8uDYnoE5hWldg==" 
    },
    "onlyBuiltDependenciesFile": "node_modules/.pnpm-config/build-scripts-allowlist/common.json"
  },
  "dependencies": {
    "build-scripts-allowlist": "^0.20250131.0" 
  }
}
// NOTE: The version and SHA512 hash for 'build-scripts-allowlist' in 'configDependencies' MUST be updated 
// regularly from the latest official GitHub README to ensure security and currency.
// The 'dependencies' entry simply installs the package so its data file is available.

view raw JSON →