Skip to content

Commit cbc7cdd

Browse files
committed
CI: add cargo-audit
1 parent 31135b0 commit cbc7cdd

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/cargo-audit.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Cargo Audit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
audit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Install Rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
22+
- name: Install cargo-audit
23+
run: cargo install cargo-audit
24+
25+
- name: Run cargo audit
26+
run: cargo audit --json > audit.json || true
27+
28+
- name: Check for critical vulnerabilities
29+
run: |
30+
CRITICAL_COUNT=$(jq '[.vulnerabilities.list[] | select(.advisory.severity == "critical")] | length' audit.json)
31+
echo "Found $CRITICAL_COUNT critical vulnerabilities"
32+
if [ "$CRITICAL_COUNT" -gt 0 ]; then
33+
echo "Critical vulnerabilities detected!"
34+
exit 1
35+
fi

0 commit comments

Comments
 (0)