Skip to content

ci: declare workflow-level contents: read on 2 workflows#1517

Merged
steve-the-edwards merged 1 commit into
square:mainfrom
arpitjain099:chore/declare-workflow-perms-readonly
Jun 5, 2026
Merged

ci: declare workflow-level contents: read on 2 workflows#1517
steve-the-edwards merged 1 commit into
square:mainfrom
arpitjain099:chore/declare-workflow-perms-readonly

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

Pins the default GITHUB_TOKEN to contents: read on 2 workflows in .github/workflows/ that don't call a GitHub API beyond the initial checkout.

Left implicit because they reference GITHUB_TOKEN / use a write-scope action / trigger on pull_request_target. Best declared by a maintainer: kotlin.yml.

Why

CVE-2025-30066 (March 2025 tj-actions/changed-files supply-chain compromise) exfiltrated GITHUB_TOKEN from workflow logs. Pinning per workflow caps runtime authority irrespective of the repo or org default, gives drift protection if the default ever widens, and is credited per-file by the OpenSSF Scorecard Token-Permissions check.

YAML validated locally with yaml.safe_load on each touched file.

@arpitjain099 arpitjain099 requested review from a team and zach-klippenstein as code owners May 16, 2026 00:05
@CLAassistant

CLAassistant commented May 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@steve-the-edwards

Copy link
Copy Markdown
Contributor

@arpitjain099 - this looks helpful - can I ask why you opened this PR though? Are you attempting to follow up from https://github.com/advisories/GHSA-mrrh-fwg8-r2c3 across github?

Wouldn't this be mitigated by requiring approval for the worklfows to run?

@arpitjain099

Copy link
Copy Markdown
Contributor Author

Good questions @steve-the-edwards.

Are you attempting to follow up from GHSA-mrrh-fwg8-r2c3 across github?

Not that specific advisory directly. The trigger for this batch of PRs across repos was CVE-2025-30066 in March (the tj-actions/changed-files supply-chain compromise) - that incident exfiltrated GITHUB_TOKEN from caller workflow logs whenever a transitive action was breached, and the blast radius was whatever scope the token had at trigger time. Per-workflow contents: read caps that for workflows that don't actually need more.

Wouldn't this be mitigated by requiring approval for the workflows to run?

Approval gates help against "new untrusted contributor's PR triggers malicious code on a runner that holds a powerful token" but they don't help against an already-trusted action becoming compromised mid-stream (the tj-actions pattern). Once a workflow is running, the token is whatever scope was granted regardless of who initiated it.

The two layers compose: approval-required gates reduce the surface where malicious code reaches a runner, and explicit per-workflow scopes reduce what a compromised runner can do when it gets there. Happy to close if defense-in-depth on top of approval-required isn't the shape you want for this repo.

@steve-the-edwards

Copy link
Copy Markdown
Contributor

@arpitjain099 - Thanks for the replies - I will merge this now if you sign the CLA.

@arpitjain099

Copy link
Copy Markdown
Contributor Author

@arpitjain099 - Thanks for the replies - I will merge this now if you sign the CLA.

@steve-the-edwards Signed CLA, please merge

@steve-the-edwards steve-the-edwards force-pushed the chore/declare-workflow-perms-readonly branch from 931ab38 to 23ad28c Compare June 4, 2026 20:53
Pins the default GITHUB_TOKEN to contents: read on workflows that don't
call a GitHub API beyond the initial checkout. Other workflows that need
write scopes are left implicit for a maintainer to declare.

Motivation: CVE-2025-30066 (March 2025 tj-actions/changed-files
compromise) exfiltrated GITHUB_TOKEN from workflow logs. Per-workflow
caps bound runtime authority irrespective of repo or org default,
give drift protection, and are credited per-file by the OpenSSF
Scorecard Token-Permissions check.

YAML validated locally with yaml.safe_load.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@steve-the-edwards steve-the-edwards force-pushed the chore/declare-workflow-perms-readonly branch from 23ad28c to 6531fd4 Compare June 5, 2026 15:20
@steve-the-edwards steve-the-edwards merged commit d2ed6f4 into square:main Jun 5, 2026
78 checks passed
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.

3 participants