lockfile-lint is a CLI tool for linting npm and Yarn lockfiles against security policies. Current stable version is 5.0.0 (requires Node >=16), with frequent patch releases. It validates package origins, HTTPS usage, allowed hosts/schemes, and integrates into CI pipelines. Unlike generic linters, it focuses on supply-chain security by enforcing policies on lockfile entries. Maintained by Liran Tal and part of the lockfile-lint project.
npm install lockfile-lintVerified import paths — ran on the pinned version, not inferred.
Shows programmatic usage with validation of HTTPS and allowed hosts for npm lockfile.
Convert require() to import or use dynamic import().
Use either --allowed-schemes with specific schemes or --validate-https alone.
Ensure policy clarity: if a URL matches --allowed-urls, it bypasses host validation.
Upgrade Node to >=16.
Always specify --type (yarn or npm) explicitly.
Upgrade to v4.12.1 or later.
Use import lockfileLint from 'lockfile-lint' or dynamic import().
Choose one: either --allowed-schemes or --validate-https.
Use --type npm or --type yarn (or omit for auto-detection).