ci: declare read-all permissions on build-test workflow#2502
Open
arpitjain099 wants to merge 1 commit into
Open
ci: declare read-all permissions on build-test workflow#2502arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
The build-test workflow has two jobs:
gen-matrix -- actions/checkout + tj-actions/changed-files +
actions/github-script to compute the matrix from the
PR diff. No GitHub API write.
build -- actions/checkout + docker/build-push-action with
`push: false, load: true`, then docker run/test.
No GitHub API write, no registry push.
`permissions: read-all` at workflow scope matches the shorthand
scorecard.yml already uses, and brings build-test in line with the
per-job blocks declared by official-pr.yml, missing-checksum.yml,
shfmt.yml, doctoc.yml, eclint.yml, automatic-updates.yml, and
markdown-link-check.yml.
Note: this workflow uses tj-actions/changed-files, the action behind
CVE-2025-30066 (the March-2025 supply-chain attack). The compromised
release exfiltrated the runner's GITHUB_TOKEN through workflow logs;
the downstream blast radius scaled with whatever scope the token had
been issued at. Pinning the workflow to read-only bounds that radius.
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.
Pins
build-test.ymltoread-allat workflow scope. Both jobs are read-only:gen-matrixruns checkout +tj-actions/changed-files(computes the diff from the event payload, no API write) +actions/github-script.buildrunsdocker/build-push-actionwithpush: false, load: trueso the image stays local. Soread-allis the actual minimum.The repo already runs
scorecard.yml, so the OpenSSF Scorecard Token-Permissions check is observable; only explicit per-workflow declarations count toward it.Worth flagging that this workflow uses
tj-actions/changed-filesat line 31, the exact action behind CVE-2025-30066. When that action got compromised in March 2025, the malicious version dumped the runner'sGITHUB_TOKENthrough workflow logs; the blast radius for any downstream repo equalled the token's issued scope. A workflow pinned to read-all would have leaked a read-only token; one inheriting the legacy write default leaked something that could push to branches. The explicit cap is exactly the bound that matters here.Matches the
read-allshorthand already used inscorecard.yml. YAML validated locally withyaml.safe_load.