Pin GitHub Actions to commit SHAs#593
Conversation
|
Thanks! |
|
For the record, I have also been investigating removing the |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
There was a problem hiding this comment.
Any reason for not adding the version as a comment like in test.yml?
There was a problem hiding this comment.
'release.yml' is autogenerated, but the comments are included in 'dist-workspace.yml'
There was a problem hiding this comment.
Aaaah right, that makes sense! Not sure if possible/desierable but we could potentially request whatever library generates release.yml to keep version comments if they exist in dist-workspace.yml.
There was a problem hiding this comment.
Yeah, I was thinking about leaving a feature request for cargo-dist. Will do shortly :)
Summary
Follow-up from #578; pins GitHub Actions to full commit SHAs with version comments.
Unpinned refs are vulnerable to being moved or force-pushed to commits with malicious changes if the target action repo is compromised. For example, the tj-actions/changed-files supply chain attack (GHSA-mrrh-fwg8-r2c3) involved an attacker moving version tags to point at a malicious commit, leaking CI secrets from thousands of repos. Repos that had pinned to a commit SHA were unaffected.
Changes
unpinned-usesrule suppression in.github/zizmor.ymltest.ymlandzizmor.ymlto commit SHAs with full semver commentsdist-workspace.tomlwith SHA-pinned action refs (with semver comments) and regeneratedrelease.ymlviadist generaterelease.ymlitself lacks semver comments since cargo-dist doesn't propagate them, butdist-workspace.tomlhas them human reference)taiki-e/install-action@nextesttotaiki-e/install-action@<sha> # v2.68.22with explicittool: cargo-nextest@nextestconvenience tag is a non-semver ref that can't be SHA-pinned in a Dependabot-compatible way, so we expand it to the equivalent semver-tagged version with an explicit tool inputdtolnay/rust-toolchain@stableunpinned with azizmor: ignore[unpinned-uses]inline suppressionstable,nightly,1.100.0), so Dependabot behavior is unreliable.rust-toolchain.toml+rustup show(the pattern used by uv, ruff, etc.), eliminating the third-party dependency entirely.Maintenance
ref-version-mismatchaudit (enabled by default) verifies that version comments actually match the pinned SHA, so any potential comment drift will be caught in CI