fix(ci): least-privilege top-level GITHUB_TOKEN permissions#384
Closed
seonghobae wants to merge 1 commit into
Closed
fix(ci): least-privilege top-level GITHUB_TOKEN permissions#384seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
Scorecard Token-Permissions (CWE: excessive GITHUB_TOKEN scope) flagged top-level write permissions across four workflows. Set each workflow's top-level permissions to read-only (contents: read) and keep the required write scopes declared at the job level: - strix.yml: move id-token/statuses write + actions/models read to the strix job; top level now contents: read (fixes alert #43). - security-scan.yml: top level -> contents: read; all jobs already declare their own scopes (fixes alert #42). - osv-scanner-pr.yml: top level -> contents: read; osv-scan keeps its job-level security-events: write for SARIF upload (fixes alert #41). - pr-review-merge-scheduler.yml: add top-level contents: read; the scan-pr-queue job keeps its explicit write scopes (fixes alert #9). No effective permission of any functional job is reduced.
Contributor
Author
|
Superseded by #382, which contains the least-privilege token-permission fixes from this PR plus the central OSV/Trivy failure-log visibility and review-cadence fixes now being validated on the newer head. |
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
Fixes OpenSSF Scorecard Token-Permissions code-scanning alerts (excessive
GITHUB_TOKENscope / principle-of-least-privilege) by setting each affected workflow's top-levelpermissionsto read-only and declaring the required write scopes at the job level — the same pattern already used byscorecard-analysis.yml(permissions: read-alltop + job-level writes).Alerts addressed
strix.yml(L100)statuses: writecontents: read; write scopes (id-token,statuses,actions,models) moved to thestrixjobsecurity-scan.yml(L41)security-events: writecontents: read; all jobs already declare their own scopesosv-scanner-pr.yml(L20)security-events: writecontents: read;osv-scankeeps job-levelsecurity-events: writepr-review-merge-scheduler.yml(L1)contents: read;scan-pr-queuekeeps its explicit write scopesSafety
cancel-closed-pr-runsjobs are tightened to read-only.opencode-review.yml,OPENCODE_*env) touched; no run-cancellation behavior changed.Note on alert #21 (
osv-scanner-pr.ymljobLevelsecurity-events: write)That job-level
security-events: writeis the minimum scope required for the reusablegoogle/osv-scanner-actionPR workflow to upload its SARIF to code scanning — which is the entire purpose of this file (satisfies the orgcode_scanning(osv-scanner)ruleset). Scorecard flags it only because it cannot see the recognizedupload-sarifaction inside the reusable workflow. Removing it would break SARIF upload and the org gate, so it is retained by design.