Skip to content

Commit 50852c8

Browse files
authored
fix(ci): pin guardrail actions to SHAs and guard body-file usage (#19232)
Pin actions/checkout and actions/github-script to immutable commit SHAs in scanner-merge-guardrails.yml to prevent supply-chain attacks via tag force-push. Guard --body-file usage in kb-nightly-validation.yml to handle cases where kb-gap-report.md is not generated. Fixes #18643, Fixes #19072 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
1 parent f2865b9 commit 50852c8

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/kb-nightly-validation.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,17 @@ jobs:
127127
else
128128
gh label create "kb-gap" --color "B60205" \
129129
--description "KB coverage gap detected by nightly validation" 2>/dev/null || true
130-
gh issue create \
131-
--title "$TITLE" \
132-
--label "kb-gap,triage/needed,help wanted" \
133-
--body-file kb-gap-report.md
130+
if [ -f kb-gap-report.md ]; then
131+
gh issue create \
132+
--title "$TITLE" \
133+
--label "kb-gap,triage/needed,help wanted" \
134+
--body-file kb-gap-report.md
135+
else
136+
gh issue create \
137+
--title "$TITLE" \
138+
--label "kb-gap,triage/needed,help wanted" \
139+
--body "KB Nightly Validation failed. No gap report was generated. See workflow run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
140+
fi
134141
fi
135142
136143
- name: Upload reports

.github/workflows/scanner-merge-guardrails.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121

2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v6
24+
uses: actions/checkout@eef61447b9ff4aafe5dcd72e0a28fef7ff2e8c5d # v6.4.0
2525

2626
- name: Check Scanner Merge Eligibility
2727
id: check
28-
uses: actions/github-script@v9
28+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
2929
with:
3030
script: |
3131
const fs = require('fs');

0 commit comments

Comments
 (0)