Field note / access control
GitHub Actions permissions: review the real scope
The difference between YAML permission declarations, effective token authority and the minimum access a job needs.
Start with the distinction
Every GitHub Actions job may receive a GITHUB_TOKEN for the repository. The permissions key controls its requested scopes. A top-level declaration can apply across jobs; a job-level declaration allows narrower privileges for a specific task. It is not enough to locate the word write and announce a breach.
The practical question is: which job must perform which operation using which identity? A test job that only downloads source usually needs much less authority than a release job that creates a tag, opens a PR or publishes provenance.
A baseline and a privileged exception
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@<reviewed-revision>
- run: npm test
publish:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
# Only enable the scopes and trust path this job needs.This is an illustrative pattern, not copy-and-paste deployable YAML; replace placeholder action revisions with actual trusted references and verify the permissions required by your publishing workflow. GitHub notes that explicitly specifying some permissions generally sets unspecified scopes to none.
Four reviews worth making
- Locate every workflow-level and job-level
permissionsmapping; record which event invokes the job. - Identify which step actually needs
contents: write,issues: write,pull-requests: writeor another elevated scope. Move privileges to a narrower job where feasible. - Treat
id-token: writeseparately: it enables eligible jobs to request an OIDC token, but does not independently confirm that any cloud trust policy accepts it. - Inspect triggers, fork behavior, reusable workflows and organizational restrictions before making claims about effective authorization.
Example: a documented real repository
At a pinned historical LOLM commit, the daily release workflow declares contents, pull-requests, issues and id-token with write access at the workflow level. Qira Proof's bounded scanner flags the declaration. A human reading the file can corroborate it directly.
That establishes the declared scopes, not an exploit, leaked token or proof that every job actually exercised those privileges. The next useful work is mapping each write scope to the operations that genuinely require it.
Inspect the pinned LOLM case studyPrimary reference
GitHub describes permissions and job inheritance in Workflow syntax and the per-job token model in GITHUB_TOKEN. Read the current platform guidance before modifying a sensitive release workflow.