fix(ci): tighten workflow GITHUB_TOKEN to least privilege (Scorecard Token-Permissions)#379
Closed
seonghobae wants to merge 1 commit into
Closed
fix(ci): tighten workflow GITHUB_TOKEN to least privilege (Scorecard Token-Permissions)#379seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
Scorecard Token-Permissions findings on the org .github workflows. Each fix follows least privilege — the workflow-level token is read-only and write scopes live only on the jobs that need them. No functionality is removed; every write grant is preserved at job scope where it was already (or is now) declared. - strix.yml (alert #43): move top-level id-token:write + statuses:write onto the `strix` scan job (which had no explicit block and relied on the broad top-level token); workflow-level token is now read-only. The publish job keeps its own job-scoped writes. - security-scan.yml (alert #42): drop redundant top-level security-events:write — the osv-scan, trivy-fs and scorecard jobs each already declare it. - osv-scanner-pr.yml (alert #41): drop redundant top-level security-events:write — the osv-scan reusable-workflow job already declares it at job scope. - pr-review-merge-scheduler.yml (alert #9): add a least-privilege top-level `permissions: contents: read` default; scan-pr-queue keeps its own writes. - pr-review-fix-scheduler.yml (alert #8): add a least-privilege top-level `permissions: contents: read` default; dispatch-review-fixes keeps its own. Tests: full suite unchanged (171 pass; 3 pre-existing stale-contract failures present on base, unrelated to permissions). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTAMs4bpSZS77Xe3RQjv9P
Contributor
Author
|
Superseded by #382, which includes this least-privilege token fix plus the Trivy log visibility and CI regression fixes, all in one current branch. |
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.
Summary
Remediates the fixable Scorecard Token-Permissions code-scanning alerts on the org
.githubworkflows by applying least privilege: the workflow-levelGITHUB_TOKENis kept read-only and everywritescope is declared only on the job that needs it. No functionality is removed — each write grant is preserved at job scope.Alerts fixed in code
strix.ymlid-token:write+statuses:writeonto thestrixscan job (previously it had no explicit block and inherited the broad top-level token). Workflow-level token is now read-only; the publish job keeps its own job-scoped writes.security-scan.ymlsecurity-events:write— theosv-scan,trivy-fs, andscorecardjobs each already declare it at job scope.osv-scanner-pr.ymlsecurity-events:write— theosv-scanreusable-workflow job already declares it at job scope.pr-review-merge-scheduler.ymlpermissions: contents: readdefault (workflow previously had none, so jobs inherited the broad default token).scan-pr-queuekeeps its own job-scoped writes.pr-review-fix-scheduler.ymlpermissions: contents: readdefault.dispatch-review-fixeskeeps its own job-scoped writes.These are hardening changes; they take effect once Scorecard re-analyzes
mainafter merge.Not changed (recorded as central-config / required-by-design — deliberately not weakened)
pip installsteps (⚡ Bolt: Optimize JSON decoding in normalize script #12, [codex] harden OpenCode agent evidence gate #11, No UX changes required (No UI Codebase) #10): CI tooling installs; dependency pinning is handled at the requirements-file / central level.opencode-review.ymlpull_request_targetPR-head checkout (🛡️ Sentinel: Add organization-wide default security policy #2): architectural and already mitigated withpersist-credentials: false; required for the trusted-review bot.Testing
Full
pytestsuite: 171 passed. The 3 failing tests (test_noema_review_gate, twotest_opencode_agent_contract) are pre-existing on the base branch (stale contract assertions likedefault: "-1"), unrelated to these permission edits — verified by running them against a clean tree.🤖 Generated with Claude Code