vigievuln 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1052
- package/README.md +36 -69
- package/lib/artifacts/applications.js +6 -2
- package/lib/artifacts/component-scope.js +54 -0
- package/lib/artifacts/enrichment.js +1 -0
- package/lib/artifacts/inventory-scope.js +51 -0
- package/lib/artifacts/report-inventory.js +5 -1
- package/lib/artifacts/report.js +28 -8
- package/lib/artifacts/retire.js +80 -0
- package/lib/artifacts/scan.js +39 -21
- package/lib/charts.js +20 -3
- package/lib/cli-image.js +5 -0
- package/lib/cve-record-coverage.js +109 -0
- package/lib/cve-report.js +111 -29
- package/lib/diagnostics.js +14 -1
- package/lib/diff.js +0 -0
- package/lib/euvd.js +6 -2
- package/lib/finding-enrichment.js +8 -7
- package/lib/finding-summary.js +1 -1
- package/lib/i18n.js +16 -1
- package/lib/image-references.js +21 -1
- package/lib/json-export.js +6 -4
- package/lib/nvd.js +52 -16
- package/lib/providers/index.js +6 -6
- package/lib/report-notices.js +38 -3
- package/lib/retire.js +12 -10
- package/lib/source-health.js +47 -23
- package/lib/source-image-scan.js +1 -0
- package/lib/system-inventory/advisories.js +7 -6
- package/lib/system-inventory/alpine-tracker.js +5 -5
- package/lib/system-inventory/collect.js +1 -1
- package/lib/system-inventory/distribution-sources.js +2 -2
- package/lib/system-inventory/nginx-advisories.js +26 -8
- package/package.json +1 -1
- package/vigievuln.js +32 -16
package/lib/cve-report.js
CHANGED
|
@@ -99,8 +99,10 @@ function computeStats(cveMatches) {
|
|
|
99
99
|
const sev = (m.cve.severity || "UNKNOWN").toLowerCase();
|
|
100
100
|
if (buckets[sev] != null) buckets[sev]++;
|
|
101
101
|
else buckets.unknown++;
|
|
102
|
-
if (m.dep?.
|
|
103
|
-
|
|
102
|
+
if (!m.dep?.artifactTargetId) {
|
|
103
|
+
if (m.dep?.scope === "transitive") buckets.transitive++;
|
|
104
|
+
else buckets.direct++;
|
|
105
|
+
}
|
|
104
106
|
if (m.cve?.kev) buckets.kev++;
|
|
105
107
|
}
|
|
106
108
|
buckets.total = (cveMatches || []).length;
|
|
@@ -213,6 +215,7 @@ h2 { margin: 32px 0 12px; font-size: 20px; border-bottom: 2px solid #e5e7eb; pad
|
|
|
213
215
|
they scale identically and stay the SAME size whatever the legend length.
|
|
214
216
|
The copy button overlays the top-right. */
|
|
215
217
|
.charts-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 18px; align-items: stretch; }
|
|
218
|
+
.charts-heading { margin: 18px 0 0; font-size: 15px; color: #374151; }
|
|
216
219
|
.charts-row .chart-card { min-width: 0; min-height: 250px; box-sizing: border-box; position: relative; margin: 0; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
|
|
217
220
|
.charts-row .chart-copy { position: absolute; top: 6px; right: 8px; padding: 2px 7px; font-size: 11px; z-index: 1; }
|
|
218
221
|
.charts-row .chart-svg { display: block; width: 100%; height: 250px; }
|
|
@@ -246,6 +249,7 @@ h2 { margin: 32px 0 12px; font-size: 20px; border-bottom: 2px solid #e5e7eb; pad
|
|
|
246
249
|
.exec-summary .exec-top-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #6b7280; margin-bottom: 6px; }
|
|
247
250
|
.exec-summary .exec-top-list { list-style: none; padding: 0; margin: 0; font-size: 12px; }
|
|
248
251
|
.exec-summary .exec-top-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 3px 0; font-family: ui-monospace, monospace; }
|
|
252
|
+
.exec-summary .exec-top-list .exec-image-cve { white-space: nowrap; }
|
|
249
253
|
.exec-summary .exec-cwes-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
|
|
250
254
|
.exec-summary .exec-cve-link { color: #1d4ed8; text-decoration: none; font-weight: 600; }
|
|
251
255
|
.exec-summary .exec-cve-link:hover { text-decoration: underline; }
|
|
@@ -1088,6 +1092,17 @@ function formatCwesVerbose(cwes) {
|
|
|
1088
1092
|
}).join("")}</ul>`;
|
|
1089
1093
|
}
|
|
1090
1094
|
|
|
1095
|
+
let detailPool = null;
|
|
1096
|
+
function sharedDetailPanel(m, opts) {
|
|
1097
|
+
const html = renderDetailPanel(m, opts);
|
|
1098
|
+
if (!detailPool) return html;
|
|
1099
|
+
const existing = detailPool.get(html);
|
|
1100
|
+
if (existing) return `<div data-detail-ref="${existing}"><a href="#${existing}">${esc(m.cve.id)}</a></div>`;
|
|
1101
|
+
const id = `shared-cve-detail-${detailPool.size + 1}`;
|
|
1102
|
+
detailPool.set(html, id);
|
|
1103
|
+
return `<div id="${id}">${html}</div>`;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1091
1106
|
function renderCveRow(m, opts = {}) {
|
|
1092
1107
|
const { withAction } = opts;
|
|
1093
1108
|
const advisoryId = String(m.cve.id || "");
|
|
@@ -1118,7 +1133,7 @@ function renderCveRow(m, opts = {}) {
|
|
|
1118
1133
|
<td>${source}</td>
|
|
1119
1134
|
${actionCell}
|
|
1120
1135
|
</tr>
|
|
1121
|
-
<tr class="detail-row"><td colspan="${colspan}">${
|
|
1136
|
+
<tr class="detail-row"><td colspan="${colspan}">${sharedDetailPanel(m, opts)}</td></tr>`;
|
|
1122
1137
|
}
|
|
1123
1138
|
|
|
1124
1139
|
function renderActionCell(m) {
|
|
@@ -1673,7 +1688,7 @@ function summaryCards(stats, eol, obs, out, extra = {}) {
|
|
|
1673
1688
|
{ v: extra.imageCount, l: t("Image findings") },
|
|
1674
1689
|
...(extra.sourceCount ? [{ v: extra.sourceCount, l: t("Source findings") }] : []),
|
|
1675
1690
|
...(extra.sourceCount ? [{ v: extra.sourceStats.direct, l: t("in Direct") }, { v: extra.sourceStats.transitive, l: t("in Transitive") }] : []),
|
|
1676
|
-
] : [{ v: stats.direct, l: t("in Direct") }, { v: stats.transitive, l: t("in Transitive") }]),
|
|
1691
|
+
] : extra.hasSourceProject === false ? [] : [{ v: stats.direct, l: t("in Direct") }, { v: stats.transitive, l: t("in Transitive") }]),
|
|
1677
1692
|
{ v: extra.vendored ?? 0, l: t("Vendored JS"), cls: "sev-vendored" },
|
|
1678
1693
|
{ v: eol?.length || 0, l: t("EOL") },
|
|
1679
1694
|
{ v: obs?.length || 0, l: t("Obsolete") },
|
|
@@ -1695,7 +1710,7 @@ function mergeMatches(matches) {
|
|
|
1695
1710
|
for (const m of matches) {
|
|
1696
1711
|
// A finding with a physical occurrence ID must never be merged with a
|
|
1697
1712
|
// different installation of the same package and version.
|
|
1698
|
-
const key = m.findingId || JSON.stringify([m.dep.artifactTargetId || "", m.dep.coordKey || `${m.dep.groupId}:${m.dep.artifactId}`, m.dep.version, m.dep.artifactTargetId ? m.dep.artifactPath : "", m.cve.id]);
|
|
1713
|
+
const key = m.findingId ? JSON.stringify([m.dep.artifactTargetId || "", m.findingId]) : JSON.stringify([m.dep.artifactTargetId || "", m.dep.coordKey || `${m.dep.groupId}:${m.dep.artifactId}`, m.dep.version, m.dep.artifactTargetId ? m.dep.artifactPath : "", m.cve.id]);
|
|
1699
1714
|
if (!byKey.has(key)) {
|
|
1700
1715
|
// Deep-ish copy so we can mutate dep.viaPaths
|
|
1701
1716
|
byKey.set(key, { ...m, dep: { ...m.dep, viaPaths: m.dep.viaPaths ? [...m.dep.viaPaths] : (m.dep.via ? [m.dep.via] : []) } });
|
|
@@ -2006,8 +2021,12 @@ function numberedSubsections(chapter, entries) {
|
|
|
2006
2021
|
}
|
|
2007
2022
|
|
|
2008
2023
|
const WARNING_HEADINGS = {
|
|
2024
|
+
"image-unpinned": { icon: "⚠️", title: "Image references without a digest" },
|
|
2025
|
+
"cve-enrichment-summary": { icon: "ℹ️", title: "CVE records" },
|
|
2009
2026
|
"image-scan-failed": { icon: "⚠️", title: "Image analysis blocked" },
|
|
2010
|
-
"
|
|
2027
|
+
"image-source-unavailable": { icon: "⚠️", title: "Unavailable from public sources" },
|
|
2028
|
+
"source-unavailable": { icon: "⚠️", title: "Source data unavailable" },
|
|
2029
|
+
"no-lockfile": { icon: "⚠️", title: "Manifests without a lockfile — best-effort" },
|
|
2011
2030
|
"parse-error": { icon: "⚠️", title: "Manifests that failed to parse — contents not scanned" },
|
|
2012
2031
|
"yarn-berry-unsupported": { icon: "⚠️", title: "Yarn 2+/Berry lockfile" },
|
|
2013
2032
|
"unresolved-versions": { icon: "⚠️", title: "Maven deps without a concrete version — silently skipped, run a real Maven/Snyk scan to complete" },
|
|
@@ -2167,7 +2186,7 @@ function execWeakness(m) {
|
|
|
2167
2186
|
return m.cve.id || t("an unspecified weakness");
|
|
2168
2187
|
}
|
|
2169
2188
|
|
|
2170
|
-
function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, nativeBinaryCount = 0, hasImages = false, interactive = false }) {
|
|
2189
|
+
function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, topImageMatches, nativeBinaryCount = 0, hasImages = false, interactive = false }) {
|
|
2171
2190
|
const unsN = (eolResults || []).filter(e => e.status === "unsupported").length;
|
|
2172
2191
|
const eolN = (eolResults?.length || 0) - unsN; // true end-of-life only
|
|
2173
2192
|
const obsN = obsoleteResults?.length || 0;
|
|
@@ -2183,6 +2202,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2183
2202
|
else if (prodStats.total > 0) level = "UNKNOWN";
|
|
2184
2203
|
|
|
2185
2204
|
const top = topCriticalMatches || [];
|
|
2205
|
+
const imageTop = topImageMatches || [];
|
|
2186
2206
|
const topEol = pickTopEol(eolResults, 2);
|
|
2187
2207
|
|
|
2188
2208
|
const cweChipHtml = (id, name) => `<span class="exec-cwe" title="${esc(id)}${name ? ": " + esc(name) : ""}"><span class="exec-cwe-id">${esc(id)}</span>${name ? `<span class="exec-cwe-name">${esc(name)}</span>` : ""}</span>`;
|
|
@@ -2190,9 +2210,9 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2190
2210
|
// ---- Block 1: the 3 most critical (direct prod, transitive fallback) ----
|
|
2191
2211
|
// Each row lists ALL of its CWEs right beside it (the weakness fingerprint
|
|
2192
2212
|
// of that specific finding) — NOT a separate report-wide CWE aggregate.
|
|
2193
|
-
const
|
|
2194
|
-
<div class="exec-top-title">${
|
|
2195
|
-
<ul class="exec-top-list">${
|
|
2213
|
+
const renderTop = (entries, heading) => entries.length ? `<div class="exec-top">
|
|
2214
|
+
<div class="exec-top-title">${heading}</div>
|
|
2215
|
+
<ul class="exec-top-list">${entries.map(m => {
|
|
2196
2216
|
const cwes = Array.isArray(m.cve.cwes) ? m.cve.cwes : [];
|
|
2197
2217
|
const cweChips = cwes.length ? `<span class="exec-cwes-chips">${cwes.map(c => cweChipHtml(c, cweName(c))).join("")}</span>` : "";
|
|
2198
2218
|
const transitiveTag = !m.dep?.artifactTargetId && m.dep?.scope === "transitive"
|
|
@@ -2208,6 +2228,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2208
2228
|
</li>`;
|
|
2209
2229
|
}).join("")}</ul>
|
|
2210
2230
|
</div>` : "";
|
|
2231
|
+
const topBlock = renderTop(top, hasImages ? t("Top {n} most critical · production findings", { n: top.length }) : t("Top {n} most critical · direct production dependencies", { n: top.length }));
|
|
2232
|
+
const imageHeading = t("Top {n} most critical · images to update", { n: imageTop.length });
|
|
2233
|
+
const imageLine = group => {
|
|
2234
|
+
const artifact = group.artifact, update = artifact.imageUpdate;
|
|
2235
|
+
const target = update?.status === 'available' && update.targetTag && update.targetReference ? update.targetReference : null;
|
|
2236
|
+
return { title: require('./artifacts/report').artifactTitle(artifact, projectInfo?.artifacts || []), target, matches: group.matches };
|
|
2237
|
+
};
|
|
2238
|
+
const imageLines = imageTop.map(imageLine);
|
|
2239
|
+
const imageTopBlock = imageLines.length ? `<div class="exec-top"><div class="exec-top-title">${esc(imageHeading)}</div><ul class="exec-top-list">${imageLines.map((group, i) => `<li><a class="exec-cve-link" href="#${require('./artifacts/report').artifactAnchor(imageTop[i].artifact.id)}">${esc(group.title)}</a>${group.target ? ` <span class="exec-fix">${t('Image update candidate')}: <code>${esc(group.target)}</code></span>` : ''}<span>${group.matches.map(m => `${badge((m.cve.severity || 'UNKNOWN').toUpperCase())} <a class="exec-cve-link exec-image-cve" href="#chimages-cves">${esc(m.cve.id)}</a> ${(m.cve.cwes || []).map(c => cweChipHtml(c, cweName(c))).join('')}`).join(' · ')}</span></li>`).join('')}</ul></div>` : '';
|
|
2211
2240
|
|
|
2212
2241
|
// ---- Block 2: the 2 most-overdue end-of-life frameworks ----
|
|
2213
2242
|
const eolWhen = e => e.status === "unsupported"
|
|
@@ -2225,7 +2254,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2225
2254
|
|
|
2226
2255
|
// ---- Block 3: totals, including the findings highlighted above ----
|
|
2227
2256
|
const restParts = [];
|
|
2228
|
-
if (prodStats.total) restParts.push(`<strong>${prodStats.total}</strong> ${t("production CVE")} (critical=${prodStats.critical}, high=${prodStats.high}, medium=${prodStats.medium}, low=${prodStats.low})`);
|
|
2257
|
+
if (prodStats.total) restParts.push(`<strong>${prodStats.total}</strong> ${t(hasImages ? "CVE findings" : "production CVE")} (critical=${prodStats.critical}, high=${prodStats.high}, medium=${prodStats.medium}, low=${prodStats.low})`);
|
|
2229
2258
|
if (devStats.total) restParts.push(`<strong>${devStats.total}</strong> ${t("dev/test CVE")}`);
|
|
2230
2259
|
if (retireStats.total) restParts.push(`<strong>${retireStats.total}</strong> ${t("vulnerable vendored-JS")}`);
|
|
2231
2260
|
if (eolN) restParts.push(`<strong>${eolN}</strong> ${eolN > 1 ? t("EOL frameworks") : t("EOL framework")}`);
|
|
@@ -2242,13 +2271,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2242
2271
|
let copyUi = "";
|
|
2243
2272
|
if (interactive) {
|
|
2244
2273
|
const stripTags = s => s.replace(/<[^>]+>/g, "");
|
|
2245
|
-
const
|
|
2274
|
+
const sentences = entries => entries.map(m => ({
|
|
2246
2275
|
lib: depDisplayName(m.dep),
|
|
2247
2276
|
ver: m.dep.version || "?",
|
|
2248
2277
|
weakness: execWeakness(m),
|
|
2249
2278
|
crit: (m.cve.severity || "HIGH").toUpperCase(),
|
|
2250
2279
|
transitive: !m.dep?.artifactTargetId && m.dep?.scope === "transitive",
|
|
2251
2280
|
}));
|
|
2281
|
+
const topSentences = sentences(top);
|
|
2282
|
+
const imageSentences = imageLines.map(group => `${group.title}${group.target ? ` — ${t("Image update candidate")}: ${group.target}` : ""} — ${group.matches.map(m => `${m.cve.id} (${m.cve.severity || "UNKNOWN"})`).join(", ")}`);
|
|
2252
2283
|
const eolSentence = e => {
|
|
2253
2284
|
const when = e.eol && e.eol !== "true" ? t("end-of-life since {date}", { date: e.eol }) : t("end-of-life");
|
|
2254
2285
|
const head = t('"{product}" ({dep}) is {when}', {
|
|
@@ -2271,6 +2302,10 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2271
2302
|
plainLines.push("", critHeading(topSentences.length));
|
|
2272
2303
|
for (const x of topSentences) plainLines.push(`- ${critSentence(x)}${x.transitive ? ` [${t("transitive")}]` : ""}`);
|
|
2273
2304
|
}
|
|
2305
|
+
if (imageSentences.length) {
|
|
2306
|
+
plainLines.push("", imageHeading);
|
|
2307
|
+
for (const x of imageSentences) plainLines.push(`- ${x}`);
|
|
2308
|
+
}
|
|
2274
2309
|
if (topEol.length) {
|
|
2275
2310
|
plainLines.push("", eolHeading(topEol.length));
|
|
2276
2311
|
for (const e of topEol) plainLines.push(eolSentence(e));
|
|
@@ -2282,9 +2317,9 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2282
2317
|
// The rich flavour bolds the values, so the sentence is translated with placeholder
|
|
2283
2318
|
// markers and the markers are then replaced by the bolded values. Building it by
|
|
2284
2319
|
// concatenation instead would hard-code English word order.
|
|
2285
|
-
const
|
|
2286
|
-
? `<p style="font-weight:bold; margin:12px 0 4px;">${esc(
|
|
2287
|
-
<ul style="margin:0; padding-left:22px;">${
|
|
2320
|
+
const richTopList = (entries, heading) => entries.length
|
|
2321
|
+
? `<p style="font-weight:bold; margin:12px 0 4px;">${esc(heading)}</p>
|
|
2322
|
+
<ul style="margin:0; padding-left:22px;">${entries.map(x => {
|
|
2288
2323
|
const marks = { lib: "\u0001", ver: "\u0002", weakness: "\u0003", crit: "\u0004" };
|
|
2289
2324
|
let line = esc(t('The library "{lib}" version "{ver}" is vulnerable to "{weakness}" ( {crit} )', marks));
|
|
2290
2325
|
line = line.replace(marks.lib, `<b>${esc(x.lib)}</b>`).replace(marks.ver, `<b>${esc(x.ver)}</b>`)
|
|
@@ -2300,7 +2335,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2300
2335
|
const richHtml = `<div style="font-family:Calibri,Arial,sans-serif; font-size:11pt; color:#1f2937;">`
|
|
2301
2336
|
+ `<p style="font-size:14pt; font-weight:bold; margin:0 0 2px;">${esc(t("Executive Summary"))} — ${esc(level)}</p>`
|
|
2302
2337
|
+ `<p style="margin:0 0 8px; color:#4b5563;">${esc(totalDeps)} ${esc(t("dependencies scanned"))}</p>`
|
|
2303
|
-
+
|
|
2338
|
+
+ richTopList(topSentences, critHeading(topSentences.length)) + (imageSentences.length ? `<p style="font-weight:bold; margin:12px 0 4px;">${esc(imageHeading)}</p><ul>${imageSentences.map(x => `<li>${esc(x)}</li>`).join("")}</ul>` : "") + richEol + richRest + `</div>`;
|
|
2304
2339
|
|
|
2305
2340
|
copyUi = `<button class="btn-copy exec-copy-btn" type="button" title="${t("Copy the executive summary — paste it into Word with formatting preserved")}">📋 ${t("Copy summary")}</button>`
|
|
2306
2341
|
+ `<template class="exec-copy-rich">${richHtml}</template>`
|
|
@@ -2315,12 +2350,16 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2315
2350
|
</div>
|
|
2316
2351
|
<div class="exec-meta">${esc(totalDeps)} ${t("dependencies scanned")}</div>
|
|
2317
2352
|
${topBlock}
|
|
2353
|
+
${imageTopBlock}
|
|
2318
2354
|
${eolBlock}
|
|
2319
2355
|
${restBlock}
|
|
2320
2356
|
</div>`;
|
|
2321
2357
|
}
|
|
2322
2358
|
|
|
2323
2359
|
function warningMessage(w) {
|
|
2360
|
+
if (w.type === "image-unpinned") return esc(t(require('./image-references').UNPINNED_IMAGE_MESSAGE));
|
|
2361
|
+
if (w.type === "image-source-unavailable") return esc(t("Some images or their advisory data are unavailable from public sources. See the affected images and reasons below."));
|
|
2362
|
+
if (w.type === "cve-enrichment-summary") return esc(require('./cve-record-coverage').formatCveRecordWarning(w, RENDER_CTX.locale));
|
|
2324
2363
|
if (w.type === "commercial-build") {
|
|
2325
2364
|
const until = w.until && w.until !== "true" ? t(" (until {date})", { date: esc(w.until) }) : "";
|
|
2326
2365
|
return t("{coord} {version} is not on Maven Central and is newer than the last public {product} {cycle} release ({lastPublic}): a vendor build under paid support{until}.",
|
|
@@ -2348,8 +2387,9 @@ function renderWarnings(warnings) {
|
|
|
2348
2387
|
// intentionally broken CMS test fixture — are grouped into one navigable block per
|
|
2349
2388
|
// type. Every manifest stays listed with its own detail, and the JSON export keeps one
|
|
2350
2389
|
// entry per manifest, so the grouping hides noise without hiding coverage loss.
|
|
2351
|
-
const
|
|
2352
|
-
const
|
|
2390
|
+
const {groupReportWarnings,warningScope} = require('./report-notices');
|
|
2391
|
+
const prepared = groupReportWarnings(warnings);
|
|
2392
|
+
const renderBlock = w => {
|
|
2353
2393
|
const meta = WARNING_HEADINGS[w.type] || { icon: "⚠️", title: w.type };
|
|
2354
2394
|
const itemLimit = w._groupedDiagnostics ? (w.items||[]).length : w.type === "private-libs" ? 200 : 50;
|
|
2355
2395
|
const warningItems = [...(w.items || []), ...(w.artifactTargetId ? [{id:w.artifactTargetId,artifactTargetId:w.artifactTargetId}] : [])];
|
|
@@ -2366,8 +2406,17 @@ function renderWarnings(warnings) {
|
|
|
2366
2406
|
<div class="warn-msg">${message}</div>
|
|
2367
2407
|
${items}
|
|
2368
2408
|
</div>`;
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2409
|
+
};
|
|
2410
|
+
const groups = [
|
|
2411
|
+
{scope:'project', label:t('Project scan warnings')},
|
|
2412
|
+
{scope:'image', label:t('Image scan warnings')},
|
|
2413
|
+
{scope:'global', label:t('Shared source warnings')},
|
|
2414
|
+
];
|
|
2415
|
+
const sections = groups.map(({scope,label}) => {
|
|
2416
|
+
const entries=prepared.filter(w => warningScope(w)===scope);
|
|
2417
|
+
return entries.length ? `<section class="warning-scope warning-scope-${scope}"><h3>${esc(label)}</h3>${entries.map(renderBlock).join('')}</section>` : '';
|
|
2418
|
+
}).join('');
|
|
2419
|
+
return `<div class="warnings warnings-chapter">${sections}</div>`;
|
|
2371
2420
|
}
|
|
2372
2421
|
|
|
2373
2422
|
/**
|
|
@@ -2473,9 +2522,15 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2473
2522
|
// Recos are built from prod matches only (dev/test issues aren't a release blocker).
|
|
2474
2523
|
const sourceMatches = prodMatchesActive.filter(m => !m.dep?.artifactTargetId);
|
|
2475
2524
|
const recos = buildFixRecommendations(sourceMatches, outdatedResults, resolvedDeps);
|
|
2476
|
-
const imageMatches = [...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(m => m.dep?.artifactTargetId);
|
|
2525
|
+
const imageMatches = mergeMatches([...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(m => m.dep?.artifactTargetId));
|
|
2526
|
+
// Image inventory findings are presented together regardless of the input
|
|
2527
|
+
// lane. Count each of those occurrences once in the overview as well.
|
|
2528
|
+
const overviewProdStats = computeStats([...sourceMatches, ...imageMatches]);
|
|
2529
|
+
const overviewDevStats = computeStats(devMatchesActive.filter(m => !m.dep?.artifactTargetId));
|
|
2477
2530
|
const { renderImageCves, renderArtifactEvidence, artifactGroups, artifactAnchor, artifactTitle } = require("./artifacts/report");
|
|
2478
2531
|
const hasImages = Boolean(projectInfo?.artifacts?.length || projectInfo?.imageReferences?.length || rawImageMatches.length);
|
|
2532
|
+
const hasScannedImages = Boolean(projectInfo?.artifacts?.length || rawImageMatches.length);
|
|
2533
|
+
const hasSourceProject = !!(parsedManifests.length || applications.length || applicationInventory.length || [...(resolvedDeps?.values?.() || [])].some(d => d.provenance !== 'binary' && !d.artifactTargetId && d.manifestPaths?.length) || sourceMatches.some(m => m.dep?.provenance !== 'binary' && m.dep?.manifestPaths?.length));
|
|
2479
2534
|
const chapterOffset = hasImages ? 1 : 0;
|
|
2480
2535
|
const sourceDeps = new Map([...(resolvedDeps || [])].filter(([, d]) => !d.artifactTargetId));
|
|
2481
2536
|
|
|
@@ -2524,11 +2579,12 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2524
2579
|
const nativeBinaryCount = [...(resolvedDeps?.values?.() || [])].filter(d => d.provenance === "binary" && !d.artifactTargetId).length;
|
|
2525
2580
|
|
|
2526
2581
|
const exec = renderExecutiveSummary({
|
|
2527
|
-
projectInfo, prodStats, devStats, retireStats,
|
|
2582
|
+
projectInfo, prodStats: overviewProdStats, devStats: overviewDevStats, retireStats,
|
|
2528
2583
|
eolResults, obsoleteResults, outdatedResults,
|
|
2529
2584
|
warnings: generalWarnings, totalDeps: resolvedDeps?.size || 0,
|
|
2530
|
-
topCriticalMatches: pickTopCriticalMatches(
|
|
2531
|
-
|
|
2585
|
+
topCriticalMatches: hasSourceProject ? pickTopCriticalMatches(sourceMatches, 3) : [],
|
|
2586
|
+
topImageMatches: pickTopImages(projectInfo, imageMatches, 3),
|
|
2587
|
+
nativeBinaryCount, hasImages: hasScannedImages,
|
|
2532
2588
|
interactive: wrapTables, // copy button + scripts only in the HTML output
|
|
2533
2589
|
});
|
|
2534
2590
|
|
|
@@ -2645,7 +2701,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2645
2701
|
// its path relative to the scan root. Single-descriptor scans keep the scope chart.
|
|
2646
2702
|
// moduleNames was resolved at the top of buildBody — every table is rendered by then.
|
|
2647
2703
|
const chartsRow = renderCharts(
|
|
2648
|
-
{ prodMatches:
|
|
2704
|
+
{ prodMatches: [...sourceMatches, ...imageMatches], artifacts: projectInfo.artifacts || [], hasImages: hasScannedImages, hasSourceProject, moduleNames, descriptorCount: moduleNames.size,
|
|
2649
2705
|
applications, applicationInventory, coverage },
|
|
2650
2706
|
{ interactive: wrapTables, t, cweName: id => cweTitle(id).name });
|
|
2651
2707
|
|
|
@@ -2659,7 +2715,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2659
2715
|
</div>
|
|
2660
2716
|
</header>
|
|
2661
2717
|
${exec}
|
|
2662
|
-
${summaryCards(
|
|
2718
|
+
${summaryCards(overviewProdStats, eolResults, obsoleteResults, outdatedResults, { warnings: generalWarnings, vendored: retireMatches.length, licenseFlagged, hasImages: hasScannedImages, hasSourceProject, imageCount: imageMatches.length, sourceCount: hasSourceProject ? sourceMatches.length : 0, sourceStats: computeStats(sourceMatches) })}
|
|
2663
2719
|
${chartsRow}
|
|
2664
2720
|
${toc}
|
|
2665
2721
|
${toolbar}
|
|
@@ -2717,6 +2773,22 @@ function pickTopCriticalMatches(prodMatches, n) {
|
|
|
2717
2773
|
return out;
|
|
2718
2774
|
}
|
|
2719
2775
|
|
|
2776
|
+
// Rank distinct images by their worst severity, then composite finding priority.
|
|
2777
|
+
function pickTopImages(projectInfo, matches, limit) {
|
|
2778
|
+
const {artifactGroups}=require('./artifacts/report');
|
|
2779
|
+
const severity={CRITICAL:5,HIGH:4,MEDIUM:3,LOW:2,NONE:1,UNKNOWN:0};
|
|
2780
|
+
const compare=(a,b)=>(severity[(b.cve?.severity || 'UNKNOWN').toUpperCase()] || 0)-(severity[(a.cve?.severity || 'UNKNOWN').toUpperCase()] || 0) || byCvePriority(a,b);
|
|
2781
|
+
return artifactGroups(projectInfo,matches).map(group=>{
|
|
2782
|
+
const seen=new Set(), ranked=[];
|
|
2783
|
+
for(const match of group.matches.slice().sort(compare)) {
|
|
2784
|
+
const id=String(match.cve?.id || '').toUpperCase();
|
|
2785
|
+
if(!/^CVE-\d{4}-\d{4,}$/.test(id) || seen.has(id))continue;
|
|
2786
|
+
seen.add(id); ranked.push(match); if(ranked.length===3)break;
|
|
2787
|
+
}
|
|
2788
|
+
return {...group,matches:ranked};
|
|
2789
|
+
}).filter(group=>group.matches.length).sort((a,b)=>compare(a.matches[0],b.matches[0]) || String(a.artifact.id).localeCompare(String(b.artifact.id))).slice(0,limit);
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2720
2792
|
/**
|
|
2721
2793
|
* The 2 (or N) most significant end-of-life findings for the exec summary:
|
|
2722
2794
|
* direct frameworks first, then the most overdue (oldest EOL date). Findings
|
|
@@ -2975,7 +3047,7 @@ function renderMethodologyChapter(projectInfo, {freshnessNotices = [], informati
|
|
|
2975
3047
|
? `<div class="defined-in"><span class="defined-label">${t("Source coverage limitations")}</span></div><ul class="methodology-limits">${prov.sourceLimitations.map(note=>`<li><strong>${esc(note.source)}:</strong> ${esc(sourceNoteText(note.message))}</li>`).join('')}</ul>` : '';
|
|
2976
3048
|
const depthNote = prov?.mavenDepthLimitReached ? `<p>${esc(t("The configured Maven transitive depth was reached; deeper dependencies were not explored."))}</p>` : '';
|
|
2977
3049
|
const limitations = `<div class="defined-in" style="margin-top:14px"><span class="defined-label">${t("Limitations — vigievuln does not assess:")}</span></div><ul class="methodology-limits">${LIMITATIONS.map(l => `<li>${t(l)}</li>`).join("")}</ul>`;
|
|
2978
|
-
const observations = informationalNotices.length ? `<div class="defined-in"><span class="defined-label">${t("Scan context")}</span></div><ul class="methodology-limits">${informationalNotices.map(note => `<li>${renderTextWithTimestamps(typeof note === 'string' ? note : note.message || '')}</li>`).join('')}</ul>` : '';
|
|
3050
|
+
const observations = informationalNotices.length ? `<div class="defined-in"><span class="defined-label">${t("Scan context")}</span></div><ul class="methodology-limits">${informationalNotices.map(note => `<li>${renderTextWithTimestamps(typeof note === 'string' ? note : note.message || '')}${typeof note==='object' && note.items?.length ? renderWarningItems(note.items,50) : ''}</li>`).join('')}</ul>` : '';
|
|
2979
3051
|
return intro + sourcesTable + cfgHtml + renderFreshnessNotices(freshnessNotices) + observations + depthNote + sourceNotes + limitations;
|
|
2980
3052
|
}
|
|
2981
3053
|
|
|
@@ -3448,10 +3520,20 @@ function browserI18nScript() {
|
|
|
3448
3520
|
function generateHtmlReport(payload) {
|
|
3449
3521
|
// The body is built FIRST: buildBody is what declares the report's language, and the
|
|
3450
3522
|
// <title> and the lang attribute both need it to be set already.
|
|
3451
|
-
|
|
3523
|
+
let body;
|
|
3524
|
+
// Share only byte-identical panels: applicability, paths, fixes and image
|
|
3525
|
+
// identity must all agree. The browser restores them before copy/print hooks.
|
|
3526
|
+
detailPool = new Map();
|
|
3527
|
+
try { body = injectColgroups(buildBody(payload)); }
|
|
3528
|
+
finally { detailPool = null; }
|
|
3452
3529
|
return `<!doctype html>
|
|
3453
3530
|
<html lang="${esc(RENDER_CTX.locale)}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${t("VigieVuln Report")}</title><style>${CSS}</style></head>
|
|
3454
|
-
<body>${body}
|
|
3531
|
+
<body>${body}<script>
|
|
3532
|
+
document.querySelectorAll('[data-detail-ref]').forEach(function(panel) {
|
|
3533
|
+
var source = document.getElementById(panel.getAttribute('data-detail-ref'));
|
|
3534
|
+
if (source) panel.innerHTML = source.innerHTML;
|
|
3535
|
+
});
|
|
3536
|
+
</script>${browserI18nScript()}${TOGGLE_SCRIPT}${COPY_SCRIPT}${CHART_COPY_SCRIPT}<script>
|
|
3455
3537
|
(${localizeReportTimes.toString()})();
|
|
3456
3538
|
</script></body></html>`;
|
|
3457
3539
|
}
|
package/lib/diagnostics.js
CHANGED
|
@@ -9,4 +9,17 @@ function partitionDiagnostics(diagnostics = []) {
|
|
|
9
9
|
for (const diagnostic of diagnostics) (isInformational(diagnostic) ? notices : warnings).push(diagnostic);
|
|
10
10
|
return {warnings, notices};
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
// A comparison can be indeterminate even after every requested record arrived.
|
|
13
|
+
// Keep the candidates for review without describing this as a retrieval failure.
|
|
14
|
+
function advisoryEvidenceDiagnostic(values = []) {
|
|
15
|
+
const records = new Map();
|
|
16
|
+
for (const value of values) {
|
|
17
|
+
const name=value.package || value.name || '', key=JSON.stringify([value.artifactTargetId||'',value.id||'',name,value.version||'']);
|
|
18
|
+
if(!records.has(key))records.set(key,{...value,name});
|
|
19
|
+
}
|
|
20
|
+
const items=[...records.values()].map(v=>({id:[v.id,v.name && `${v.name}@${v.version||'?'}`].filter(Boolean).join(' · '),
|
|
21
|
+
...(v.artifactTargetId?{artifactTargetId:v.artifactTargetId}:{}),detail:v.reason || 'Available advisory data does not establish whether this version is affected.'}));
|
|
22
|
+
return {type:'advisory-evidence',severity:'info',affectsCompleteness:false,affectsAssessment:true,count:items.length,items,
|
|
23
|
+
message:`${items.length} advisory package/version comparison(s) remain undecidable with the available data; no affected or unaffected verdict is inferred.`};
|
|
24
|
+
}
|
|
25
|
+
module.exports = {isInformational, partitionDiagnostics, advisoryEvidenceDiagnostic};
|
package/lib/diff.js
CHANGED
|
Binary file
|
package/lib/euvd.js
CHANGED
|
@@ -95,14 +95,16 @@ function parseExploitedPage(json) {
|
|
|
95
95
|
return out;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async function fetchSnapshot({ fetcher, verbose }) {
|
|
98
|
+
async function fetchSnapshot({ fetcher, verbose, onEuvdRequest }) {
|
|
99
99
|
const { getResource } = require("./providers");
|
|
100
100
|
const headers = { "User-Agent": "vigievuln-euvd" };
|
|
101
|
+
onEuvdRequest?.(require("./providers/common").failureKey("euvd", "cve-mapping", {}));
|
|
101
102
|
const mapping = await getResource("euvd", "cve-mapping", {}, { fetcher, headers });
|
|
102
103
|
if (!mapping.ok) throw new Error(`EUVD mapping HTTP ${mapping.status}`);
|
|
103
104
|
const byCve = parseMappingCsv(await mapping.text());
|
|
104
105
|
const exploited = {};
|
|
105
106
|
for (let page = 0; page < MAX_PAGES; page++) {
|
|
107
|
+
onEuvdRequest?.(require("./providers/common").failureKey("euvd", "exploited", { page }));
|
|
106
108
|
const r = await getResource("euvd", "exploited", { page }, { fetcher, headers });
|
|
107
109
|
if (!r.ok) throw new Error(`EUVD exploited catalogue HTTP ${r.status}`);
|
|
108
110
|
const json = await r.json();
|
|
@@ -129,6 +131,7 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
129
131
|
const byId = new Map();
|
|
130
132
|
opts.onEnrichmentProgress?.({source:'euvd',completed:0,total:ids.length});
|
|
131
133
|
for (let i = 0; i < ids.length; i += 100) {
|
|
134
|
+
opts.onEuvdRequest?.(require("./providers/common").failureKey("euvd", "cves", { ids: ids.slice(i, i + 100) }));
|
|
132
135
|
const res = await require("./providers").getResource("euvd", "cves", { ids: ids.slice(i, i + 100) }, { fetcher, noStore: true, streaming: true });
|
|
133
136
|
if (!res.ok) throw require('./request-failure').responseError('EUVD mapping',res,{viaProxy:true});
|
|
134
137
|
const data = await res.json();
|
|
@@ -175,9 +178,10 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
175
178
|
const fresh = cached && require('./cache-policy').fresh(cached._fetchedAt, CACHE_TTL_MS);
|
|
176
179
|
if (!fresh && !offline) {
|
|
177
180
|
try {
|
|
178
|
-
body = await fetchSnapshot({ fetcher, verbose });
|
|
181
|
+
body = await fetchSnapshot({ fetcher, verbose, onEuvdRequest:opts.onEuvdRequest });
|
|
179
182
|
writeCache(cacheDir, body);
|
|
180
183
|
} catch (err) {
|
|
184
|
+
opts.onEuvdFailure?.(err);
|
|
181
185
|
if (verbose) require('./ui').networkNotice(` EUVD fetch failed: ${err.message}${body ? " — serving the cached snapshot" : ""}`);
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -66,14 +66,15 @@ const europeanAdapters=[
|
|
|
66
66
|
}return {result:'derived-alias',count:context.ids.length};}},
|
|
67
67
|
{id:'euvd',async run(matches,opts,context){
|
|
68
68
|
const copies=context.ids.map(id=>({cve:{id}}));
|
|
69
|
-
|
|
69
|
+
let failure=null;
|
|
70
|
+
await require('./euvd').enrichEuvd(copies,{...opts,hostedProxy:context.hosted,onEuvdFailure:error=>{failure=error.message;}});
|
|
70
71
|
const targeted=context.repo.get('catalogue','euvd-targeted')?.value?.entries || {},bulkEntry=context.repo.get('catalogue','euvd'),bulk=bulkEntry?.value;
|
|
71
72
|
let consulted=0,stale=0,matched=0;
|
|
72
73
|
for(const copy of copies){const id=copy.cve.id,entry=targeted[id];let available=false,old=false;
|
|
73
74
|
if(entry && (opts.offline || context.hosted)){available=true;old=freshness(entry.fetchedAt,entry.stale,opts.offline);}
|
|
74
75
|
else if(bulk?.body?.byCve && typeof bulk.body.byCve==='object'){available=true;old=freshness(bulk._fetchedAt,bulkEntry.stale,opts.offline);}
|
|
75
|
-
if(!available){assign(matches,id,'euvdEvidence',{status:'unavailable'});continue;}consulted++;if(old)stale++;
|
|
76
|
-
assign(matches,id,'euvdEvidence',{status:copy.cve.euvd?'enriched':'no-match',stale:old});
|
|
76
|
+
if(!available){assign(matches,id,'euvdEvidence',{status:'unavailable',reason:failure || (opts.offline?'offline':'unavailable')});continue;}consulted++;if(old)stale++;
|
|
77
|
+
assign(matches,id,'euvdEvidence',{status:copy.cve.euvd?'enriched':'no-match',stale:old,...(failure?{reason:failure,refreshFailed:true}:{})});
|
|
77
78
|
if(copy.cve.euvd){assign(matches,id,'euvd',copy.cve.euvd);matched++;}
|
|
78
79
|
}
|
|
79
80
|
return {result:matched?'enriched':consulted===context.ids.length?'no-match':'unavailable',count:matched,consulted,missing:context.ids.length-consulted,stale};
|
|
@@ -149,16 +150,16 @@ async function enrichEuropeanFindings(matches,opts={}){
|
|
|
149
150
|
let repository;
|
|
150
151
|
Object.defineProperty(context,'repo',{get(){if(!repository)repository=createCacheRepository(opts.cacheDir||getCacheDir());return repository;}});
|
|
151
152
|
const coverage=[],warnings=[];
|
|
152
|
-
for(const adapter of active){const disabled=opts[adapter.id]===false || (adapter.parent && opts[adapter.parent]===false) || (adapter.id==='gcve' && opts.disableGcve), evidenceKey=adapter.id==='euvd-details'?'euvdDetailsEvidence':`${adapter.id}Evidence`;
|
|
153
|
+
for(const adapter of active){const requestKeys=[];const adapterOpts={...opts,onEuvdRequest:key=>{requestKeys.push(key);opts.onEuvdRequest?.(key);}};const disabled=opts[adapter.id]===false || (adapter.parent && opts[adapter.parent]===false) || (adapter.id==='gcve' && opts.disableGcve), evidenceKey=adapter.id==='euvd-details'?'euvdDetailsEvidence':`${adapter.id}Evidence`;
|
|
153
154
|
if(disabled){for(const id of context.ids)assign(matches,id,evidenceKey,{status:'not-consulted'});coverage.push({capability:'sources',collector:adapter.id,execution:'not-applicable',result:'not-consulted',expected:false,reason:'Excluded by source configuration.'});continue;}
|
|
154
155
|
if(!context.ids.length){coverage.push({capability:'sources',collector:adapter.id,execution:'not-applicable',result:'not-applicable'});continue;}
|
|
155
|
-
try{opts.onEnrichmentProgress?.({source:adapter.id,completed:0,total:context.ids.length});const result=await adapter.run(matches,
|
|
156
|
+
try{opts.onEnrichmentProgress?.({source:adapter.id,completed:0,total:context.ids.length});const result=await adapter.run(matches,adapterOpts,context);opts.onEnrichmentProgress?.({source:adapter.id,completed:context.ids.length,total:context.ids.length});if(!result || typeof result.result!=='string')throw Error('Invalid European source result');
|
|
156
157
|
const incomplete=!!result.missing||!!result.stale||result.result==='unavailable';
|
|
157
158
|
const parts=[];if(result.consulted!=null)parts.push(`${result.consulted} of ${context.ids.length} CVEs consulted`);if(result.count!=null)parts.push(`${result.count} enriched`);if(result.missing)parts.push(`${result.missing} unavailable`);if(result.stale)parts.push(`${result.stale} stale`);
|
|
158
159
|
const reason=incomplete ? (result.reason || (parts.length?parts.join('; '):'Source data unavailable.')) : result.reason;
|
|
159
|
-
coverage.push({capability:'sources',collector:adapter.id,execution:incomplete?'partial':result.result==='not-applicable'?'not-applicable':'completed',...result,...(reason?{reason}:{})});
|
|
160
|
+
coverage.push({capability:'sources',collector:adapter.id,requestKeys,execution:incomplete?'partial':result.result==='not-applicable'?'not-applicable':'completed',...result,...(reason?{reason}:{})});
|
|
160
161
|
if(incomplete)warnings.push({type:'source-unavailable',capability:'sources',source:adapter.id,...(result.failures?.length?{code:result.failures[0].code,status:result.failures[0].status,resources:result.failures.flatMap(f=>f.resources),requestKeys:result.failures.map(f=>f.requestKey).filter(Boolean),reason}:{severity:'info'}),message:`${adapter.id.toUpperCase()}: ${reason}`});
|
|
161
|
-
}catch(error){for(const id of context.ids)assign(matches,id,evidenceKey,{status:'unavailable'});coverage.push({capability:'sources',collector:adapter.id,execution:'failed',result:'unavailable',reason:error.message});warnings.push({type:'source-unavailable',capability:'sources',source:adapter.id,message:`${adapter.id.toUpperCase()}: ${error.message}`});}
|
|
162
|
+
}catch(error){for(const id of context.ids)assign(matches,id,evidenceKey,{status:'unavailable',reason:error.message});coverage.push({capability:'sources',collector:adapter.id,requestKeys,execution:'failed',result:'unavailable',reason:error.message});warnings.push({type:'source-unavailable',capability:'sources',source:adapter.id,message:`${adapter.id.toUpperCase()}: ${error.message}`});}
|
|
162
163
|
}
|
|
163
164
|
return {coverage,warnings};
|
|
164
165
|
}
|
package/lib/finding-summary.js
CHANGED
|
@@ -4,7 +4,7 @@ const path = require("node:path");
|
|
|
4
4
|
const SEVERITIES = ["critical", "high", "medium", "low", "none", "unknown"];
|
|
5
5
|
|
|
6
6
|
function identity(m) {
|
|
7
|
-
if (m.findingId) return m.findingId;
|
|
7
|
+
if (m.findingId) return JSON.stringify([m.dep?.artifactTargetId || "", m.findingId]);
|
|
8
8
|
const dep = m.dep || {};
|
|
9
9
|
return [m.cve?.id || "", dep.ecosystem || "", dep.artifactTargetId || "", dep.coordKey || `${dep.groupId || dep.namespace || ""}:${dep.artifactId || dep.name || ""}`,
|
|
10
10
|
dep.version || "", dep.artifactPath || dep.manifestPaths?.[0] || dep.pomPaths?.[0] || ""].join("\0");
|
package/lib/i18n.js
CHANGED
|
@@ -52,6 +52,19 @@ const fr = {
|
|
|
52
52
|
"Severity not supplied by the available sources": "Criticité non fournie par les sources disponibles",
|
|
53
53
|
"Risk evidence": "Origine de la cotation",
|
|
54
54
|
"No categorised finding.": "Aucun résultat catégorisé.",
|
|
55
|
+
"Top {n} most critical · images to update": "Les {n} images les plus critiques à mettre à jour",
|
|
56
|
+
"Image update candidate": "Mise à jour candidate de l’image",
|
|
57
|
+
"CVE findings": "résultats CVE",
|
|
58
|
+
"Image overview charts": "Graphiques de synthèse des images",
|
|
59
|
+
"Project overview": "Synthèse du projet",
|
|
60
|
+
"Image overview": "Synthèse des images",
|
|
61
|
+
"CVE records": "Fiches CVE",
|
|
62
|
+
"Project scan warnings": "Avertissements de l’analyse du projet",
|
|
63
|
+
"Image scan warnings": "Avertissements de l’analyse des images",
|
|
64
|
+
"Shared source warnings": "Avertissements des sources communes",
|
|
65
|
+
"Unavailable from public sources": "Indisponible sur les sources publiques",
|
|
66
|
+
"Source data unavailable": "Données de source indisponibles",
|
|
67
|
+
"Some images or their advisory data are unavailable from public sources. See the affected images and reasons below.": "Certaines images ou leurs données d’avis sont indisponibles sur les sources publiques. Les images concernées et les motifs sont détaillés ci-dessous.",
|
|
55
68
|
"Top {n} most critical · production findings": "Les {n} résultats de production les plus critiques",
|
|
56
69
|
"Image findings": "Résultats images",
|
|
57
70
|
"Source findings": "Résultats sources",
|
|
@@ -453,6 +466,8 @@ const fr = {
|
|
|
453
466
|
"Scanned dependency descriptors": "Descripteurs de dépendances analysés",
|
|
454
467
|
"Ignored directories": "Répertoires ignorés",
|
|
455
468
|
"Methodology, data sources & limitations": "Méthodologie, sources de données et limites",
|
|
469
|
+
"Image references without a digest": "Références d’images sans digest",
|
|
470
|
+
"Image references without a digest use mutable tags, including version tags and implicit latest. Their content can change between the scan, build and deployment. Pin each reference with @sha256:<digest>; the digest observed during a scan does not pin the declaration.": "Les références d’images sans digest utilisent des tags modifiables, y compris les tags de version et latest implicite. Leur contenu peut changer entre le scan, la construction et le déploiement. Fixez chaque référence avec @sha256:<digest> ; le digest observé pendant un scan ne fixe pas la déclaration.",
|
|
456
471
|
"Image analysis blocked": "Analyse d’image bloquée",
|
|
457
472
|
"Warnings & scan-completeness": "Avertissements et complétude du scan",
|
|
458
473
|
"Cached source data used; dates indicate the saved response and may need refreshing.": "Données de sources en cache utilisées ; les dates indiquent les réponses conservées, qui peuvent nécessiter une actualisation.",
|
|
@@ -573,7 +588,7 @@ const fr = {
|
|
|
573
588
|
"B. Prefer declaring these through a package manager (Maven/npm/NuGet/…)": "B. Préférez les déclarer via un gestionnaire de paquets (Maven/npm/NuGet/…)",
|
|
574
589
|
|
|
575
590
|
// ---- Chapter 0 — scan warnings ----
|
|
576
|
-
"Manifests without a lockfile — best-effort
|
|
591
|
+
"Manifests without a lockfile — best-effort": "Manifestes sans lockfile — résolution au mieux",
|
|
577
592
|
"Manifests that failed to parse — contents not scanned": "Manifestes illisibles — contenu non analysé",
|
|
578
593
|
"Yarn 2+/Berry lockfile": "Lockfile Yarn 2+/Berry",
|
|
579
594
|
"Maven deps without a concrete version — silently skipped, run a real Maven/Snyk scan to complete": "Dépendances Maven sans version concrète — ignorées silencieusement, lancez un vrai scan Maven/Snyk pour compléter",
|
package/lib/image-references.js
CHANGED
|
@@ -200,4 +200,24 @@ function referenceWarnings(references) {
|
|
|
200
200
|
(reference.role === 'base' ? ' A Dockerfile base is not evidence of the final built image.' : '') }));
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
// Pinning is a property of the declaration, never of the digest resolved during
|
|
204
|
+
// a scan. Even numeric version tags can be reassigned by a registry publisher.
|
|
205
|
+
const UNPINNED_IMAGE_MESSAGE='Image references without a digest use mutable tags, including version tags and implicit latest. Their content can change between the scan, build and deployment. Pin each reference with @sha256:<digest>; the digest observed during a scan does not pin the declaration.';
|
|
206
|
+
function unpinnedImageWarnings(references=[]) {
|
|
207
|
+
const items=[],seen=new Set();
|
|
208
|
+
for(const ref of references){
|
|
209
|
+
if(ref.localBuild || ref.classification==='local-build' || !ref.reference)continue;
|
|
210
|
+
// Invalid or unresolved references cannot establish whether a pin is valid.
|
|
211
|
+
let parsed;try{parsed=require('./image-registry').parseReference(ref.reference);}catch{continue;}
|
|
212
|
+
if(parsed.reference.includes(':'))continue;
|
|
213
|
+
const key=JSON.stringify([ref.reference,ref.path,ref.line,ref.location]);if(seen.has(key))continue;seen.add(key);
|
|
214
|
+
const location=ref.path ? `${ref.path}${ref.line?':'+ref.line:''}${ref.location?' ('+ref.location+')':''}` : null;
|
|
215
|
+
items.push({id:ref.reference,reference:ref.reference,declared:ref.declared||ref.reference,
|
|
216
|
+
...(ref.path?{manifestPaths:[ref.path]}:{}),...(ref.line?{line:ref.line}:{}),...(ref.location?{location:ref.location}:{}),
|
|
217
|
+
...(location?{detail:location}:{})});
|
|
218
|
+
}
|
|
219
|
+
return items.length ? [{type:'image-unpinned',reason:'mutable-image-reference',severity:'warning',affectsCompleteness:false,
|
|
220
|
+
count:items.length,items,message:UNPINNED_IMAGE_MESSAGE,_groupedDiagnostics:true}] : [];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
module.exports = { unpinnedImageWarnings, UNPINNED_IMAGE_MESSAGE, discoverImageReferences, referenceWarnings, bindImageDefinitions, dockerfileReferences, yamlReferences, resolveVariables, classifyImageReference, DEFAULT_EXTRACTORS };
|
package/lib/json-export.js
CHANGED
|
@@ -86,6 +86,7 @@ function depBrief(dep) {
|
|
|
86
86
|
installEvidence: dep.installEvidence || null,
|
|
87
87
|
sbomEvidence: dep.sbomEvidence || null,
|
|
88
88
|
artifactTargetId: dep.artifactTargetId || null,
|
|
89
|
+
...(dep.artifactTargetId ? {imageRole:dep.imageRole || null,imageSource:require('./artifacts/component-scope').imageComponentSource(dep)} : {}),
|
|
89
90
|
artifactPath: dep.artifactPath || null,
|
|
90
91
|
packageType: dep.packageType || null,
|
|
91
92
|
manager: dep.manager || null,
|
|
@@ -150,6 +151,7 @@ function cveFinding(m) {
|
|
|
150
151
|
priority: c.priority ? { band: c.priority.band, score: c.priority.score } : null,
|
|
151
152
|
cwes: c.cwes || [],
|
|
152
153
|
nvdEvidence: c.nvdEvidence || null,
|
|
154
|
+
nvdRecordEvidence: c.nvdRecordEvidence || null,
|
|
153
155
|
euvdDetails: c.euvdDetails || null,
|
|
154
156
|
fixVersion: c.fixVersion || null,
|
|
155
157
|
...(c.fixVersion && c.fixEvidence ? { fixEvidence: c.fixEvidence } : {}),
|
|
@@ -192,15 +194,15 @@ function buildFindings(payload = {}) {
|
|
|
192
194
|
const findingSummary = summarizeFindings(uniqueCveMatches);
|
|
193
195
|
// Count diagnostic signals as well as incomplete application capabilities.
|
|
194
196
|
// Several signals can describe the same gap; this is not a count of sources.
|
|
195
|
-
const applicationCoverageIncomplete = coverage.filter(c => c.execution === "partial" || c.execution === "not-run" || c.execution === "failed").length;
|
|
197
|
+
const applicationCoverageIncomplete = coverage.filter(c => c.affectsCompleteness !== false && (c.execution === "partial" || c.execution === "not-run" || c.execution === "failed")).length;
|
|
196
198
|
const classifiedNotices = require('./report-notices').partitionReportNotices(warnings);
|
|
197
199
|
const provenance = projectInfo.provenance || payload.provenance || null;
|
|
198
200
|
const reportProvenance = classifiedNotices.notices.length || classifiedNotices.freshness.length ? { ...(provenance || {}),
|
|
199
201
|
notices: [...(provenance?.notices || []), ...classifiedNotices.notices],
|
|
200
202
|
freshnessNotices: [...(provenance?.freshnessNotices || []), ...classifiedNotices.freshness] } : provenance;
|
|
201
203
|
const coverageWarningTypes = new Set(["source-unavailable", "source-stale", "dependency-coverage", "osv-coverage", "go-coverage", "unresolved-versions", "no-lockfile", "parse-error", "missing-include", "local-replace", "private-libs"]);
|
|
202
|
-
const coverageWarnings = classifiedNotices.warnings.filter(w => coverageWarningTypes.has(w.type)).length;
|
|
203
|
-
const artifactCoverageIncomplete = (projectInfo.artifacts || []).flatMap(a => a.coverage || []).filter(c => !['completed', 'not-applicable'].includes(c.execution)).length;
|
|
204
|
+
const coverageWarnings = classifiedNotices.warnings.filter(w => w.affectsCompleteness !== false && coverageWarningTypes.has(w.type)).length;
|
|
205
|
+
const artifactCoverageIncomplete = (projectInfo.artifacts || []).flatMap(a => a.coverage || []).filter(c => c.affectsCompleteness !== false && !['completed', 'not-applicable'].includes(c.execution)).length;
|
|
204
206
|
|
|
205
207
|
return portableLocations({
|
|
206
208
|
schema: "fad-findings/1",
|
|
@@ -288,7 +290,7 @@ function buildFindings(payload = {}) {
|
|
|
288
290
|
|
|
289
291
|
function writeFindings(payload, outputPath) {
|
|
290
292
|
const doc = buildFindings(payload);
|
|
291
|
-
fs.writeFileSync(outputPath, JSON.stringify(doc
|
|
293
|
+
fs.writeFileSync(outputPath, JSON.stringify(doc) + "\n");
|
|
292
294
|
return doc;
|
|
293
295
|
}
|
|
294
296
|
|