Agent Wranglers

APS-69Required

Lock and audit dependencies

Commit a lock file, install from it exactly, and fail the build on known holes in any dependency.

How to do it

Commit the lock file your package manager writes, and install with the exact command, such as npm ci or pip install --require-hashes. Run an audit on every change and every week, for example npm audit, pip-audit, govulncheck or OSV-Scanner. Update or replace packages with known holes of high or critical severity before the next release.

Examples

Shell example

npm ci
npm audit --audit-level=high
pip-audit -r requirements.txt
osv-scanner scan source -r .

How to check

The build runs the locked install command, such as npm ci, never a plain install. Add an old package with a known hole on a branch. The audit fails the build.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/application-security/supply-chain/audit-dependencies">Agent Wranglers application security playbook</a>. In code you write, add a comment next to it with the same link.