Skip to content

Commit eb5529b

Browse files
committed
CI hygiene: gate secret dispatch; split scorecard publish from score gate
Address the two remaining high-severity Hypatia workflow-audit findings (both pre-existing): - instant-sync.yml (secret_action_without_presence_gate): gate the peter-evans/repository-dispatch step on FARM_DISPATCH_TOKEN presence via a job-level env + step-level if, so it skips cleanly where the secret is absent instead of running with an empty token. - scorecard-enforcer.yml (scorecard_publish_with_run_step): split the privileged publish job (id-token: write) from the score enforcement. The scorecard job now only analyzes, publishes, and uploads SARIF (no run: steps); a new unprivileged score-gate job (contents: read) re-derives the score read-only and fails on a low score. publish_results does not affect the computed score, so the gate behaviour is unchanged. No new actions introduced (reuses already-pinned actions).
1 parent 728ce37 commit eb5529b

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/instant-sync.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ jobs:
1515
dispatch:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 15
18+
env:
19+
FARM_DISPATCH_TOKEN: ${{ secrets.FARM_DISPATCH_TOKEN }}
1820
steps:
1921
- name: Trigger Propagation
22+
# Presence gate: only dispatch when the secret is configured (e.g.
23+
# skip on forks / environments without FARM_DISPATCH_TOKEN) rather
24+
# than failing the action with an empty token.
25+
if: ${{ env.FARM_DISPATCH_TOKEN != '' }}
2026
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v3
2127
with:
2228
token: ${{ secrets.FARM_DISPATCH_TOKEN }}

.github/workflows/scorecard-enforcer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,29 @@ jobs:
4444
with:
4545
sarif_file: results.sarif
4646

47+
# Unprivileged enforcement gate. Re-derives the score read-only (no
48+
# publish, no id-token) and fails on a low score. Kept separate from the
49+
# privileged `scorecard` publish job above so that arbitrary run: steps
50+
# never execute in a job that holds id-token: write
51+
# (Hypatia: scorecard_publish_with_run_step). publish_results does not
52+
# affect the computed score, so the gate behaviour is unchanged.
53+
score-gate:
54+
runs-on: ubuntu-latest
55+
timeout-minutes: 15
56+
permissions:
57+
contents: read
58+
steps:
59+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
with:
61+
persist-credentials: false
62+
63+
- name: Run Scorecard (analysis only)
64+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
65+
with:
66+
results_file: results.sarif
67+
results_format: sarif
68+
publish_results: false
69+
4770
- name: Check minimum score
4871
run: |
4972
# Parse score from results

0 commit comments

Comments
 (0)