Skip to content

#2182: drop unused workflow write scopes; guard with workflow_permissions_test - #3780

Merged
TrapsterDK merged 1 commit into
mainfrom
issue-2182-perms
Oct 26, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
issue-2182-perms

Conversation

@TrapsterDK

Copy link
Copy Markdown
Collaborator

Refs #2182 (slice A). Slice B (starter callers, dx init template, docs) is #3779 and waits for the starter pin to move past this PR.

Changes

  • reusable-consumer.yml: drop checks: write from lint/typecheck/format/generate/security-audit/license-audit/test/build/coverage/dx-ci, and pull-requests: write from dx-ci. Coverage keeps pull-requests: write for its comment. Permission lines only (ci: coverage PR comment keeps a stale PASS when coverage fails #2179 edits coverage steps).
  • ci.yml: top-level permissions: contents: read; dogfood no longer grants checks: write.
  • ghcr.yml: split into a read-only build job (runs on PRs) and a push job (needs: build, if: workflow_dispatch && inputs.approve) that holds packages/id-token/attestations/artifact-metadata write. Cosign pin readers, the single actions/attest@, and summary strings are byte-identical.
  • bump.yml: widen-one is contents: read; the App token does every write.
  • New //tools/ci:workflow_permissions_test (yaml_serde, workflow list from workflow_exports): every workflow sets top-level permissions as a map, and every write scope (own or inherited) needs a step that uses it, per a marker table. Unknown write scopes fail. Inline fixtures cover unused checks, inherited unused pull-requests and an unknown scope.
  • docs_parity_tests.rs: ./ callers must not grant a scope above what the called workflow requests.
  • advisory_snapshots_test.rs: security-audit now expects contents: read only.
  • tools/ci/starter_pin.sha256: regenerated. The reusable-docs line was already stale on main (ci: share one repository cache per platform with one pruned saver (#2810) #3758 changed the file after Pin starters to a commit with the documented inputs (#2177) #3765), so workflow_pins_test failed on main too.

Tests

  • The guard works: run against main's workflows, it flagged 10 checks: write, dx-ci pull-requests: write, the 2 bump scopes and ci.yml's missing top-level permissions. It passes after the changes.
  • tools/dx test passed for workflow_permissions, workflow_pins, actionlint, signing_pins, bazelisk_pins, action_pins, advisory_snapshots, aggregate_gates, bump_auth and release_assets.
  • dx_cli_test calling_jobs_grant_every_scope_the_called_workflow_requests passes.
  • tools/dx fix --affected made no changes. tools/dx check --affected passes.
  • Not verified locally: the dogfood and docs jobs need a green CI run.

🤖 Generated with Claude Code

https://claude.ai/code/session_011u9TXHDZrfmzFQ2WT8QAKK

- reusable-consumer.yml: drop checks: write from the nine check jobs and dx-ci, and
  pull-requests: write from dx-ci. Coverage keeps pull-requests: write for its comment.
- ci.yml: top-level permissions contents: read; dogfood no longer grants checks: write.
- ghcr.yml: split into a read-only build job and a push job gated on
  workflow_dispatch + approve that holds packages/id-token/attestations/artifact-metadata.
- bump.yml: widen-one is contents: read; the App token does every write.
- New //tools/ci:workflow_permissions_test fails when a write scope has no step that uses it.
- docs_parity_tests: ./ callers must grant no scope beyond what the called workflow requests.
- starter_pin.sha256: regenerated for both reusable workflows (the docs line was stale on main).

Starter callers and dx init keep checks: write until the starter pin moves past this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9TXHDZrfmzFQ2WT8QAKK
@TrapsterDK
TrapsterDK merged commit 466e27a into main Oct 26, 2026
0 of 10 checks passed
@TrapsterDK
TrapsterDK deleted the issue-2182-perms branch October 26, 2026 21:55
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