Skip to content

Commit a8f8eca

Browse files
committed
ci: add security.yml workflow
1 parent a391271 commit a8f8eca

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/security.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
2+
3+
name: Security
4+
5+
on:
6+
pull_request:
7+
branches: [main]
8+
paths:
9+
- "Cargo.toml"
10+
- "Cargo.lock"
11+
- "**/Cargo.toml"
12+
- ".github/workflows/security.yml"
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
jobs:
19+
dependency-review:
20+
name: Dependency Review
21+
runs-on: ubuntu-latest
22+
if: github.actor != 'dependabot[bot]'
23+
permissions:
24+
contents: read
25+
pull-requests: write
26+
steps:
27+
- name: Harden the runner (Audit all outbound calls)
28+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
29+
with:
30+
egress-policy: audit
31+
32+
- name: Checkout code
33+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
34+
35+
- name: Dependency Review
36+
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
37+
with:
38+
fail-on-severity: high
39+
comment-summary-in-pr: always
40+
41+
# Security scan summary - aggregates all security job results
42+
security-summary:
43+
name: Security Summary
44+
needs: [dependency-review]
45+
runs-on: ubuntu-latest
46+
if: always()
47+
permissions:
48+
contents: read
49+
steps:
50+
- name: Harden the runner (Audit all outbound calls)
51+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
52+
with:
53+
egress-policy: audit
54+
55+
- name: Check security scan results
56+
env:
57+
DEPENDENCY_REVIEW_RESULT: ${{ needs.dependency-review.result }}
58+
run: |
59+
echo "## Security Scan Results"
60+
echo ""
61+
echo "| Scanner | Status |"
62+
echo "|---------|--------|"
63+
echo "| Dependency Review | $DEPENDENCY_REVIEW_RESULT |"
64+
echo ""
65+
66+
# Fail if any security job failed
67+
if [[ "$DEPENDENCY_REVIEW_RESULT" != "success" && "$DEPENDENCY_REVIEW_RESULT" != "skipped" ]]; then
68+
echo "❌ Security checks failed"
69+
exit 1
70+
fi
71+
72+
echo "✅ All security checks passed!"

0 commit comments

Comments
 (0)