-
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (49 loc) · 1.53 KB
/
Copy pathcargo-audit.yml
File metadata and controls
49 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# SPDX-License-Identifier: MPL-2.0
# Prevention workflow - audits Rust dependencies for vulnerabilities
name: Cargo Audit
on:
push:
branches: [main]
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
schedule:
- cron: '0 6 * * 1' # Weekly on Monday
permissions: read-all
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo audit
run: cargo audit --deny warnings
- name: Check for unmaintained crates
run: cargo audit --deny unmaintained
# Optional: Create issues for vulnerabilities
create-issue:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: audit
if: failure()
permissions:
issues: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Create vulnerability issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXISTING=$(gh issue list --label "security,dependencies" --state open --json number -q '.[0].number')
if [ -z "$EXISTING" ]; then
gh issue create \
--title "Security: Dependency vulnerabilities detected" \
--body "cargo audit found vulnerabilities. Run \`cargo audit\` locally for details." \
--label "security,dependencies"
fi