chore: add OpenSSF Scorecard workflow - #454
Conversation
Add a GitHub Actions workflow that runs OpenSSF Scorecard analysis on every push to main and supports manual trigger (workflow_dispatch). The workflow: - Checks out the repo without persisting credentials - Runs ossf/scorecard-action to generate SARIF results - Publishes results to the OpenSSF public API (updates the badge) - Uploads the SARIF file as a build artifact (retained for 5 days)
✅ Deploy Preview for commit-check ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR adds a new GitHub Actions workflow, "OpenSSF Scorecard," that runs on pushes to the main branch and on manual dispatch. It checks out the repository, executes the OpenSSF Scorecard action to generate and publish SARIF results, and uploads the SARIF file as a build artifact with 5-day retention. ChangesScorecard CI Workflow
Estimated code review effort: 1 (Trivial) | ~3 minutes Suggested labels: ci, github_actions Suggested reviewers: N/A Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/scorecard.yml (1)
8-30: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winConsider surfacing SARIF results in the repo's Security tab.
This workflow publishes results to the OpenSSF public API and stores the SARIF as a 5-day build artifact, but never uploads it to GitHub's code-scanning dashboard. The OSSF-documented example workflow additionally uses
github/codeql-action/upload-sarif(needingsecurity-events: write) so results are visible under the Security tab for repo maintainers, not just via the artifact or public API.If this omission is intentional (e.g. deferred to a follow-up PR), feel free to disregard.
♻️ Suggested addition
permissions: id-token: write contents: read + security-events: write jobs: analysis: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b757266b50d # v2.4.1 with: results_file: results.sarif results_format: sarif publish_results: true - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: SARIF file path: results.sarif retention-days: 5 + + - uses: github/codeql-action/upload-sarif@<pin-latest-v3-or-v4-sha> # verify latest tag + with: + sarif_file: results.sarif🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/scorecard.yml around lines 8 - 30, The scorecard workflow generates SARIF and uploads it as an artifact, but it does not send the results to GitHub’s code-scanning UI. Update the workflow around the existing ossf/scorecard-action and actions/upload-artifact steps to also upload results.sarif with github/codeql-action/upload-sarif, and add the required security-events: write permission alongside the current permissions block so the findings appear in the repo’s Security tab.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/scorecard.yml:
- Around line 8-30: The scorecard workflow generates SARIF and uploads it as an
artifact, but it does not send the results to GitHub’s code-scanning UI. Update
the workflow around the existing ossf/scorecard-action and
actions/upload-artifact steps to also upload results.sarif with
github/codeql-action/upload-sarif, and add the required security-events: write
permission alongside the current permissions block so the findings appear in the
repo’s Security tab.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 37e7edfb-6fe5-4969-9af1-ed145a9bdda6
📒 Files selected for processing (1)
.github/workflows/scorecard.yml



Summary
Add OpenSSF Scorecard CI workflow that automatically scans the repository for security best practices on every push to
main, and supports manual trigger viaworkflow_dispatch.Changes
.github/workflows/scorecard.ymlTriggers
pushtomainworkflow_dispatchWorkflow Steps
Effects
workflow_dispatchNotes
id-token: write(for publishing results to the API) +contents: readmain.yml,publish-package.yml, etc.)Summary by CodeRabbit