-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (78 loc) · 3.09 KB
/
Copy pathsecurity-audit.yml
File metadata and controls
86 lines (78 loc) · 3.09 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
name: Security Audit (weekly)
# Deep, full-tree security scans on a cron schedule — same rationale as the
# restaurant-app-{frontend,backend} weekly audits: newly-disclosed CVEs land
# against the SAME committed lockfile even when no PR has touched it, scan-DB
# drift is caught, and a full-tree sweep covers code no recent PR exercised.
#
# CADENCE: Mondays 06:00 UTC. Also runnable on demand via workflow_dispatch.
#
# This is a REPORTING gate: a failure does not block any merge (no PR
# context). Triage the finding, then bump the dependency (preferred) or add a
# scoped, justified suppression — exactly as the per-PR gate requires.
#
# SECURITY: no PR context, no untrusted-input expressions in run: blocks;
# third-party actions pinned to immutable commit SHAs (matching ci.yml).
# Read-only permissions. Installs use --ignore-scripts, same rationale as
# ci.yml: no dependency lifecycle script runs in a runner with a token.
on:
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-audit-${{ github.ref }}
cancel-in-progress: true
jobs:
npm_audit:
name: npm audit (high+) — newly-disclosed CVEs vs committed lockfile
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts --prefer-offline --no-audit
- run: npm audit --audit-level=high
osv_scanner:
name: OSV-Scanner (full lockfile sweep)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: google/osv-scanner-action/osv-scanner-action@6fc714450122bda9d00e4ad5d639ad6a39eedb1f # v2.0.1
with:
scan-args: |-
--lockfile=package-lock.json
--format=table
trivy_fs:
name: Trivy filesystem (full-tree misconfig + secrets)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: fs
scan-ref: .
severity: HIGH,CRITICAL
exit-code: '1'
ignore-unfixed: true
gitleaks:
name: gitleaks (full-history secret scan)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Install gitleaks
run: |
GITLEAKS_VERSION=8.21.2
curl -sSfL --proto '=https' --proto-redir '=https' --tlsv1.2 "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
| tar -xzf - -C /tmp gitleaks
sudo mv /tmp/gitleaks /usr/local/bin/gitleaks
- name: Run gitleaks
run: gitleaks detect --verbose --redact --source .