Pin GitHub Actions to commit SHAs - #486
Draft
joe4dev wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Motivation
Every external action in our workflows was referenced by a mutable tag (
@v7,@v1). A tag is a pointer the upstream owner can move at any time, so anyone who controls one of these 15 repositories — or anyone who compromises one — can change what runs inside our CI. That matters more here than in most repos: these workflows holdPRO_ACCESS_TOKEN,NPM_AUTH_TOKEN, and the goreleaser signing path, andci.ymlis the workflow the weekly release calls. A retagged action is enough to publish anlstkbuild we didn't write.enforce-labels.ymlandsync-labels.ymlwere already pinned (#307). This finishes the job.Solution
All 45 external
uses:refs across 6 workflows are now pinned to full 40-character commit SHAs with a trailing# vX.Y.Zcomment.No change to what CI executes. Each SHA is the commit the floating tag pointed at when this branch was cut — resolved with
gh api repos/<owner>/<repo>/commits/<tag>, not a version bump. I then listed every tag pointing at that same commit to derive an honest version comment, soactions/checkout@v7is recorded as thev7.0.1it actually resolves to. One exception worth knowing:aws-actions/setup-sampublishes only major tags, so no patch tag exists at that commit and its comment reads# v3.Dependabot's existing
github-actionsecosystem understands SHA pins and bumps the hash and the comment together, so pinning does not freeze updates.The 3 local refs (
./.github/workflows/ci.yml,./.github/actions/create-release-tag) are intentionally untouched — they are checked out with the repo and have no upstream to retag.CLAUDE.mdgains a short# GitHub Actionssection recording the convention and thegh apirecipe, so the next workflow edit doesn't reintroduce a floating tag.Verification
git diff -U0confirms onlyuses:lines changed — 45 of them, no incidental edits..github/**/*.ymlfiles still parse.mainit reports 45unpinned-usesfindings, and zero against this branch.CI passing on this PR is the real check, since this only touches CI.
Docs
Nothing to document.
No user-facing lstk behavior, flags, config, or output changes. The only prose added is agent-facing guidance in
CLAUDE.md.Review
Self-merge candidate. Mechanical, behavior-preserving by construction, and fully checkable from the diff — every line is a tag-to-SHA swap whose correctness a reviewer can confirm with
gh api repos/<owner>/<repo>/commits/<tag>.One judgment call to flag rather than bury: pinning to the current tag target rather than to the newest patch release means we adopt no upstream changes in this PR. I think that's right for a security-hygiene change — pin now, let Dependabot bump deliberately — but it does mean the version comments are a snapshot, and
sync-labels.yml's pre-existing pin is commented# mainwhilelocalstack/metamain has since moved 8 commits ahead. Left alone here; worth a follow-up.Closes DEVX-978
Co-Authored-By: Claude noreply@anthropic.com