name: Scorecard # OpenSSF Scorecard tracks broader repo security-health drift (branch # protection, token permissions, pinned actions, dangerous workflows, CI # tests, maintenance signals) on a schedule, complementing the per-diff # dependency-audit and secret-scan jobs in security.yml. # # Advisory-first: this workflow only measures and publishes a score, and it # never blocks merges. It runs on the default branch (Scorecard needs repo-level # data and a token, so it is not meaningful on PR forks) plus a weekly schedule # so regressions in security health surface even when no code changes. on: branch_protection_rule: schedule: # Weekly, Mondays at 07:00 UTC. - cron: '0 7 * * 1' push: branches: - main workflow_dispatch: # Top-level token is read-only; the analysis job widens only what it needs. permissions: read-all jobs: analysis: name: Scorecard analysis runs-on: ubuntu-latest # Job-level permissions fully replace the top-level block (unlisted scopes # default to none), so the reads checkout and Scorecard need are explicit. permissions: # Needed by actions/checkout to clone the repo, and by Scorecard to read # workflow files for its Dangerous-Workflow / Token-Permissions checks. contents: read actions: read # Needed to upload the SARIF results to the code-scanning dashboard. security-events: write # Needed to publish results and obtain a badge (uses OIDC, no secrets). id-token: write steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Run OpenSSF Scorecard uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: scorecard.sarif results_format: sarif # Publishes results to the OpenSSF REST API for the public badge and # trend tracking. Set to false if maintainers prefer to keep the # score private (the SARIF upload below still works either way). publish_results: true # Retain the raw SARIF as a build artifact for offline inspection. - name: Upload artifact uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: scorecard-sarif path: scorecard.sarif retention-days: 5 - name: Upload SARIF to code-scanning uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 with: sarif_file: scorecard.sarif