ci: scope workflow write permissions to jobs - #739
Merged
Conversation
Top-level contents/packages/actions write grants apply the token to every job in the workflow. Move each write down to the single job that needs it and default the workflow to contents: read. Job-level permissions replace rather than merge, so each job keeps exactly the grants it had before; only the blast radius changes.
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.
Summary
Moves top-level workflow write permissions down to the single job that needs them, so a step added later cannot silently inherit write access.
Closes #735
Changes
release.yml,star-history.yml,api-snapshot-refresh.yml,cleanup-actions-cache.yml,ci-skip.yml: default tocontents: read, grant the write on the one job that uses it.Each of these has exactly one job, and job-level permissions replace rather than merge, so every job keeps precisely the grants it had before. Only the blast radius changes.
Left alone deliberately:
issues: writein the AI triage/moderation and stale workflows, andpages/id-tokeninpages.yml. Those are already single-job and carry no equivalent risk.Testing
actionlintclean across all workflows (the one finding is a pre-existing SC2034 inbrowser-e2e.yml, untouched here). Job names are unchanged, so the 11 required checks still match branch protection.Type of Change
ci:)Checklist
Closes #Ntype:*and onepriority:*labelphase:*label (or none when not roadmap work)