-
Notifications
You must be signed in to change notification settings - Fork 15
63 lines (54 loc) · 2.29 KB
/
Copy pathsecurity-audit.yml
File metadata and controls
63 lines (54 loc) · 2.29 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
name: Security Audit
on:
push:
branches: [main]
pull_request:
branches: [main]
# Run on a weekly schedule so newly-disclosed CVEs in existing
# dependencies are surfaced even when there are no code changes.
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
jobs:
audit:
name: npm audit (dependencies)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Wix gateway proxy (mandatory)
uses: ./.github/actions/wix-gateway-proxy
- name: Use Node.js 20.x
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "20.x"
cache: "npm"
- name: Install dependencies
run: npm ci
# The embargo gateway does not carry npm's advisory API. npm POSTs to
# /-/npm/v1/security/advisories/bulk, that fails through the gateway, and
# the fallback to the retired /-/npm/v1/security/audits/quick answers 400
# ("Invalid request payload JSON format"), so both steps below exit 1
# before reading a single advisory. Every run since the gateway landed in
# #248 has failed this way; the last green one predates it.
#
# Auditing downloads no package code, so resolving the registry publicly
# here costs nothing: the install above already ran through the gateway,
# and it is the only step that fetches tarballs. Remove this once the
# gateway proxies the advisory endpoints.
- name: Unpin the registry for the advisory API
run: |
sudo sed -i "/registry\.npmjs\.org/d" /etc/hosts
getent hosts registry.npmjs.org
# Gating check: fail the build on high/critical vulnerabilities in
# the production dependencies declared in package.json. These are the
# ones that ship to consumers of the SDK (and show up in their Wiz
# scans), so they get the strictest treatment.
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=high
# Informational: report the full picture (including dev/transitive
# dependencies) without failing the build.
- name: Audit all dependencies (report only)
if: always()
run: npm audit
continue-on-error: true