ci: harden workflow permissions to least privilege#241
Merged
hedgar2017 merged 2 commits intomainfrom Feb 26, 2026
Merged
Conversation
Move pull-requests:write and checks:write from workflow level to only the specific jobs that need them (build-and-test, sanitizer, integration). Add missing workflow-level permissions: contents:read to deploy-docs.yaml.
|
📊 solx Tester Report ➡️ Download |
There was a problem hiding this comment.
Pull request overview
This PR hardens GitHub Actions workflow permissions by removing broad workflow-level write access and scoping required write permissions down to the specific jobs that need them, aligning CI with least-privilege principles.
Changes:
.github/workflows/test.yaml: Removes workflow-levelpull-requests: write/checks: writeand grantschecks: writeonly to jobs that publish check runs..github/workflows/integration-tests.yaml: Removes workflow-levelpull-requests: writeand grants it only to the job that posts PR comments..github/workflows/deploy-docs.yaml: Adds explicit workflow-levelcontents: readwhile retaining job-levelcontents: writefor deployment.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/test.yaml | Scopes checks: write down to build-and-test and sanitizer jobs instead of workflow-wide. |
| .github/workflows/integration-tests.yaml | Scopes pull-requests: write down to the integration job that posts PR comments. |
| .github/workflows/deploy-docs.yaml | Adds explicit workflow-level contents: read to avoid inheriting repo defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
📊 Hardhat Projects Report ➡️ Download |
The changes job declares job-level permissions (pull-requests: read), which overrides the workflow-level permissions entirely. Add explicit contents: read so actions/checkout retains repo read access.
|
📊 Foundry Projects Report ➡️ Download |
hedgar2017
approved these changes
Feb 26, 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.
Summary
pull-requests: writeandchecks: writefrom workflow level; add per-jobchecks: writeonly tobuild-and-testandsanitizer(needed forpublish-unit-test-result-action)pull-requests: writefrom workflow level; add it only to theintegrationjob (needed formshick/add-pr-comment)permissions: contents: readat workflow level (was inheriting repo defaults)No behavioral changes — every job retains the exact permissions it needs, just scoped at the job level instead of inherited broadly.
Test plan
test.yaml: Verifybuild-and-teststill publishes check run results andsanitizerworks withci:sanitizerlabelintegration-tests.yaml: Verifyintegrationjob can still post PR comments withci:integrationlabel