Apply least-privilege permissions to CI workflows#193
Merged
Conversation
Add explicit `permissions` blocks to workflows that were missing them (code-quality, unit-tests) and narrow the scope of release.yml by moving its `contents: write` from workflow level to job level. GitHub Actions grants the GITHUB_TOKEN a default permission set that varies by repository visibility. For public repositories GitHub defaults to read-only, but this is a repository-level setting that an admin can change at any time. Explicit permissions blocks make the workflow self-documenting and immune to that drift: - If an admin later broadens the org or repo default, these workflows still only get the permissions they declare. - A compromised or malicious step in a job cannot escalate beyond the declared scope. For read-only workflows like linting and unit tests, this means a supply-chain attack on a third-party action cannot push code, create releases, or modify repository settings. - Moving release.yml's `contents: write` from workflow level to job level ensures that if new jobs are added to the workflow later, they don't silently inherit write access they don't need. This follows the GitHub-recommended practice of always setting the minimum required permissions per job rather than relying on defaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vladbologa
approved these changes
May 18, 2026
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.
Add explicit
permissionsblocks to workflows that were missing them (code-quality, unit-tests) and narrow the scope of release.yml by moving itscontents: writefrom workflow level to job level.GitHub Actions grants the GITHUB_TOKEN a default permission set that varies by repository visibility. For public repositories GitHub defaults to read-only, but this is a repository-level setting that an admin can change at any time. Explicit permissions blocks make the workflow self-documenting and immune to that drift:
If an admin later broadens the org or repo default, these workflows still only get the permissions they declare.
A compromised or malicious step in a job cannot escalate beyond the declared scope. For read-only workflows like linting and unit tests, this means a supply-chain attack on a third-party action cannot push code, create releases, or modify repository settings.
Moving release.yml's
contents: writefrom workflow level to job level ensures that if new jobs are added to the workflow later, they don't silently inherit write access they don't need.This follows the GitHub-recommended practice of always setting the minimum required permissions per job rather than relying on defaults.