Repository navigation
ci: pin every third-party action to a commit sha (#503) - #510
Merged
Merged
Conversation
A tag is mutable. Whoever controls an action's repository can repoint `v7` at different code, and that code runs with this repository's GITHUB_TOKEN — on the release path with contents: write, packages: write and id-token: write, which is enough to publish a release, push an image to ghcr, and mint a Sigstore certificate carrying this repository's identity. Pinning turns "trust this maintainer permanently and prospectively" into "trust this exact tree, which was reviewed once". 66 references across five workflow files, each at the sha its current tag resolves to today, with the release the sha belongs to as a trailing comment. This is a pin and not a bump: no major version moves, so a behaviour regression cannot be confused with a pinning mistake. Each sha came from `git/ref/tags/<tag>`, dereferenced through the annotated-tag object where there was one, and the comment names the most specific semver tag pointing at that same commit rather than the floating major that was written before — so `actions/setup-go@v7` reads `# v7.0.0`, which is what it actually was. The lasting part is the test. Pinning 66 references is a one-time edit; the failure mode is the next action someone adds, which will arrive as `@v1` because that is what every README shows, and nothing about a floating tag looks wrong in a diff. The test walks .github/workflows rather than enumerating it, since a new workflow file is precisely the thing most likely to carry an unpinned action, and it carries a floor so that a walk which stops finding files fails instead of passing vacuously. It also requires the version comment: a sha alone tells a reviewer nothing, so without it nobody can tell an upgrade from a downgrade, and Dependabot uses the comment to name the version it is moving from. Local reusable-workflow calls are skipped. `./.github/workflows/ci.yml` is this repository's own code at this repository's own commit; there is no third party and nothing to pin. Ongoing cost is nothing: .github/dependabot.yml already has a github-actions ecosystem on a weekly schedule, grouped for minor and patch, and Dependabot updates sha pins in place while keeping the comment in sync.
scttfrdmn
force-pushed
the
chore/pin-actions-to-shas
branch
from
September 17, 2026 04:48
8fecf28 to
8d09dbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #503.
A tag is mutable. Whoever controls an action's repository can repoint
v7atdifferent code, and that code runs with this repository's
GITHUB_TOKEN— on therelease path with
contents: write,packages: writeandid-token: write,which is enough to publish a release, push an image to ghcr, and mint a Sigstore
certificate carrying this repository's identity. Pinning turns "trust this
maintainer permanently and prospectively" into "trust this exact tree, which was
reviewed once".
66 references across five workflow files, each at the sha its current tag
resolves to today. This is a pin and not a bump — no major version moves, so a
behaviour regression cannot be confused with a pinning mistake, which is the
constraint the issue asks for.
Each sha came from
git/ref/tags/<tag>, dereferenced through the annotated-tagobject where there was one. The trailing comment names the most specific semver
tag pointing at that same commit rather than the floating major that was written
before, so
actions/setup-go@v7reads# v7.0.0— what it actually was, whichis the thing a reviewer of the next Dependabot bump needs to see.
The diff is 66 insertions and 66 deletions, one per reference, and the existing
workflow-parsing tests in
internal/config/still pass, so the YAML is intact.The lasting part is the test
Pinning 66 references is a one-time edit. The failure mode is the next action
someone adds, which will arrive as
@v1because that is what every README shows,and nothing about a floating tag looks wrong in a diff.
TestEveryActionIsPinnedToAShawalks.github/workflowsrather than enumeratingit — a new workflow file is precisely the thing most likely to carry an unpinned
action, so a hard-coded file list would check only what was known when the list
was written. It carries a floor (4 files, 5 exist) and a non-zero reference
count, so a walk that stops finding files, or a
uses:pattern that stopsmatching, fails instead of passing vacuously.
It also requires the version comment, and requires a full 40 characters rather
than
[0-9a-f]+: GitHub resolves an abbreviated ref, so a 7-character "pin" isonly as immutable as the objects that happen to share its prefix today.
Local reusable-workflow calls are skipped —
./.github/workflows/ci.ymlis thisrepository's own code at this repository's own commit, so there is no third party
and nothing to pin.
Ongoing cost
None.
.github/dependabot.ymlalready has agithub-actionsecosystem on aweekly schedule, grouped for minor and patch (verified, lines 77–99), and
Dependabot updates sha pins in place while keeping the comment in sync.
Note on the issue's
cosign-installerfindingStill true and now moot here:
sigstore/cosign-installerstops publishingfloating majors at
v3, sogit/ref/tags/v4is a 404. It was already referencedas
@v4.1.2rather than@v4, and it is now pinned like everything else — oneaction for which pinning removes a resolution problem rather than only a trust
one.