ci: pin GitHub Actions to commit hashes instead of mutable tags#479
Conversation
|
Code coverage summary for d09f327: ✅ Region coverage 69% passes |
kp-thomas-yau
left a comment
There was a problem hiding this comment.
Is any of the github action here is using immutable release? If it's using immutable release, I think it's ok to use the version number/tag for those
|
Pinning the hash of a CI action is a recognized practice for preventing supply chain attacks, and I agree with it in principle. Version tags are also acceptable to me. That said, the real security benefit comes from actually reading and auditing the scripts inside the actions after pinning — simply pinning the hash moves us toward the goal but does not provide any concrete security benefit on its own until that review is done. |
I know, but GitHub released something called immutable release that causes Git tags cannot be moved, effectively pinning the Git tag to the same hash. So if the GitHub Action workflow is using this immutable release, we can just use the tag. (and we can of course use commit hash for workflows that isn't using this feature) |
06ea436 to
2d6ce55
Compare
|
Yeh, now all the actions pin with immutable version tags or immutable hashes. |
2d6ce55 to
ed36162
Compare
Description
Replace all GitHub Actions version tag references (e.g.
@v4,@stable) with exact commit SHAs or immutable version tags across all workflow files. Original version tags are retained as inline comments for readability and maintainability.Affected workflows:
.github/workflows/ci.yaml.github/workflows/nightly-cargo-deny.yaml.github/workflows/nightly-rust-update-check.yaml.github/workflows/nix-build.yaml.github/workflows/weekly-cargo-update.yamlMotivation and Context
Mutable tags (e.g.
actions/checkout@v4) can be silently redirected to a different commit by a compromised or malicious maintainer, introducing supply chain attack vectors into CI. Pinning to immutable commit SHAs ensures the exact code that was reviewed is always what runs, regardless of upstream tag changes. Ref: #472 (comment)How Has This Been Tested?
The workflow files were updated and verified to reference valid commit SHAs for each action. No logic changes were made — only the action reference format changed — so existing CI behavior is preserved.
Types of changes
Checklist
main