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
@@ -36,31 +32,27 @@ jobs:
3632 timeout-minutes : 15
3733 permissions :
3834 security-events : write
39- id-token : write # For OIDC
35+ id-token : write # For OIDC
4036 steps :
4137 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4238 with :
4339 persist-credentials : false
44-
4540 - name : Run Scorecard
4641 uses : ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
4742 with :
4843 results_file : results.sarif
4944 results_format : sarif
5045 publish_results : true
51-
5246 - name : Upload SARIF
5347 uses : github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
5448 with :
5549 sarif_file : results.sarif
56-
5750 - name : Persist SARIF for downstream score-gate job
5851 uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
5952 with :
6053 name : scorecard-results
6154 path : results.sarif
6255 retention-days : 1
63-
6456 check-score :
6557 needs : scorecard
6658 runs-on : ubuntu-latest
7264 uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v5.0.0
7365 with :
7466 name : scorecard-results
75-
7667 - name : Check minimum score
7768 run : |
7869 SCORE=$(jq -r '.runs[0].tool.driver.properties.score // 0' results.sarif 2>/dev/null || echo "0")
@@ -86,21 +77,18 @@ jobs:
8677 echo "::error::Scorecard score $SCORE is below minimum $MIN_SCORE"
8778 exit 1
8879 fi
89-
9080 # Check specific high-priority items
9181 check-critical :
9282 runs-on : ubuntu-latest
9383 timeout-minutes : 15
9484 steps :
9585 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96-
9786 - name : Check SECURITY.md exists
9887 run : |
9988 if [ ! -f "SECURITY.md" ]; then
10089 echo "::error::SECURITY.md is required"
10190 exit 1
10291 fi
103-
10492 - name : Check for pinned dependencies
10593 run : |
10694 # Check workflows for unpinned actions
0 commit comments