ci(security): add OpenSSF Scorecard workflow
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
name: OpenSSF Scorecard
|
||||||
|
|
||||||
|
# Scores the repo's security posture (branch protection, pinned deps, token
|
||||||
|
# permissions, etc.) and publishes to the OpenSSF public API so a badge can be
|
||||||
|
# shown (badge is added in Plan E). REQUIRES the canonical repo to be PUBLIC —
|
||||||
|
# see the maintainer checklist in docs/systems/security-scanning.md.
|
||||||
|
|
||||||
|
on:
|
||||||
|
branch_protection_rule:
|
||||||
|
schedule:
|
||||||
|
- cron: '18 4 * * 2' # weekly Tuesday 04:18 UTC
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecard analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write # upload SARIF
|
||||||
|
id-token: write # publish_results OIDC attestation
|
||||||
|
steps:
|
||||||
|
- name: Harden the runner
|
||||||
|
uses: step-security/harden-runner@v2
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Run Scorecard
|
||||||
|
uses: ossf/scorecard-action@v2
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
publish_results: true
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
- name: Upload SARIF to code scanning
|
||||||
|
uses: github/codeql-action/upload-sarif@v3
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
Reference in New Issue
Block a user