You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci.yml is the only workflow in the repo without a top-level permissions: block, so its 10 jobs inherit the repository default token permissions. This adds contents: read, following the pattern finalize-release.yaml already uses: a restrictive top-level block, with jobs that need more declaring it themselves.
Why this is safe
Every job was audited before the change:
The only GITHUB_TOKEN reference in the file is inside the proto job, which already declares its own permissions: block (contents: read + pull-requests: write, matching what bufbuild/buf-action documents). A job-level block fully replaces the workflow-level one, so proto is unaffected.
No other job runs gh, uses actions/github-script, posts comments, pushes commits, uploads release assets, or pushes images. docker-build runs with push: false.
Swatinem/rust-cache (via setup-rust-toolchain) and BuildKit's type=gha cache both authenticate with ACTIONS_RUNTIME_TOKEN, which is not governed by permissions:.
taiki-e/install-action passes github.token only to relieve cargo-binstall rate limiting, read-only.
The three submodules are public third-party repos fetched over HTTPS.
Scope
Two added lines, placed immediately before jobs: to mirror finalize-release.yaml. No job-level changes.
Audited the PR branch independently — the key claims hold:
Single GITHUB_TOKEN reference, correctly scoped. The only secrets.GITHUB_TOKEN use in the file is line 160 inside bufbuild/buf-action. The proto job at line 148 already declares its own permissions: block (contents: read + pull-requests: write), which fully replaces the workflow-level default for that job. buf-action's ability to post lint annotations on PRs is unaffected.
No other job needs write access. Checked every job: no gh calls, no actions/github-script posting comments, no pushes, no release asset uploads. Swatinem/rust-cache and BuildKit's type=gha both use ACTIONS_RUNTIME_TOKEN (separate from GITHUB_TOKEN, unaffected by permissions:). taiki-e/install-action passes github.token only for read-only rate-limiting; contents: read covers it.
Compatibility with PR #217. Both PRs modify ci.yml but touch entirely different lines — #217 replaces uses: @v<tag> references with SHAs, #218 adds three lines before jobs:. They apply cleanly in either merge order without conflicts.
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
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.
Summary
ci.ymlis the only workflow in the repo without a top-levelpermissions:block, so its 10 jobs inherit the repository default token permissions. This addscontents: read, following the patternfinalize-release.yamlalready uses: a restrictive top-level block, with jobs that need more declaring it themselves.Why this is safe
Every job was audited before the change:
GITHUB_TOKENreference in the file is inside theprotojob, which already declares its ownpermissions:block (contents: read+pull-requests: write, matching whatbufbuild/buf-actiondocuments). A job-level block fully replaces the workflow-level one, soprotois unaffected.gh, usesactions/github-script, posts comments, pushes commits, uploads release assets, or pushes images.docker-buildruns withpush: false.Swatinem/rust-cache(viasetup-rust-toolchain) and BuildKit'stype=ghacache both authenticate withACTIONS_RUNTIME_TOKEN, which is not governed bypermissions:.taiki-e/install-actionpassesgithub.tokenonly to relieve cargo-binstall rate limiting, read-only.Scope
Two added lines, placed immediately before
jobs:to mirrorfinalize-release.yaml. No job-level changes.