Set least-privilege GITHUB_TOKEN permissions for quick-check workflow - #10347
Open
Alb3e3 wants to merge 1 commit into
Open
Set least-privilege GITHUB_TOKEN permissions for quick-check workflow#10347Alb3e3 wants to merge 1 commit into
Alb3e3 wants to merge 1 commit into
Conversation
quick-check.yml declared no permissions block, so it ran with the
repository's default GITHUB_TOKEN scopes. Scope it to the minimum it
needs:
contents: read # checkout the repository
pull-requests: read # reviewdog reads the PR diff to post checkstyle
# annotations (github-pr-annotations needs no write)
This matches the least-privilege hardening already applied to the other
workflow in gwtproject#10169 and the OpenSSF Scorecard Token-Permissions guidance,
with no change to build or annotation behavior.
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.
What
.github/workflows/quick-check.ymldid not declare apermissions:block, so it ran with the repository's defaultGITHUB_TOKENscopes. This adds an explicit least-privilege block:Why
Scoping the token to exactly what the job needs follows the principle of least privilege and the OpenSSF Scorecard
Token-Permissionscheck, limiting the blast radius if a step or third-party action is compromised. This mirrors the hardening already merged for the other workflow in #10169.Impact
Permissions-only change — no build, trigger, or action-version changes. The reviewdog
github-pr-annotationsreporter posts annotations via GitHub Actions log commands (no API write), and only reads the PR diff, sopull-requests: readpreserves the checkstyle annotation behavior.Note: this change was prepared with AI assistance; I reviewed and validated it against the workflow myself.