ci: drop contents and actions read from the scorecard job - #97
Conversation
Both are private-repository permissions and this repo is public. The only Actions API call Scorecard makes is ListWorkflowRunsByFileName, from the Packaging and Binary-Artifacts checks. That endpoint is publicly readable: requesting it for a public repo with no authentication at all returns 200. Upstream's starter workflow ships `contents: read` and `actions: read` commented out under "uncomment if installing in a private repository", and OSSF runs Scorecard on its own public repos -- ossf/scorecard and ossf/scorecard-action -- with `security-events: write` and `id-token: write` alone. Those runs are green and score Packaging 10, Binary-Artifacts 10 and CI-Tests 10, which is the same evidence for dropping `contents: read`: their checkout step works without it. Follows #94, which merged before this was raised in review on qBraid/pyqasm#412.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe Scorecard analysis job permissions were reduced. The job now requests only ChangesScorecard workflow permissions
Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to This narrowly removes unnecessary read permissions from the Scorecard workflow; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Follow-up to #94, which merged before this came up in review on qBraid/pyqasm#412. Same change is open there and needed on qbraid-algorithms.
Both permissions are private-repository only
contents: readandactions: readdo nothing on a public repository. Evidence, strongest last:The only Actions API call Scorecard makes is publicly readable.
ListWorkflowRunsByFileName(checks/raw/github/packaging.go,checks/raw/binary_artifact.go) hitsGET /repos/{owner}/{repo}/actions/workflows/{file}/runs. Requesting that for a public repo with no authentication at all returns200withtotal_count;/userreturns401in the same session, confirming the request really was anonymous.Upstream ships both commented out.
actions/starter-workflowscode-scanning/scorecard.yml:OSSF dogfoods exactly this.
ossf/scorecardandossf/scorecard-actionare both public and run withsecurity-events: writeandid-token: writealone. Their last five runs are green, and the checks that touch the Actions API score Packaging 10, Binary-Artifacts 10, CI-Tests 10. That is also the evidence for droppingcontents: read— theiractions/checkoutstep works without it.Risk
Low but not zero. Both affected checks return an error rather than degrading if the API call fails, so a wrong call here would show as a check erroring rather than silently scoring low — visible, not silent. The run that merged with #1343 succeeded, so we have a known-good baseline to compare the next run against.
Worth noting
Token-Permissionsscores 9 rather than 10 onossf/scorecardbecause they keeppermissions: read-allat workflow level; ours ispermissions: {}, which is stricter.Summary by CodeRabbit