ci: pin GitHub Actions to commit SHAs (supply-chain hardening)#6536
Open
camgrimsec wants to merge 6 commits into
Open
ci: pin GitHub Actions to commit SHAs (supply-chain hardening)#6536camgrimsec wants to merge 6 commits into
camgrimsec wants to merge 6 commits into
Conversation
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
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.
Summary
Pins every third-party GitHub Action used in
.github/workflows/to a full commit SHA, matching the format already used foraws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0indocker-image-ecr.yml.24 action references across 6 workflow files are converted from floating tags (e.g.
@v6,@v4.0.0) to immutable commit SHAs with a trailing version comment.Why this matters
Floating Git tags can be force-moved by a compromised maintainer or a successful supply-chain attack on the action's repository. If
actions/checkout@v6is repointed to a malicious commit, every workflow run that resolves the tag at run-time will execute the attacker's code with full access to repository secrets and theGITHUB_TOKEN.This is not theoretical:
tj-actions/changed-files) — March 2025: malicious code added to existing tags; thousands of repositories exposed CI secrets.reviewdog/action-setup) — March 2025: same pattern, different action.Pinning by SHA freezes the executable content of every action; tag movement is no-op.
What changed
action@versionreferences resolved to commit SHAs at the latest stable tag matching the existing version constraint.docker-image-dockerhub.yml(6 pins)docker-image-ecr.yml(5 pins)main.yml(5 pins)proprietary-path-guard.yml(1 pin)publish-package.yml(6 pins)test_docker_build.yml(1 pin)actions/checkout@v6@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3actions/checkout@v6.0.2@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2actions/setup-node@v6@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0aws-actions/amazon-ecr-login@v2@d539f0932e70871a027e9d5a9d8fc38589180a64 # v2.1.6cypress-io/github-action@v7.1.5@bc22e01685c56e89e7813fd8e26f33dc47f87e15 # v7.1.5docker/build-push-action@v6.19.2@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2docker/login-action@v4@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0docker/setup-buildx-action@v4.0.0@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0docker/setup-qemu-action@v4.0.0@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0pnpm/action-setup@v4@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0pnpm/action-setup@v6@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9The version comment after each
# vX.Y.Zkeeps the file readable and makes Dependabot's auto-bump diff trivial to review.What I left alone
aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0— already pinned (this PR follows that pattern)../.github/workflows/publish-package.yml— local reusable workflow, not an external action.publish-agentflow.ymlandpublish-observe.yml— only contain local workflow references, no third-party actions.Compatibility
github-actionsecosystem already handles SHA-pinned dependencies; if enabled, it will auto-PR updates against these.Follow-on (out of scope for this PR)
Once SHAs are in, a single-line addition to
.github/dependabot.ymlenables automatic updates:Happy to send that as a separate PR if useful.
Generated against
mainat commitd07186844263bad057008863037466aff7c3390f. Open to any naming / commit-squash preference the maintainers want.