fix(ci): enforce least-privilege permissions across all GHA workflows#608
Open
umarfarook882 wants to merge 1 commit into
Open
fix(ci): enforce least-privilege permissions across all GHA workflows#608umarfarook882 wants to merge 1 commit into
umarfarook882 wants to merge 1 commit into
Conversation
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.
Problem
GitHub Actions uses the repository's default token permissions when no permissions block is declared. If the repo default is contents: write, every build and test job silently gets write access to the repository. Additionally, when a job declares any explicit permission, all others drop to none, which can silently break steps like actions/checkout.
Changes
Three classes of bug fixed across 10 workflow files:
permissions: contents: readas a safe default to build-c, build-go, build-node, build-runtime, build-wheels, warm-caches, e2e-test, lint, and test. Setpermissions: {}on config.yml whose only job runs echo.pull-requests: read, silently dropping contents to none and breaking actions/checkout and dorny/paths-filter on push events. The test.yml rust job had only id-token: write, also dropping contents to none. Addedcontents: readto all three.contents: read: e2e-test.yml start-runner and stop-runner declaredcontents: readbut neither job checks out code. Removed, leaving onlyid-token: writefor AWS OIDC.Note: Analysed using LLM model (Claude/DeepSeek) and static analysis tools zizmor. All findings are reviewed manually and applied fix.