Repository navigation
chore(ci): trim GITHUB_TOKEN permissions - #777
Merged
Merged
Conversation
Each job now declares only the GITHUB_TOKEN scopes that its steps use. Remove id-token, attestations and packages grants that no step uses. Downgrade contents and pull-requests writes where the steps use an App token or only read. Comment each remaining write with its step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
OX Security reviewed this pull request — nothing to fix.
Branch |
olivermeyer
marked this pull request as ready for review
November 13, 2026 13:32
arne-aignx
approved these changes
Nov 13, 2026
olivermeyer
enabled auto-merge (rebase)
November 13, 2026 13:34
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (63.78%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.
|
|
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.



Why?
Many jobs grant
GITHUB_TOKENscopes that no step uses. A compromised action or dependency in such a job can use an unusedwritescope to push, release, or comment. This is the Security Day measure "Set least-privilege GITHUB_TOKEN permissions in workflows".How?
Each job now declares only the scopes that its steps use, and each caller of a reusable workflow grants exactly what the callee declares. The release workflows move their workflow-level block into the job and set
permissions: {}at workflow level. Each remainingwriteline has a comment that names the step that needs it.Changed scopes
_lint.yml,_docs.yml,_audit.ymlid-tokengoogle-github-actions/author other OIDC consumer. Steps are checkout, setup-uv, apt,make._lint.yml,_docs.yml,_audit.ymlpackagesci-cd.ymlid-token,packages_test.ymlattestationsactions/attest-*step_test.ymlid-tokenCODECOV_TOKEN(use_oidcnot set). SonarQube usesSONAR_TOKEN._test.ymlpackages_test.ymlcontents{})$GITHUB_OUTPUT.ci-cd.ymlattestations,id-token,packages_codeql.ymlactions_codeql.ymlpackagesci-cd.yml,codeql-scheduled.ymlactions,packagesci-cd.ymlpull-requestsci-cd.ymlstatuses_ketryx_report_and_check.ymlcontentsKETRYX_API_KEYand has no token input.download-artifactin the same run uses the runtime token._ketryx_report_and_check.ymlpackagesci-cd.ymlattestations,id-token,packagesci-cd.ymlcontents_package-publish.ymlattestations,id-token,packages_package-publish.ymlpackagesuv publishusesUV_PUBLISH_TOKEN.ci-cd.ymlattestations,id-token,packages_build-native-only.ymlattestations,id-token,packagesbuild-native-only.ymlattestations,id-token,packagesbuild-native-only.ymlcontentscontents: readbuild-native-only.ymlcontents{})labels-sync.ymlid-tokenlabels-sync.ymlpull-requestsissues: writeonly_scheduled-audit.yml,scheduled-audit-hourly.ymlid-token_scheduled-test-hourly.yml,_scheduled-test-stress.ymland their callersid-token_scheduled-test-daily.ymland its two callersattestations,id-token,packages_test.ymltest_claude-code.ymlcontentsclaude-code-actiondoes all GitHub writes with the Claude App token from the OIDC exchange (log: "Using GITHUB_TOKEN from OIDC")._claude-code.ymlpull-requestsgithub_ciMCP server, which callspulls.get._claude-code.ymlissuesgithub_ciMCP server does not read issues.claude-code-interactive.yml,claude-code-automation-pr-review.yml,claude-code-automation-operational-excellence-weekly.ymlmerge-release.yml,prepare-release.yml,publish-release.ymlcontents{}, moved into the jobKept
_package-publish.ymlpackage_publish and theci-cd.ymlcaller:contents: writeforgh release createandgh api repos/.../dispatches._codeql.ymlanalyze and both callers:security-events: writeforgithub/codeql-action/analyze.labels-sync.ymlsync:issues: writeforcrazy-max/ghaction-github-labeler._claude-code.ymlclaude-code and its three callers:id-token: writefor the OIDC exchange ofanthropics/claude-code-action.Not changed
These are pre-existing linter findings on lines this PR does not touch:
excessive-permissionson line 1 of 25 workflows: there is no workflow-levelpermissions:block. Every job declares its own block.artipacked,anonymous-definition,template-injectionand more). The total fell from 221 to 188. No new finding.uses: $/.github/actions/run-testsin_test.ymland_scheduled-test-daily.ymlhas an invalid format.inputs.commit_messageis not defined in_scheduled-test-daily.yml.github.head_refgoes directly into an inline script in_ketryx_report_and_check.yml.How to check
package_publishruns only on av*tag.build-native-onlyruns only with thebuild:native:onlymarker.main. Thus, the first check is the first Claude run after the merge. If that run fails, revert the_claude-code.ymlpart.🤖 Generated with Claude Code