Skip to content

ci: declare read-all permissions on build-test workflow#2502

Open
arpitjain099 wants to merge 1 commit into
nodejs:mainfrom
arpitjain099:chore/build-test-permissions
Open

ci: declare read-all permissions on build-test workflow#2502
arpitjain099 wants to merge 1 commit into
nodejs:mainfrom
arpitjain099:chore/build-test-permissions

Conversation

@arpitjain099
Copy link
Copy Markdown

@arpitjain099 arpitjain099 commented May 14, 2026

Pins build-test.yml to read-all at workflow scope. Both jobs are read-only: gen-matrix runs checkout + tj-actions/changed-files (computes the diff from the event payload, no API write) + actions/github-script. build runs docker/build-push-action with push: false, load: true so the image stays local. So read-all is 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-files at line 31, the exact action behind CVE-2025-30066. When that action got compromised in March 2025, the malicious version dumped the runner's GITHUB_TOKEN through 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-all shorthand already used in scorecard.yml. YAML validated locally with yaml.safe_load.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant