Lockfile bypass: builds that ignore the versions you reviewed
Lockfiles pin exact dependency versions, but builds that run install instead of a frozen install, or ignore the lockfile, pull whatever is newest. How to enforce frozen installs across npm, pnpm, Yarn, pip, and Go.
Diagram
Same commit, different dependencies
Step 1 of 4
Locked
package-lock.json pins left-pad 1.3.0.
# Locked # package-lock.json pins left-pad 1.3.0.
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Install versus ci
- What fails
- npm install can rewrite the lockfile; npm ci never does.
- Who is affected
- Every build artifact.
- What you would notice
- CI scripts using npm install.
- What you change
- Use npm ci or the frozen equivalent.
Unhashed requirements
- What fails
- pip requirements without hashes accept any file for a version.
- Who is affected
- Python builds.
- What you would notice
- requirements.txt with == but no --hash.
- What you change
- Generate hashes with pip-compile --generate-hashes or use uv.
Lockfile not committed
- What fails
- Missing lockfiles mean every build resolves fresh.
- Who is affected
- Reproducibility.
- What you would notice
- .gitignore entries for lockfiles.
- What you change
- Commit lockfiles and review their diffs.
A CI guard
Fail the build if install modified the lockfile.
- run: npm ci - run: git diff --exit-code -- package-lock.json
Check yourself
Recognition and the fix. Nothing here is a procedure.
Which npm command fails instead of changing the lockfile?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.
This page stands on its own. The lab and the glossary card are the next reading.