Skip to content

ci: declare workflow-level contents: read on 8 e2e/test workflows#1148

Open
arpitjain099 wants to merge 1 commit into
cockroachdb:masterfrom
arpitjain099:chore/declare-workflow-perms-readonly
Open

ci: declare workflow-level contents: read on 8 e2e/test workflows#1148
arpitjain099 wants to merge 1 commit into
cockroachdb:masterfrom
arpitjain099:chore/declare-workflow-perms-readonly

Conversation

@arpitjain099
Copy link
Copy Markdown

Pins the default GITHUB_TOKEN to contents: read on the 8 workflows in .github/workflows/ that don't actually need any write scope:

  • e2e-kind-create.yaml, e2e-kind-decommission.yaml, e2e-kind-upgrades.yaml, e2e-kind-upgradessha256.yaml, e2e-kind-versionchecker.yaml: kind cluster e2e suites.
  • nightly-smoketest.yaml: scheduled smoke test.
  • templates.yaml: template-generation check.
  • tests.yaml: unit and integration test matrix.

None of the eight calls a GitHub API beyond the initial checkout, so workflow-level contents: read is sufficient.

update-crdb-versions.yaml is intentionally left out. It uses peter-evans/create-pull-request which needs contents: write + pull-requests: write. That scope is best declared by maintainers who own the version-bump flow.

Why

CVE-2025-30066 (March 2025 tj-actions/changed-files supply-chain compromise) exfiltrated GITHUB_TOKEN from workflow logs and the leaked token retained whatever scope was issued at the workflow level. Pinning per workflow caps that 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.

Pins the default GITHUB_TOKEN to contents: read on the 8 workflows
in .github/workflows/ that don't actually need any write scope:

- e2e-kind-create.yaml, e2e-kind-decommission.yaml,
  e2e-kind-upgrades.yaml, e2e-kind-upgradessha256.yaml,
  e2e-kind-versionchecker.yaml: kind cluster e2e suites.
- nightly-smoketest.yaml: scheduled smoke test.
- templates.yaml: template-generation check, no GitHub API.
- tests.yaml: unit/integration test matrix.

update-crdb-versions.yaml is intentionally left out; it uses
peter-evans/create-pull-request which needs contents: write +
pull-requests: write. That scope is best declared by maintainers.

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 if the default ever widens, 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>
@cockroachlabs-cla-agent
Copy link
Copy Markdown

cockroachlabs-cla-agent Bot commented May 14, 2026

CLA assistant check
All committers have signed the CLA.

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