ci: pin github actions to commit shas and declare workflow permissions - #1193
Open
Totara-thib wants to merge 2 commits into
Open
ci: pin github actions to commit shas and declare workflow permissions#1193Totara-thib wants to merge 2 commits into
Totara-thib wants to merge 2 commits into
Conversation
Mutable tags are movable pointers: whoever controls an action, or anyone who compromises it, can re-point the tag and the next run executes unreviewed code with the job's token. Same pattern as the tj-actions/changed-files incident (CVE-2025-30066). Pinning to the full commit sha freezes what runs; the version each sha corresponds to stays as a comment so update tooling keeps tracking them. Every sha was resolved from the upstream repository and cross-checked against its release tag. No workflow logic changes.
Without a permissions block, both jobs' GITHUB_TOKEN inherits the repository default scope. They only check out, build, test and upload coverage through the dedicated CODECOV_TOKEN secret, the GitHub token itself is never used, so both workflows get contents read.
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.
Hi, drive-by CI hardening in two commits, one logical change each.
Commit 1 pins the actions to their commit shas, versions kept as comments. A tag like
@v4is a movable pointer: whoever controls the action, or anyone who compromises it, can re-point it and your next run executes their code with the job's token. Same pattern as the tj-actions/changed-files incident (CVE-2025-30066). All shas were resolved from the upstream repos and cross checked against their release tags. The pins stay maintainable: if you want them bumped automatically, a dependabot config with thegithub-actionsecosystem does it, one small block.Commit 2 adds
permissions: contents: readto both workflows. The scope is exact, not guessed: the jobs only check out, build, test and upload coverage through the dedicated CODECOV_TOKEN secret, the GitHub token itself is never used.One heads up: if the org uses an Actions allowlist in settings, patterns written against tags (like
owner/action@v4) stop matching once refs are shas and workflows refuse to start. Entries need to beowner/action@*in that case.Found with the Plumber CLI (https://github.com/getplumber/plumber), verified on v3. I will also open a PR which adds it to CI so this does not quietly drift back, that one is a bonus, this PR stands on its own.