Repository navigation
#2182: drop unused workflow write scopes; guard with workflow_permissions_test - #3780
Merged
Merged
Conversation
- 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
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.
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: dropchecks: writefrom lint/typecheck/format/generate/security-audit/license-audit/test/build/coverage/dx-ci, andpull-requests: writefrom dx-ci. Coverage keepspull-requests: writefor its comment. Permission lines only (ci: coverage PR comment keeps a stale PASS when coverage fails #2179 edits coverage steps).ci.yml: top-levelpermissions: contents: read; dogfood no longer grantschecks: write.ghcr.yml: split into a read-onlybuildjob (runs on PRs) and apushjob (needs: build,if: workflow_dispatch && inputs.approve) that holds packages/id-token/attestations/artifact-metadata write. Cosign pin readers, the singleactions/attest@, and summary strings are byte-identical.bump.yml: widen-one iscontents: read; the App token does every write.//tools/ci:workflow_permissions_test(yaml_serde, workflow list fromworkflow_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 unusedchecks, inherited unusedpull-requestsand 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 expectscontents: readonly.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), soworkflow_pins_testfailed on main too.Tests
checks: write, dx-cipull-requests: write, the 2 bump scopes and ci.yml's missing top-level permissions. It passes after the changes.tools/dx testpassed for workflow_permissions, workflow_pins, actionlint, signing_pins, bazelisk_pins, action_pins, advisory_snapshots, aggregate_gates, bump_auth and release_assets.dx_cli_testcalling_jobs_grant_every_scope_the_called_workflow_requestspasses.tools/dx fix --affectedmade no changes.tools/dx check --affectedpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_011u9TXHDZrfmzFQ2WT8QAKK