-
Notifications
You must be signed in to change notification settings - Fork 125
105 lines (90 loc) · 2.75 KB
/
Copy pathdependency-audit.yml
File metadata and controls
105 lines (90 loc) · 2.75 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
name: Dependency Security Audit
on:
push:
branches: [main]
paths:
- 'frontend/package.json'
- 'frontend/package-lock.json'
- 'contracts/**/Cargo.toml'
- 'contracts/**/Cargo.lock'
- 'deny.toml'
- '.github/npm-audit-allowlist.json'
- '.github/scripts/check-npm-audit.mjs'
- '.github/workflows/dependency-audit.yml'
pull_request:
branches: [main]
paths:
- 'frontend/package.json'
- 'frontend/package-lock.json'
- 'contracts/**/Cargo.toml'
- 'contracts/**/Cargo.lock'
- 'deny.toml'
- '.github/npm-audit-allowlist.json'
- '.github/scripts/check-npm-audit.mjs'
- '.github/workflows/dependency-audit.yml'
schedule:
- cron: '0 3 * * *'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
npm:
name: npm audit
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Gate production dependencies (no high or critical)
run: npm audit --omit=dev --audit-level=high
- name: Audit full dependency tree
id: npm_audit
run: npm audit --json > "$RUNNER_TEMP/npm-audit.json" || true
- name: Enforce advisory allowlist
run: |
node "$GITHUB_WORKSPACE/.github/scripts/check-npm-audit.mjs" \
--input "$RUNNER_TEMP/npm-audit.json" \
--allowlist "$GITHUB_WORKSPACE/.github/npm-audit-allowlist.json"
cargo:
name: cargo deny (${{ matrix.crate }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate:
- escrow
- retainer
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
contracts/${{ matrix.crate }}/target/
key: ${{ runner.os }}-cargo-deny-${{ format('contracts/{0}/Cargo.lock', matrix.crate) }}
restore-keys: |
${{ runner.os }}-cargo-deny-
- name: Check Rust advisories (RUSTSEC)
uses: EmbarkStudios/cargo-deny-action@v2
with:
manifest-path: contracts/${{ matrix.crate }}/Cargo.toml
command-arguments: advisories