SecLab
Supply Chain & IntegritywalkthroughDifficulty 3/524 min

Lockfiles, digests, and reproducible builds

Objective: After this lesson you can pin all three dependency layers of a build, and know which layer a lockfile does not cover.

A08:2025SSDF PS.3SLSA
Step 1 of 5 · read5 min

Three layers, and a lockfile covers one

The question that tests whether a build is reproducible is simple: does rebuilding the same commit six months later produce the same artefact? For almost every project the answer is no — and the three layers below are the three reasons.

LayerPinned byCovered by a lockfile?
Language packagespackages.lock.json, package-lock.jsonYes
The base imagea sha256:... digest, not a tagNo
CI toolinga commit SHA, not a tagNo

The bottom two are the layers people skip, and they get skipped for the same reason: a tag looks like a version but it is a pointer that can move.

FROM node:20 does not say "version 20", it says "whatever image is labelled 20 right now". That label is updated with each patch release, so two builds a week apart use two different images. Usually that is good (security patches arrive automatically), and that is exactly why people leave it — but it also means you do not know what you are running, and a compromised image arrives by the same route.

uses: actions/checkout@v4 is worse from a trust standpoint: v4 is a git tag, and a git tag can be moved by anybody with push access to that action's repo. An action runs inside your workflow with the workflow's token — repo read/write and your secrets.

The trade-off has to be said out loud: pinning by digest means security patches stop arriving on their own. You trade "silent, uncontrolled updates" for "controlled updates you must initiate". That trade is only worth it if you genuinely have an update mechanism — so pinning without Dependabot or Renovate makes the system worse, not better.

View path

Comments

Join the discussion
Sign up to comment

Commenting needs an account with at least one completed lesson. That condition is what keeps this thread worth reading: every point belongs to someone who can be asked back, and reputation accrues over time.

Sign upSign in

You can still read every comment below without an account. Signing in brings you back to this exact spot, not to the top of the page.

Loading comments…