Grant GITHUB_TOKEN only what the workflows use - #256
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes the two open code scanning alerts, both
actions/missing-workflow-permissions(medium).Neither workflow declared a
permissions:key, soGITHUB_TOKENgot 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,tscand Jest. No GitHub API calls.manual-eas-build.yml— clones the repo, sets up node, authenticates to EAS withEXPO_TOKEN, installs, and runseas build. The build runs on EAS, not in the job.expo/expo-github-action@v8is given an Expo token here and no GitHub token, so its PR-commenting path is not in use.So
contents: readis the whole requirement for both.manual-eas-build.ymlis a release path I cannot exercise from a PR — it isworkflow_dispatchonly. If a future change to it needs to write back to the repo or comment on a PR, that job will need its own widerpermissions:block, and the workflow-level default here will make that an explicit decision rather than a silent inheritance.