-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (63 loc) · 2.69 KB
/
Copy pathdependency-security.yml
File metadata and controls
77 lines (63 loc) · 2.69 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
name: Dependency Security
# Runs on every PR and every push to main.
# Hard-blocks on Critical npm vulnerabilities.
# Warns on High npm vulnerabilities (non-blocking — devDep false positives are common).
# Tauri/cargo audit is not run — desktop releases are retired.
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
# ── npm audit ──────────────────────────────────────────────────────────────
npm-audit:
name: npm audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
# No cache: npm — package-lock.json is gitignored in this project.
# Generate lockfile on the fly so npm audit has a full dependency graph.
# Consider committing package-lock.json for faster, deterministic CI.
- name: Generate lockfile
run: npm install --package-lock-only --ignore-scripts
# Hard block — Critical vulns in production dependencies.
- name: Fail on Critical vulnerabilities
run: npm audit --audit-level=critical --omit=dev
# Soft check — High vulns across all deps (informational; common in devDeps).
- name: Warn on High vulnerabilities
run: npm audit --audit-level=high || echo "⚠️ High-severity advisories found — review npm-audit-full.json"
# Upload full JSON report as a build artifact for manual review.
- name: Save full audit report
if: always()
run: npm audit --json > npm-audit-full.json || true
- name: Upload audit report
if: always()
uses: actions/upload-artifact@v5
with:
name: npm-audit-report
path: npm-audit-full.json
retention-days: 30
# ── ESLint security rules ──────────────────────────────────────────────────
eslint-security:
name: ESLint security
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
- name: Install dependencies
run: npm install --ignore-scripts
# Errors (inject/eval/ReDoS) cause non-zero exit and block the PR.
# Warnings (detect-non-literal-fs-filename) are informational — legitimate
# server/CLI filesystem operations use variable paths by design.
- name: Run ESLint security rules
run: npx eslint .