forked from Junirezz/YieldVault-RWA
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (72 loc) · 2.56 KB
/
rust-security.yml
File metadata and controls
87 lines (72 loc) · 2.56 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
name: Dependency Vulnerability Audit
on:
pull_request:
push:
branches:
- main
- develop
jobs:
dependency-audit:
name: Dependency Vulnerability Scan
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: |
backend/package-lock.json
frontend/package-lock.json
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install backend dependencies
run: npm ci
working-directory: backend
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run cargo audit
run: |
cargo audit --ignore RUSTSEC-2026-0097 \
--ignore RUSTSEC-2024-0388 \
--ignore RUSTSEC-2024-0436 \
--json > cargo-audit.json || true
node scripts/dependency-audit.js cargo cargo-audit cargo-audit.json
- name: Run npm audit for backend
run: |
npm audit --json > backend/backend-audit.json || true
node scripts/dependency-audit.js npm backend backend/backend-audit.json
- name: Run npm audit for frontend
run: |
npm audit --json > frontend/frontend-audit.json || true
node scripts/dependency-audit.js npm frontend frontend/frontend-audit.json
- name: Run cargo-clippy (linting)
run: cargo clippy --all-targets --all-features -- -D warnings
continue-on-error: true
- name: Run cargo-deny (supply chain security)
continue-on-error: true
run: |
cargo install cargo-deny
cargo deny check advisories
- name: Check for unsafe code
run: |
echo "🔍 Scanning for unsafe code blocks..."
if grep -r "unsafe {" contracts/vault/src --include="*.rs" | grep -v "test\|fuzz"; then
echo "⚠️ Unsafe code found in non-test code. Please review:"
grep -r "unsafe {" contracts/vault/src --include="*.rs" | grep -v "test\|fuzz"
echo ""
echo "✓ Verify these unsafe blocks are documented and necessary"
else
echo "✓ No unsafe code found in production code"
fi