ci: restrict default token permissions to read-only - #8440
Open
alexisLefebvre wants to merge 2 commits into
Open
ci: restrict default token permissions to read-only#8440alexisLefebvre wants to merge 2 commits into
alexisLefebvre wants to merge 2 commits into
Conversation
Without an explicit block, the automatic token inherits whatever the repository or organisation default grants, which can include write scopes. Neither workflow writes anything back to GitHub, so a compromised step or action had more reach than the work required. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every job here authenticates through a GitHub App token, so the automatic token is never used: the write grant it carried could not authorise the pushes to the component repositories anyway, since its scope is limited to this repository. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
alexisLefebvre
force-pushed
the
restrict-workflow-token-permissions
branch
from
August 4, 2026 13:10
f66256f to
fd973c4
Compare
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
Declares a top-level
permissions: contents: readin the CI, Guides and Release Pipeline workflows.Commit Lintalready had one and is untouched.Nothing in the CI or Guides workflows writes back to GitHub — no
git push, noghcall, no PR-creating action. Artifact upload and dependency caching authenticate withACTIONS_RUNTIME_TOKEN, notGITHUB_TOKEN, so they are unaffected by the restriction.Release Pipeline does push: its subtree-split job runs
subtree.sh, which splits eachsrc/*component and pushes the result to the matching per-component repository. It nonetheless loses thecontents: writethat job declared, because that grant was never what authorised those pushes — every target is a separate repository (api-platform/serializer,api-platform/state, …), andGITHUB_TOKENis scoped to this repository alone, so no permission level on it could reach them. The credential that does authorise them is the GitHub App token, whichactions/checkoutreceives explicitly and stores as a host-scopedhttp.https://github.com/.extraheader, applying to the remotes the script adds afterwards. No step in the workflow referencesGITHUB_TOKENat all, so all three jobs run read-only and the release process is unchanged.Why
With no explicit block,
GITHUB_TOKENinherits the repository or organisation default, which on older settings is read and write across every scope. That is ambient authority these jobs never exercise: any compromised step, dependency or action in a run triggered from a branch push could use it to push commits, edit issues, or alter releases.Declaring the scopes makes the grant match the work, and also pins it against a future change to the org-wide default.
🤖 Generated with Claude Code