Repository navigation
ci: declare explicit GITHUB_TOKEN permissions on write jobs - #4648
Open
julianrubino wants to merge 1 commit into
Open
julianrubino wants to merge 1 commit into
julianrubino wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@greptileai review |
1 similar comment
Member
Author
|
@greptileai review |
This branch has not been deployed
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
Adds job-level
permissions:to the node jobs that write withGITHUB_TOKEN:e2e.yml/build-zetanodecontents: read,packages: writedocker/login-actionto ghcr.io withGITHUB_TOKEN,build-push-actionpush: true+ registry cache-toe2e.yml/e2e-okactions: read,pull-requests: writeactions.listJobsForWorkflowRunAttempt,issues.addLabels(MERGE_FAILED, already exists)sast-linters.yml/nosec_alertcontents: read,pull-requests: writemshick/add-pr-comment,issues.addLabels(nosec, already exists)semgrep.yml/semgrepcontents: read,security-events: writecodeql-action/upload-sarif(repo is public, soactions: readisn't needed)release-status-changer.yml/run-scriptcontents: writecheck_and_update.pycalls PyGithubrelease.update_releasepublish-release-zetaclient.yml,publish-release-zetacore.yml/releasecontents: write,id-token: write,attestations: writerelease-template.ymlpublish-releaserequests; a reusable workflow can't get more than its caller grantsNot changed:
reusable-e2e.ymlonly pulls from ghcr (read).matrix-conditionalsonly reads PRs.generate-files,release-test-buildandsemantic-pronly read.Evidence / testing
permissions:and grepped their steps for token writes (git push, gh release/pr, github-script REST calls, ghcr push, SARIF upload, third-party actions that write withgithub.token).actionlinton the changed files: no new findings.Why
INC-13809 hardening. The org default
GITHUB_TOKENpermission iswriteon every scope. The plan is to switch the org default to read-only (default_workflow_permissions=read), so a leaked or hijacked job token can't push code, cut releases or edit PRs unless the job explicitly asks for it.The jobs below write with
GITHUB_TOKENand have nopermissions:block, so they rely on the write default and would break after the switch. This PR declares the minimal scopes each one uses. It doesn't change behavior today: the declared scopes are a subset of the current write default. Unlisted scopes becomenonefor these jobs only, and I checked every step in each job, so none of them uses an unlisted scope.Jobs and workflows not listed already declare
permissions:or only read with the token.Rollback
Revert this PR.
Merge order
Merge before the org-level flip (
gh api -X PUT orgs/<org>/actions/permissions/workflow -f default_workflow_permissions=read). The flip happens after all PRs in this set are merged.

Confidence Score: 5/5
The PR appears safe to merge; the declared permissions cover the changed jobs’ existing token use.Summary
This PR gives jobs explicit
GITHUB_TOKENpermissions before the organization switches its default to read-only.No actionable issues were found.
Reviews (2) · Last reviewed commit: "ci: declare explicit GITHUB_TOKEN permis..." · Reviewed by Greptile