-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (100 loc) · 2.7 KB
/
security.yml
File metadata and controls
120 lines (100 loc) · 2.7 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Security Scan
on:
schedule:
# Run weekly on Sunday at midnight
- cron: '0 0 * * 0'
push:
branches: [ main ]
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request:
branches: [ main ]
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# Dependency vulnerability audit
audit:
name: Dependency Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run cargo-audit
run: cargo audit --json > audit-report.json || true
- name: Check for critical vulnerabilities
run: |
if cargo audit 2>&1 | grep -q "CRITICAL"; then
echo "::error::Critical vulnerabilities found!"
cargo audit
exit 1
fi
echo "No critical vulnerabilities found"
- name: Upload audit report
uses: actions/upload-artifact@v7
with:
name: security-audit-report
path: audit-report.json
if: always()
# Dependency license check
license-check:
name: License Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-deny
run: cargo install cargo-deny
- name: Check licenses
run: cargo deny check licenses
continue-on-error: true
# SAST with semgrep
sast:
name: Static Analysis
runs-on: ubuntu-latest
container:
image: semgrep/semgrep
steps:
- uses: actions/checkout@v6
- name: Run Semgrep
run: semgrep ci --config auto --config p/rust --config p/security-audit
env:
SEMGREP_RULES: p/rust p/security-audit
continue-on-error: true
# Check for secrets
secrets-scan:
name: Secrets Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Scan for secrets
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: main
head: HEAD
continue-on-error: true
# Supply chain security
supply-chain:
name: Supply Chain Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-vet
run: cargo install cargo-vet
continue-on-error: true
- name: Check supply chain
run: cargo vet --locked
continue-on-error: true # May not be configured yet