ci: harden GitHub Actions against supply chain attacks#4606
Closed
kakkoyun wants to merge 1 commit into
Closed
Conversation
Add `persist-credentials: false` to all 56 actions/checkout steps across 22 workflow files and the test-apps.cue template (regenerated test-apps.yml). This prevents GITHUB_TOKEN from being stored in .git/config after checkout, eliminating the primary vector used in supply chain attacks like the tj-actions/changed-files incident. sync-cue-actions.yml still performs a git push; it now injects credentials via `git remote set-url` scoped only to that step rather than persisting them for all subsequent steps. Also add explicit `permissions:` blocks to 6 workflows that were inheriting repo defaults, and fix two stale/missing version comments on checkout steps.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
Member
Author
|
Opened in the fork by mistake. |
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.
What does this PR do?
Adds
persist-credentials: falseto all 56actions/checkoutsteps across 22 workflow files and thetest-apps.cueCUE template (which regeneratestest-apps.yml). Also adds explicitpermissions:blocks to 6 workflows that were inheriting repo defaults, and fixes two stale/missing version comments.Motivation
actions/checkoutdefaults topersist-credentials: true, which storesGITHUB_TOKENin.git/configashttp.https://github.com/.extraheaderfor the lifetime of the job. Any subsequent step — including third-party actions — can read that credential and use it to push code, create releases, or access private repos. This is the primary vector used in thetj-actions/changed-filessupply chain attack.Setting
persist-credentials: falseeliminates this residual credential exposure. The one workflow that performs agit push(sync-cue-actions.yml) now injects credentials viagit remote set-urlscoped only to that step.Reviewer's Checklist
make lintlocally.test-apps.ymlregenerated fromtest-apps.cue).