Safeguard
Developer Tools•

How do you review a hotfix that only changes the lockfile?

A lockfile-only security fix looks tiny but can move many packages. Check what changed, where it came from, and that the built artifact is fixed.

Safeguard Security Team
3 min read

Review a lockfile-only hotfix by reading the diff of resolved packages, not the line count. Confirm only the intended package moved, check the new version and its source, rebuild from clean, and verify the built artifact contains the fixed version. A small diff can still carry many changes.

Why this is not as safe as it looks

A lockfile records the exact versions and integrity hashes that a build installs. Regenerating it to pick up a fix can also move other packages that were allowed to float within their ranges. The diff may look like a few lines in the file, or it may be thousands. Either way the real change is the list of resolved packages, which you must read as a list.

Steps

  1. Generate a package list before and after. Most package managers can print the resolved tree. Compare the two lists, not the raw file.
  2. Confirm the vulnerable package moved to the fixed version or higher.
  3. Look at every other package that changed. For each, ask whether it should have moved.
  4. If other packages moved, try updating only the target package and keep the rest pinned.
  5. Check that integrity hashes are present for the new entries and that the registry source is the one you expect.
  6. Do a clean install from the lockfile and run the full test suite.
  7. Build the artifact and verify the fixed version is actually inside it, using the SBOM or an image scan.
# example: compare resolved packages before and after (npm)
npm ls --all --parseable > after.txt
git stash -q && npm ci && npm ls --all --parseable > before.txt
diff before.txt after.txt

What to look for

FindingAction
Only the target package changedProceed
A sibling package moved a minor versionRead its release notes, test the area
A new package appearedReview it like a new dependency
A package changed registry or hash styleStop and investigate
A major version jumpedNot a hotfix; plan it separately

The artifact check matters most

A lockfile edit proves intent. The built artifact proves result. Some builds use a different resolution than local, or vendor a copy of a dependency, so the file can say fixed while the artifact still carries the old one. Scan what you ship.

Pin the rest during emergencies

During an emergency, avoid unrelated upgrades. If your tool offers a mode to update one package with its minimal set of dependencies, use it. Keep the broader update for a calm day.

Try it yourself

Click through it at your own pace, or open it full screen. Look at the version listed for each component, which is the list you compare before and after.

Safeguard scans lockfiles and built artifacts and can open fix PRs through autonomous remediation if you enable it (off by default). A free scan is at gold.safeguard.sh/scan.

Quick check

Is a three line lockfile diff always low risk?

No. The diff size says little. Compare the resolved package lists to see what really moved.

Does a fixed lockfile prove the build is fixed?

No. Scan the built artifact or its SBOM to confirm the fixed version is inside.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.