Repository navigation
Pin CI actions to commit SHAs - #112
Merged
Merged
Conversation
A tag or branch can be moved to new code at any time; a commit SHA cannot. The release workflow holds contents: write and the signing and notarization secrets, so whatever code those refs point to at run time can publish a release. Each pin keeps the ref it replaced as a comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Gk1HsqV3Fp5JVGKdfq3sm
huntharo
added a commit
to pwrdrvr/PwrDisk
that referenced
this pull request
Oct 31, 2026
* Pin CI actions to commit SHAs A tag or branch can be moved to new code at any time; a commit SHA cannot. The release workflow holds contents: write and the signing and notarization secrets, so whatever code those refs point to at run time can publish a release. Each pin keeps the ref it replaced as a comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Gk1HsqV3Fp5JVGKdfq3sm (cherry picked from commit 49099bc) * chore(ci): update pinned action versions --------- Co-authored-by: Matthew Boston <matthew@matthewboston.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.
Why
Tags and branches can be moved. Anyone who controls an action's repository, including someone who has compromised it, can point
@v5or@masterat different code, and every workflow that uses that ref runs the new code on its next run. A full commit SHA can't be moved that way.This matters most for
release.yml. It runs withpermissions: contents: writeand getsMACOS_CERTIFICATE,MACOS_CERTIFICATE_PASSWORD,NOTARY_KEY_P8and the other signing secrets. If one of the three actions it uses were compromised, the injected code could steal those secrets or tamper with the published release.This has happened before. In March 2025 the
tj-actions/changed-filestags were rewritten to point at a commit that dumped CI secrets into workflow logs, across thousands of repositories (CVE-2025-30066). Workflows pinned to a SHA were not affected.References
What
Each action is pinned to the commit its current ref resolves to today, so nothing in the behavior changes. A trailing comment records the ref it replaced.
actions/checkout@v5@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0dtolnay/rust-toolchain@master@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # masterSwatinem/rust-cache@v2@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3I got the SHAs from the GitHub API.
v5andv5.1.0resolve to the same commit.v2andv2.9.3are annotated tags, and both dereference to the commit pinned here.dtolnay/rust-toolchainis pinned to the current head ofmaster. The workflows already passtoolchain: "1.97", so pinning the action doesn't change which Rust gets installed.Trade-off
Pinned actions don't update on their own. If you want, a Dependabot config with
package-ecosystem: github-actionswould open bump PRs and keep the# vX.Y.Zcomments up to date. I left it out to keep this change small.Test plan
uses:line is pinned (8 checkout, 7 rust-toolchain, 7 rust-cache)🤖 Generated with Claude Code
https://claude.ai/code/session_012Gk1HsqV3Fp5JVGKdfq3sm