11# SPDX-License-Identifier: MPL-2.0
22# Prevention workflow - runs OpenSSF Scorecard and fails on low scores
33name : OpenSSF Scorecard Enforcer
4-
54on :
65 push :
76 branches : [main]
87 schedule :
9- - cron : ' 0 6 * * 1' # Weekly on Monday
8+ - cron : ' 0 6 * * 1' # Weekly on Monday
109 workflow_dispatch :
11-
1210# Estate guardrail: cancel superseded runs so re-pushes / rebased PR
1311# updates do not pile up queued runs against the shared account-wide
1412# Actions concurrency pool. Applied only to read-only check workflows
1513# (no publish/mutation), so cancelling a superseded run is always safe.
1614concurrency :
1715 group : ${{ github.workflow }}-${{ github.ref }}
1816 cancel-in-progress : true
19-
2017permissions :
2118 contents : read
22-
2319jobs :
2420 # The OSSF Scorecard publish endpoint enforces a hard contract: the job that
2521 # runs `ossf/scorecard-action` with `publish_results: true` must contain
@@ -33,44 +29,41 @@ jobs:
3329 # uses-only; `check-score` is the gating job that emits the error.
3430 scorecard :
3531 runs-on : ubuntu-latest
32+ timeout-minutes : 15
3633 permissions :
3734 security-events : write
38- id-token : write # For OIDC
35+ id-token : write # For OIDC
3936 steps :
4037 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4138 with :
4239 persist-credentials : false
43-
4440 - name : Run Scorecard
4541 uses : ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
4642 with :
4743 results_file : results.sarif
4844 results_format : sarif
4945 publish_results : true
50-
5146 - name : Upload SARIF
5247 uses : github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
5348 with :
5449 sarif_file : results.sarif
55-
5650 - name : Persist SARIF for downstream score-gate job
5751 uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
5852 with :
5953 name : scorecard-results
6054 path : results.sarif
6155 retention-days : 1
62-
6356 check-score :
6457 needs : scorecard
6558 runs-on : ubuntu-latest
59+ timeout-minutes : 15
6660 permissions :
6761 contents : read
6862 steps :
6963 - name : Download SARIF from scorecard job
7064 uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v5.0.0
7165 with :
7266 name : scorecard-results
73-
7467 - name : Check minimum score
7568 run : |
7669 SCORE=$(jq -r '.runs[0].tool.driver.properties.score // 0' results.sarif 2>/dev/null || echo "0")
@@ -84,20 +77,18 @@ jobs:
8477 echo "::error::Scorecard score $SCORE is below minimum $MIN_SCORE"
8578 exit 1
8679 fi
87-
8880 # Check specific high-priority items
8981 check-critical :
9082 runs-on : ubuntu-latest
83+ timeout-minutes : 15
9184 steps :
9285 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
93-
9486 - name : Check SECURITY.md exists
9587 run : |
9688 if [ ! -f "SECURITY.md" ]; then
9789 echo "::error::SECURITY.md is required"
9890 exit 1
9991 fi
100-
10192 - name : Check for pinned dependencies
10293 run : |
10394 # Check workflows for unpinned actions
0 commit comments