Skip to content

Set least-privilege GITHUB_TOKEN permissions for quick-check workflow - #10347

Open
Alb3e3 wants to merge 1 commit into
gwtproject:mainfrom
Alb3e3:harden-quick-check-permissions
Open

Set least-privilege GITHUB_TOKEN permissions for quick-check workflow#10347
Alb3e3 wants to merge 1 commit into
gwtproject:mainfrom
Alb3e3:harden-quick-check-permissions

Conversation

@Alb3e3

@Alb3e3 Alb3e3 commented Jun 17, 2026

Copy link
Copy Markdown

What

.github/workflows/quick-check.yml did not declare a permissions: block, so it ran with the repository's default GITHUB_TOKEN scopes. This adds an explicit least-privilege block:

permissions:
  contents: read        # checkout the repository
  pull-requests: read   # reviewdog reads the PR diff to post checkstyle annotations

Why

Scoping the token to exactly what the job needs follows the principle of least privilege and the OpenSSF Scorecard Token-Permissions check, 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-annotations reporter posts annotations via GitHub Actions log commands (no API write), and only reads the PR diff, so pull-requests: read preserves the checkstyle annotation behavior.

Note: this change was prepared with AI assistance; I reviewed and validated it against the workflow myself.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant