Skip to content

Grant GITHUB_TOKEN only what the workflows use - #256

Merged
adulbrich merged 1 commit into
mainfrom
chore/workflow-permissions
Aug 21, 2026
Merged

Grant GITHUB_TOKEN only what the workflows use#256
adulbrich merged 1 commit into
mainfrom
chore/workflow-permissions

Conversation

@adulbrich

Copy link
Copy Markdown
Owner

Closes the two open code scanning alerts, both actions/missing-workflow-permissions (medium).

Neither workflow declared a permissions: key, so GITHUB_TOKEN got whatever the repository default grants. That default is almost always wider than the workflow needs, and a compromised action anywhere in the dependency chain inherits the whole grant.

I checked what each actually uses rather than guessing:

format-test.yml — clones the repo, sets up node, installs, runs Biome, ESLint, tsc and Jest. No GitHub API calls.

manual-eas-build.yml — clones the repo, sets up node, authenticates to EAS with EXPO_TOKEN, installs, and runs eas build. The build runs on EAS, not in the job. expo/expo-github-action@v8 is given an Expo token here and no GitHub token, so its PR-commenting path is not in use.

So contents: read is the whole requirement for both.

manual-eas-build.yml is a release path I cannot exercise from a PR — it is workflow_dispatch only. If a future change to it needs to write back to the repo or comment on a PR, that job will need its own wider permissions: block, and the workflow-level default here will make that an explicit decision rather than a silent inheritance.

Both workflows had no `permissions:` key, so GITHUB_TOKEN got whatever the
repository default grants. CodeQL flags this as
actions/missing-workflow-permissions, and it is a fair flag: the default is
almost always wider than the workflow needs, and a compromised action in the
dependency chain inherits the whole grant.

Neither workflow calls the GitHub API. Checks clones the repo and runs node.
Manual Expo EAS Build clones the repo, authenticates to EAS with EXPO_TOKEN,
and the build itself runs on EAS rather than in the job -- expo-github-action
is given an Expo token here and no GitHub token, so its PR-commenting path is
not in use.

`contents: read` is therefore the whole requirement for both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ephira Ready Ready Preview Aug 21, 2026 6:56pm

@adulbrich
adulbrich merged commit e970faa into main Aug 21, 2026
6 checks passed
@adulbrich
adulbrich deleted the chore/workflow-permissions branch August 21, 2026 19:58
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