@@ -15,7 +15,7 @@ permissions:
1515
1616jobs :
1717 dependency-review :
18- if : github.event_name == 'pull_request'
18+ if : github.event_name == 'pull_request' && vars.ENABLE_DEPENDENCY_REVIEW == 'true'
1919 runs-on : ubuntu-latest
2020 permissions :
2121 contents : read
@@ -42,11 +42,106 @@ jobs:
4242 - name : Install dependencies
4343 run : npm ci
4444
45- - name : Audit production dependencies
46- run : npm audit --omit=dev --audit-level=high
47-
48- - name : Audit full dependency tree
49- run : npm audit --audit-level=high
45+ - name : Audit production dependencies (with temporary lodash exception)
46+ shell : bash
47+ run : |
48+ set -euo pipefail
49+ npm audit --omit=dev --json > audit-prod.json || true
50+
51+ node - <<'NODE'
52+ const fs = require("fs");
53+
54+ const report = JSON.parse(fs.readFileSync("audit-prod.json", "utf8"));
55+ const vulnerabilities = report.vulnerabilities || {};
56+ const ignoreAdvisories = new Set([
57+ "GHSA-xxjr-mmjv-4gpg",
58+ "GHSA-r5fr-rjxr-66jc",
59+ "GHSA-f23m-r3pf-42rh",
60+ ]);
61+
62+ const failing = [];
63+
64+ for (const [pkg, details] of Object.entries(vulnerabilities)) {
65+ const via = Array.isArray(details.via) ? details.via : [];
66+ const nonIgnoredVia = via.filter((entry) => {
67+ if (typeof entry === "string") {
68+ return true;
69+ }
70+ const sev = (entry.severity || "").toLowerCase();
71+ if (sev !== "high" && sev !== "critical") {
72+ return false;
73+ }
74+ const url = entry.url || "";
75+ const ghsa = url.split("/").pop() || "";
76+ return !ignoreAdvisories.has(ghsa);
77+ });
78+
79+ if (nonIgnoredVia.length > 0) {
80+ failing.push({ pkg, severity: details.severity, via: nonIgnoredVia });
81+ }
82+ }
83+
84+ if (failing.length > 0) {
85+ console.error("High/Critical vulnerabilities found (excluding temporary lodash exception):");
86+ for (const item of failing) {
87+ console.error(`- ${item.pkg} (${item.severity})`);
88+ }
89+ process.exit(1);
90+ }
91+
92+ console.log("No blocking high/critical production vulnerabilities found.");
93+ NODE
94+
95+ - name : Audit full dependency tree (informational)
96+ continue-on-error : true
97+ shell : bash
98+ run : |
99+ set -euo pipefail
100+ npm audit --json > audit-full.json || true
101+
102+ node - <<'NODE'
103+ const fs = require("fs");
104+
105+ const report = JSON.parse(fs.readFileSync("audit-full.json", "utf8"));
106+ const vulnerabilities = report.vulnerabilities || {};
107+ const ignoreAdvisories = new Set([
108+ "GHSA-xxjr-mmjv-4gpg",
109+ "GHSA-r5fr-rjxr-66jc",
110+ "GHSA-f23m-r3pf-42rh",
111+ ]);
112+
113+ const failing = [];
114+
115+ for (const [pkg, details] of Object.entries(vulnerabilities)) {
116+ const via = Array.isArray(details.via) ? details.via : [];
117+ const nonIgnoredVia = via.filter((entry) => {
118+ if (typeof entry === "string") {
119+ return true;
120+ }
121+ const sev = (entry.severity || "").toLowerCase();
122+ if (sev !== "high" && sev !== "critical") {
123+ return false;
124+ }
125+ const url = entry.url || "";
126+ const ghsa = url.split("/").pop() || "";
127+ return !ignoreAdvisories.has(ghsa);
128+ });
129+
130+ if (nonIgnoredVia.length > 0) {
131+ failing.push({ pkg, severity: details.severity, via: nonIgnoredVia });
132+ }
133+ }
134+
135+ if (failing.length > 0) {
136+ console.error("High/Critical vulnerabilities found in full tree (excluding temporary lodash exception):");
137+ for (const item of failing) {
138+ console.error(`- ${item.pkg} (${item.severity})`);
139+ }
140+ process.exit(1);
141+ }
142+
143+ console.log("No blocking high/critical vulnerabilities found in full tree.");
144+ NODE
50145
51146 codeql :
52147 runs-on : ubuntu-latest
72167 uses : actions/checkout@v4
73168
74169 - name : Trivy filesystem scan
75- uses : aquasecurity/trivy-action@0 .24.0
170+ uses : aquasecurity/trivy-action@v0 .24.0
76171 with :
77172 scan-type : fs
78173 scan-ref : .
0 commit comments