Skip to content

Commit f9a00e7

Browse files
Add supply-chain security baseline
1 parent c8d98a6 commit f9a00e7

1 file changed

Lines changed: 50 additions & 4 deletions

File tree

.github/workflows/security-baseline.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ concurrency:
2020
jobs:
2121
osv:
2222
name: OSV vulnerability scan
23-
runs-on: ubuntu-latest
23+
runs-on: ${{ vars['SUPPLY_CHAIN_SENTINEL_RUNNER'] || 'ubuntu-latest' }}
2424
permissions:
2525
contents: read
2626
steps:
@@ -38,7 +38,7 @@ jobs:
3838
3939
secrets:
4040
name: Secret scan
41-
runs-on: ubuntu-latest
41+
runs-on: ${{ vars['SUPPLY_CHAIN_SENTINEL_RUNNER'] || 'ubuntu-latest' }}
4242
steps:
4343
- name: Checkout repository
4444
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -55,7 +55,7 @@ jobs:
5555

5656
workflow-lint:
5757
name: GitHub Actions lint
58-
runs-on: ubuntu-latest
58+
runs-on: ${{ vars['SUPPLY_CHAIN_SENTINEL_RUNNER'] || 'ubuntu-latest' }}
5959
steps:
6060
- name: Checkout repository
6161
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -77,7 +77,7 @@ jobs:
7777
7878
workflow-security:
7979
name: GitHub Actions security lint
80-
runs-on: ubuntu-latest
80+
runs-on: ${{ vars['SUPPLY_CHAIN_SENTINEL_RUNNER'] || 'ubuntu-latest' }}
8181
permissions:
8282
actions: read
8383
contents: read
@@ -128,3 +128,49 @@ jobs:
128128
done
129129
env:
130130
GH_TOKEN: ${{ github.token }}
131+
132+
summary:
133+
name: Security Baseline summary
134+
needs:
135+
- osv
136+
- secrets
137+
- workflow-lint
138+
- workflow-security
139+
if: ${{ always() }}
140+
runs-on: ${{ vars['SUPPLY_CHAIN_SENTINEL_RUNNER'] || 'ubuntu-latest' }}
141+
permissions:
142+
contents: read
143+
steps:
144+
- name: Summarize security baseline checks
145+
env:
146+
OSV_RESULT: ${{ needs.osv.result }}
147+
SECRETS_RESULT: ${{ needs.secrets.result }}
148+
WORKFLOW_LINT_RESULT: ${{ needs['workflow-lint'].result }}
149+
WORKFLOW_SECURITY_RESULT: ${{ needs['workflow-security'].result }}
150+
run: |
151+
format_result() {
152+
case "$1" in
153+
success) printf '%s' "✅ success" ;;
154+
skipped) printf '%s' "⏭️ skipped" ;;
155+
cancelled) printf '%s' "⚠️ cancelled" ;;
156+
*) printf '%s' "❌ $1" ;;
157+
esac
158+
}
159+
160+
{
161+
echo "## Security Baseline"
162+
echo ""
163+
echo "| Check | Purpose | Result |"
164+
echo "| --- | --- | --- |"
165+
echo "| OSV vulnerability scan | Dependency advisory scan across the repository | $(format_result "$OSV_RESULT") |"
166+
echo "| Secret scan | Verified and unknown secret detection with TruffleHog | $(format_result "$SECRETS_RESULT") |"
167+
echo "| GitHub Actions lint | Workflow syntax and shell lint via actionlint | $(format_result "$WORKFLOW_LINT_RESULT") |"
168+
echo "| GitHub Actions security lint | High-severity workflow security findings via zizmor | $(format_result "$WORKFLOW_SECURITY_RESULT") |"
169+
} >> "$GITHUB_STEP_SUMMARY"
170+
171+
if [ "$OSV_RESULT" != "success" ] ||
172+
[ "$SECRETS_RESULT" != "success" ] ||
173+
[ "$WORKFLOW_LINT_RESULT" != "success" ] ||
174+
[ "$WORKFLOW_SECURITY_RESULT" != "success" ]; then
175+
exit 1
176+
fi

0 commit comments

Comments
 (0)