
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
build-scripts-allowlist
Advanced tools
A maintained, up-to-date list of common NPM packages that need to run build scripts during installation.
An up-to-date list of common NPM packages that need to run lifecycle scripts during installation.
This package only supports PNPM 10. We are working on supporting other package managers through @lavamoat/allow-scripts
.
In your project using PNPM 10, add the following field to your package.json
:
"pnpm": {
"configDependencies": {
"build-scripts-allowlist": "0.20250116.0+sha512-jog/QKpjOZlMn5wpzrCLjOVkD65jigLQEX86yJdBKxUOPnFjAYlETBhILhVD6UpYFt1WVbHEy8uDYnoE5hWldg=="
},
"onlyBuiltDependenciesFile": "node_modules/.pnpm-config/build-scripts-allowlist/common.json"
}
This package uses a date-based version number to indicate the last time the list was updated so you can easily see if the list is outdated.
[!IMPORTANT] If you are reading the documentation on NPM, please go to the GitHub repository to see the up-to-date version number & hash used in the
configDependencies
field.
Build scripts are scripts that run during the installation of a package. They are defined in the package.json
file of the package. The most common build scripts are preinstall
, install
, and postinstall
1, which will be executed in that order. These scripts are used to set up the package, compile native code, download binary files, etc.
In practice, the scripts can do anything, including downloading and executing arbitrary code from the internet. This makes them a security risk.
PNPM 10 and Bun block build scripts by default, and both have mechanisms to allowlist packages that need to run build scripts.
Blocking build scripts by default is a good security measure, but it can break packages that rely on build scripts for their essential functionality. For example, packages that download binary files or compile native code will not work if their build scripts are blocked.
By allowlisting the packages that with build scripts essential for their functionality and are known to do no harm, we can block build scripts for all other packages while still allowing these packages to work.
Of course this is not a perfect solution. The allowlist can be incomplete, and currently benign packages can be compromised in the future. Also, the allowlist can be used to smuggle malicious code into the project by adding a malicious package to the allowlist. So it is important to keep the allowlist up-to-date and to only add packages that are widely used and have a good reputation.
No.
default-trusted-dependencies.txt
.The list is maintained manually. If you find a package that should be included, please open an issue or a pull request.
peerDependencies
. For monorepos, use PNPM catalog
, Yarn Constraints. Also, run time checks are still needed even with postinstall checks, so postinstall checks should be safe to remove.prepare
script in their package.json
to install the tooling.funding
field in package.json
to let npm
print a "x packages are looking for funding." message. Anyway, this is not a critical feature and should not be a blocker for installing the package.trustedDependencies
and its default-trusted-dependencies.txt
can-i-ignore-scripts
@lavamoat/allow-scripts
Note that this list does not screen packages with only prepare
scripts, because prepare
scripts are run only when the package is installed as a dependency from a git repository, not from the npm registry. ↩
FAQs
A maintained, up-to-date list of common NPM packages that need to run build scripts during installation.
We found that build-scripts-allowlist demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.