vigievuln 1.1.2 → 1.2.0
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 +25 -0
- package/README.md +51 -141
- package/completions/vigievuln.bash +1 -1
- package/completions/vigievuln.zsh +1 -0
- package/lib/account-client.js +21 -14
- package/lib/account-session.js +6 -2
- package/lib/advisory-compression.js +25 -0
- package/lib/advisory-fixes.js +21 -0
- package/lib/advisory-store-sqlite.js +156 -0
- package/lib/advisory-store.js +484 -0
- package/lib/airgap-project.js +117 -0
- package/lib/application-plugins/runner.js +22 -13
- package/lib/application-plugins/wordpress.js +4 -3
- package/lib/application-providers/live-snapshot.js +1 -12
- package/lib/application-providers/snapshot-cache.js +27 -0
- package/lib/application-providers/wordfence-client.js +3 -3
- package/lib/attribution.js +2 -2
- package/lib/cache-archive-sqlite.js +215 -0
- package/lib/cache-archive.js +357 -26
- package/lib/cache-db.js +142 -0
- package/lib/cache-directory.js +18 -74
- package/lib/cache-policy.js +25 -0
- package/lib/cache-repository.js +48 -0
- package/lib/cache-startup.js +54 -0
- package/lib/certfr.js +9 -9
- package/lib/cli-command-routing.js +29 -6
- package/lib/cli-groups.js +32 -3
- package/lib/cli-project-commands.js +47 -6
- package/lib/cli-setup.js +300 -0
- package/lib/codecs/binary/pe-metadata.js +79 -0
- package/lib/codecs/binary/scan.js +4 -3
- package/lib/codecs/binary.codec.js +4 -2
- package/lib/codecs/composer/registry.js +8 -6
- package/lib/codecs/go/parse.js +7 -9
- package/lib/codecs/go/registry.js +7 -5
- package/lib/codecs/go.codec.js +5 -0
- package/lib/codecs/maven.codec.js +73 -8
- package/lib/codecs/npm/collect.js +12 -5
- package/lib/codecs/npm/parse.js +12 -5
- package/lib/codecs/npm/registry.js +42 -12
- package/lib/codecs/nuget/registry.js +8 -6
- package/lib/codecs/pypi/registry.js +8 -6
- package/lib/codecs/ruby/registry.js +7 -5
- package/lib/compression-dictionary.js +5 -0
- package/lib/coverage-diagnostics.js +26 -0
- package/lib/cve-download.js +157 -41
- package/lib/cve-legacy-ranges.js +59 -0
- package/lib/cve-match.js +85 -17
- package/lib/cve-npm-proxy.js +29 -0
- package/lib/cve-report.js +145 -58
- package/lib/cve-version-verdict.js +77 -0
- package/lib/deps-descriptor.js +8 -3
- package/lib/epss.js +13 -8
- package/lib/euvd.js +32 -8
- package/lib/gcve-feed.js +103 -0
- package/lib/gcve-index.js +181 -0
- package/lib/gcve.js +1 -1
- package/lib/github-publisher-maven.js +40 -0
- package/lib/hash-id.js +5 -5
- package/lib/hosted-proxy.js +6 -1
- package/lib/i18n.js +31 -8
- package/lib/json-cache.js +18 -0
- package/lib/json-export.js +16 -2
- package/lib/kev.js +7 -8
- package/lib/line-stream.js +23 -0
- package/lib/maven-airgap.js +80 -0
- package/lib/maven-cache.js +21 -0
- package/lib/maven-license.js +2 -1
- package/lib/maven-presence.js +2 -2
- package/lib/maven-reactor.js +23 -14
- package/lib/maven-repo.js +11 -6
- package/lib/merge-sources.js +25 -18
- package/lib/native-advisories.js +268 -0
- package/lib/nvd-bulk.js +145 -0
- package/lib/nvd-package-ranges.js +109 -0
- package/lib/nvd.js +52 -24
- package/lib/osv-db.js +253 -59
- package/lib/osv-legacy.js +57 -0
- package/lib/osv.js +241 -168
- package/lib/outdated.js +11 -12
- package/lib/package-metadata.js +141 -0
- package/lib/package-versions.js +52 -0
- package/lib/packagist-audit.js +6 -6
- package/lib/provenance.js +73 -19
- package/lib/providers/common.js +11 -1
- package/lib/providers/gcve.js +17 -0
- package/lib/providers/github.js +1 -0
- package/lib/providers/index.js +49 -26
- package/lib/providers/vigievuln.js +7 -0
- package/lib/proxy-cache.js +1 -1
- package/lib/proxy-scope.js +59 -0
- package/lib/proxy-throttle.js +71 -0
- package/lib/resource-cache/engine.js +36 -9
- package/lib/resource-cache/sqlite-store.js +95 -0
- package/lib/resource-cache/validate.js +5 -0
- package/lib/retire.js +24 -24
- package/lib/ruby-version.js +36 -0
- package/lib/sarif-export.js +1 -1
- package/lib/sbom-export.js +11 -7
- package/lib/snyk.js +32 -20
- package/lib/source-profile.js +67 -0
- package/lib/sqlite-driver.js +46 -0
- package/lib/transitive.js +69 -34
- package/lib/unmanaged.js +2 -1
- package/lib/vigievuln-advisories.js +47 -0
- package/package.json +7 -6
- package/vigievuln.js +380 -107
package/lib/cve-report.js
CHANGED
|
@@ -79,6 +79,29 @@ function esc(s) {
|
|
|
79
79
|
.replace(/"/g, """);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
// Keep an explicit UTC fallback for Word and browsers with JavaScript disabled.
|
|
83
|
+
// HTML reports replace it with the reader's local time and time-zone label.
|
|
84
|
+
function renderTimestamp(value) {
|
|
85
|
+
const raw = String(value || "");
|
|
86
|
+
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(raw)) return esc(raw);
|
|
87
|
+
const date = new Date(raw);
|
|
88
|
+
if (!Number.isFinite(date.getTime())) return esc(raw);
|
|
89
|
+
const text = new Intl.DateTimeFormat(RENDER_CTX.locale || "en", {
|
|
90
|
+
year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: "UTC", timeZoneName: "short"
|
|
91
|
+
}).format(date);
|
|
92
|
+
return `<time datetime="${esc(raw)}">${esc(text)}</time>`;
|
|
93
|
+
}
|
|
94
|
+
function renderTextWithTimestamps(value) {
|
|
95
|
+
const text = String(value || "");
|
|
96
|
+
const pattern = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})/g;
|
|
97
|
+
let out = "", last = 0;
|
|
98
|
+
for (const match of text.matchAll(pattern)) {
|
|
99
|
+
out += esc(text.slice(last, match.index)) + renderTimestamp(match[0]);
|
|
100
|
+
last = match.index + match[0].length;
|
|
101
|
+
}
|
|
102
|
+
return out + esc(text.slice(last));
|
|
103
|
+
}
|
|
104
|
+
|
|
82
105
|
function computeStats(cveMatches) {
|
|
83
106
|
const buckets = { critical: 0, high: 0, medium: 0, low: 0, none: 0, unknown: 0, transitive: 0, direct: 0, kev: 0 };
|
|
84
107
|
for (const m of cveMatches || []) {
|
|
@@ -394,13 +417,15 @@ td.desc { color: #4b5563; max-width: 480px; }
|
|
|
394
417
|
.app-warnings .app-warning-files { max-height: 240px; overflow-y: auto; margin: 6px 0 0; padding: 4px 6px 4px 22px; border: 1px solid #e5e7eb; background: #fff; font-size: 11px; }
|
|
395
418
|
.app-warnings .app-warning-files li { margin: 2px 0; overflow-wrap: anywhere; }
|
|
396
419
|
.warnings code { background: #fef3c7; padding: 1px 4px; border-radius: 3px; font-size: 11px; }
|
|
420
|
+
.freshness-note { margin: 8px 0 14px; color: #4b5563; font-size: 12px; line-height: 1.6; }
|
|
421
|
+
.freshness-pill { display: inline-block; margin: 3px 5px 0 0; padding: 2px 9px; border: 1px solid #d1d5db; border-radius: 999px; background: #f3f4f6; color: #374151; white-space: nowrap; }
|
|
397
422
|
.warnings .warn-unresolved-versions code { background: #fecaca; }
|
|
398
423
|
.confidence { font-size: 10px; color: #9ca3af; text-transform: uppercase; }
|
|
399
424
|
.source { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; background: #e5e7eb; color: #374151; margin: 1px 2px 1px 0; }
|
|
400
425
|
.source.both { background: #c7d2fe; color: #312e81; }
|
|
401
426
|
.source.snyk { background: #fce7f3; color: #831843; }
|
|
402
427
|
.source.osv { background: #dcfce7; color: #166534; }
|
|
403
|
-
.source.
|
|
428
|
+
.source.CVEProject { background: #fef3c7; color: #92400e; }
|
|
404
429
|
.source.nvd { background: #cffafe; color: #155e75; }
|
|
405
430
|
.chip { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; margin-left: 4px; }
|
|
406
431
|
.chip.transitive { background: #fef3c7; color: #92400e; }
|
|
@@ -818,6 +843,23 @@ function section(title, contentHtml, opts = {}) {
|
|
|
818
843
|
</div>`;
|
|
819
844
|
}
|
|
820
845
|
|
|
846
|
+
function vigievulnAdvisoryUrl(cve) {
|
|
847
|
+
for (const id of [cve?.id, ...(Array.isArray(cve?.aliases) ? cve.aliases : [])]) {
|
|
848
|
+
const match = /^VV:(CVE-\d{4}-\d{4,})$/i.exec(String(id || ''));
|
|
849
|
+
if (match) return `https://www.vigievuln.fr/advisory/vigievuln/${encodeURIComponent(match[1].toUpperCase())}`;
|
|
850
|
+
}
|
|
851
|
+
const id = String(cve?.id || '');
|
|
852
|
+
return /^CVE-\d{4}-\d{4,}$/i.test(id) ? `https://www.vigievuln.fr/advisory/vigievuln/${encodeURIComponent(id.toUpperCase())}` : null;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function renderSources(m) {
|
|
856
|
+
return String(m.source || 'cache').split('+').map(source => {
|
|
857
|
+
const label = esc(source), url = /^vigievuln$/i.test(source) ? vigievulnAdvisoryUrl(m.cve) : null;
|
|
858
|
+
return url ? `<a class="source ${label}" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${label}</a>`
|
|
859
|
+
: `<span class="source ${label}">${label}</span>`;
|
|
860
|
+
}).join('');
|
|
861
|
+
}
|
|
862
|
+
|
|
821
863
|
function renderDetailPanel(m) {
|
|
822
864
|
const cve = m.cve;
|
|
823
865
|
const dep = m.dep;
|
|
@@ -840,7 +882,7 @@ function renderDetailPanel(m) {
|
|
|
840
882
|
if (cve.priority) kv.push(`<div><label>${t("Priority")}</label><span>${esc((cve.priority.band || "").toUpperCase())}${cve.priority.score != null ? ` · ${esc(cve.priority.score)}/100` : ""}</span></div>`);
|
|
841
883
|
if (cve.epssPercentile != null) kv.push(`<div><label>EPSS</label><span>${cve.epssScore != null ? t("{pct}% prob · ", { pct: (cve.epssScore * 100).toFixed(1) }) : ""}${t("{n}th pct", { n: Math.round(cve.epssPercentile * 100) })}</span></div>`);
|
|
842
884
|
if (cve.kev) kv.push(`<div><label>CISA KEV</label><span>${t("Known exploited")}${cve.kevDateAdded ? t(" · added {date}", { date: esc(cve.kevDateAdded) }) : ""}${cve.kevDueDate ? t(" · due {date}", { date: esc(cve.kevDueDate) }) : ""}${cve.kevRansomware ? t(" · ransomware") : ""}</span></div>`);
|
|
843
|
-
if (cve.fixVersion) kv.push(`<div><label>${t("
|
|
885
|
+
if (cve.fixVersion) kv.push(`<div><label>${t("Advisory-specific candidate")}</label><span>${esc(cve.fixVersion)} — ${cve.fixEvidence === 'explicit-unaffected-version' ? t("This exact version was verified unaffected by this advisory; other versions remain unknown.") + ' ' : ''}${t("Package-wide safety has not been verified.")}</span></div>`);
|
|
844
886
|
if (cve.published) kv.push(`<div><label>${t("Published")}</label><span>${esc(cve.published.slice(0, 10))}</span></div>`);
|
|
845
887
|
if (cve.modified) kv.push(`<div><label>${t("Modified")}</label><span>${esc(cve.modified.slice(0, 10))}</span></div>`);
|
|
846
888
|
if (cve.ghsa) kv.push(`<div><label>GHSA</label><span><a href="https://github.com/advisories/${esc(cve.ghsa)}" target="_blank">${esc(cve.ghsa)}</a></span></div>`);
|
|
@@ -854,7 +896,7 @@ function renderDetailPanel(m) {
|
|
|
854
896
|
}
|
|
855
897
|
if (gcveRef) kv.push(`<div><label>GCVE</label><span><a href="${esc(gcveRef.url)}" target="_blank">${esc(gcveRef.id)}</a></span></div>`);
|
|
856
898
|
if (m.confidence) kv.push(`<div><label>${t("Match confidence")}</label><span>${esc(m.confidence)}</span></div>`);
|
|
857
|
-
if (m.source) kv.push(`<div><label>${t("Sources")}</label><span>${
|
|
899
|
+
if (m.source) kv.push(`<div><label>${t("Sources")}</label><span>${renderSources(m)}</span></div>`);
|
|
858
900
|
if (cve.severityOriginal) kv.push(`<div><label>Original severity</label><span>${esc(cve.severityOriginal)} (Drupal)</span></div>`);
|
|
859
901
|
if (cve.copyrightNotice) kv.push(`<div><label>Copyright</label><span>${esc(cve.copyrightNotice)}</span></div>`);
|
|
860
902
|
if (kv.length) sections.push(section(t("Metadata"), `<div class="kv">${kv.join("")}</div>`));
|
|
@@ -896,8 +938,9 @@ function renderDetailPanel(m) {
|
|
|
896
938
|
// 5. Aliases
|
|
897
939
|
if (cve.aliases?.length) {
|
|
898
940
|
const aliasItems = cve.aliases.map(a => {
|
|
941
|
+
if (/^VV:CVE-\d{4}-\d{4,}$/i.test(a)) return `<li><a href="${esc(vigievulnAdvisoryUrl({id:a}))}" target="_blank" rel="noopener noreferrer">${esc(a)}</a></li>`;
|
|
899
942
|
if (a.startsWith("GHSA-")) return `<li><a href="https://github.com/advisories/${esc(a)}" target="_blank">${esc(a)}</a> (GitHub)</li>`;
|
|
900
|
-
if (
|
|
943
|
+
if (/^CVE-\d{4}-\d{4,}$/i.test(a)) return `<li><a href="https://www.vigievuln.fr/cve/${encodeURIComponent(a.toUpperCase())}" target="_blank" rel="noopener noreferrer">${esc(a)}</a></li>`;
|
|
901
944
|
return `<li>${esc(a)}</li>`;
|
|
902
945
|
}).join("");
|
|
903
946
|
sections.push(section(t("Aliases"), `<ul class="ref-list">${aliasItems}</ul>`, { open: false }));
|
|
@@ -966,11 +1009,11 @@ function formatCwesVerbose(cwes) {
|
|
|
966
1009
|
function renderCveRow(m, opts = {}) {
|
|
967
1010
|
const { withAction } = opts;
|
|
968
1011
|
const advisoryId = String(m.cve.id || "");
|
|
969
|
-
const link = /^CVE-\d{4}-\d{4,}$/i.test(advisoryId) ?
|
|
1012
|
+
const link = /^VV:CVE-\d{4}-\d{4,}$/i.test(advisoryId) ? vigievulnAdvisoryUrl(m.cve) :
|
|
1013
|
+
/^CVE-\d{4}-\d{4,}$/i.test(advisoryId) ? `https://www.vigievuln.fr/cve/${encodeURIComponent(advisoryId.toUpperCase())}` :
|
|
970
1014
|
/^GHSA-[A-Za-z0-9-]+$/i.test(advisoryId) ? `https://github.com/advisories/${encodeURIComponent(advisoryId)}` : null;
|
|
971
1015
|
const advisoryCell = link ? `<a href="${link}" target="_blank" rel="noopener">${esc(advisoryId)}</a>` : esc(advisoryId);
|
|
972
|
-
const
|
|
973
|
-
const source = sourceParts.map(s => `<span class="source ${esc(s)}">${esc(s)}</span>`).join("");
|
|
1016
|
+
const source = renderSources(m);
|
|
974
1017
|
const conf = m.confidence ? `<div class="confidence">${esc(m.confidence)}</div>` : "";
|
|
975
1018
|
const actionCell = withAction ? `<td class="action">${renderActionCell(m)}</td>` : "";
|
|
976
1019
|
const baseCols = 9; // Priority, Sev, CVE, Dep, CWE, Published, Description, Fix, Source
|
|
@@ -998,7 +1041,7 @@ function renderActionCell(m) {
|
|
|
998
1041
|
const fix = m.cve.fixVersion;
|
|
999
1042
|
let action = "";
|
|
1000
1043
|
if (fix) {
|
|
1001
|
-
action += t("
|
|
1044
|
+
action += t("Advisory-specific candidate: {ver}. Review other advisories before changing {dep}.", { dep: `<span class="pin">${esc(depDisplayName(m.dep))}</span>`, ver: esc(fix) });
|
|
1002
1045
|
} else {
|
|
1003
1046
|
// No fixed version published. What to do instead is ecosystem-specific, and saying
|
|
1004
1047
|
// "root POM" to an npm or PyPI reader is simply wrong.
|
|
@@ -1008,7 +1051,7 @@ function renderActionCell(m) {
|
|
|
1008
1051
|
if (root) {
|
|
1009
1052
|
const rootInfo = m._rootUpdate;
|
|
1010
1053
|
if (rootInfo?.latest && rootInfo.latest !== rootInfo.current) {
|
|
1011
|
-
action += `<div class="update-hint">${t("
|
|
1054
|
+
action += `<div class="update-hint">${t("Latest release to review for {dep}: {ver}", { dep: `<code>${esc(root)}</code>`, ver: esc(rootInfo.latest) })}</div>`;
|
|
1012
1055
|
} else {
|
|
1013
1056
|
action += `<div class="update-hint">${t("pulled in by {dep}", { dep: `<code>${esc(root)}</code>` })}</div>`;
|
|
1014
1057
|
}
|
|
@@ -1024,7 +1067,7 @@ function renderCveTable(cveMatches, opts = {}) {
|
|
|
1024
1067
|
const actionHeader = withAction ? `<th>${t("Recommended action")}</th>` : "";
|
|
1025
1068
|
const idHeader = cveMatches.every(m => /^CVE-\d{4}-\d{4,}$/i.test(String(m.cve?.id || ""))) ? t("CVE ID") : t("Advisory ID");
|
|
1026
1069
|
return `<table data-tbl="cve">
|
|
1027
|
-
<thead><tr><th title="${esc(t("Line 1: fix-priority band and CISA KEV flag. Line 2: CVSS severity and base score. Line 3: EPSS percentile and publication date."))}">${t("Priority / severity")}</th><th>${idHeader}</th><th>${t("Dependency")}</th><th>${t("CWE")}</th><th>${t("Description")}</th><th>${t("
|
|
1070
|
+
<thead><tr><th title="${esc(t("Line 1: fix-priority band and CISA KEV flag. Line 2: CVSS severity and base score. Line 3: EPSS percentile and publication date."))}">${t("Priority / severity")}</th><th>${idHeader}</th><th>${t("Dependency")}</th><th>${t("CWE")}</th><th>${t("Description")}</th><th>${t("Advisory-specific candidate")}</th><th>${t("Source")}</th>${actionHeader}</tr></thead>
|
|
1028
1071
|
<tbody>${rows}</tbody>
|
|
1029
1072
|
</table>`;
|
|
1030
1073
|
}
|
|
@@ -1057,13 +1100,13 @@ function buildFixRecommendations(cveMatches, outdatedResults, resolvedDeps) {
|
|
|
1057
1100
|
ecosystem: m.dep.ecosystem || "maven",
|
|
1058
1101
|
ecosystemType: m.dep.ecosystemType || (m.dep.ecosystem === "npm" ? "npm" : "maven"),
|
|
1059
1102
|
currentVersion: m.dep.version, fixVersion: null,
|
|
1060
|
-
maxSeverity: "UNKNOWN", cveIds: [], rootDirects: new Set(),
|
|
1103
|
+
maxSeverity: "UNKNOWN", cveIds: [], rootDirects: new Set(), missingFix: false,
|
|
1061
1104
|
};
|
|
1062
1105
|
tEntry.cveIds.push(m.cve.id);
|
|
1063
|
-
if (m.cve.fixVersion
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1106
|
+
if (!m.cve.fixVersion) tEntry.missingFix = true;
|
|
1107
|
+
// Individual advisory boundaries do not certify a package upgrade. A
|
|
1108
|
+
// higher version can enter another affected interval or a different CVE.
|
|
1109
|
+
// Keep package-level actions unset until an independent target scan exists.
|
|
1067
1110
|
if ((severityRank[m.cve.severity] || 0) > (severityRank[tEntry.maxSeverity] || 0)) {
|
|
1068
1111
|
tEntry.maxSeverity = m.cve.severity;
|
|
1069
1112
|
}
|
|
@@ -1091,6 +1134,7 @@ function buildFixRecommendations(cveMatches, outdatedResults, resolvedDeps) {
|
|
|
1091
1134
|
const transitivesList = [...byTransitive.values()].sort((a, b) =>
|
|
1092
1135
|
(severityRank[b.maxSeverity] || 0) - (severityRank[a.maxSeverity] || 0) ||
|
|
1093
1136
|
b.cveIds.length - a.cveIds.length);
|
|
1137
|
+
for (const entry of transitivesList) if (entry.missingFix) entry.fixVersion = null;
|
|
1094
1138
|
|
|
1095
1139
|
// Enrich direct list with outdated info + current version from resolvedDeps
|
|
1096
1140
|
const directsList = [...byDirect.values()].map(d => {
|
|
@@ -1110,30 +1154,18 @@ function buildFixRecommendations(cveMatches, outdatedResults, resolvedDeps) {
|
|
|
1110
1154
|
return { transitivesList, directsList };
|
|
1111
1155
|
}
|
|
1112
1156
|
|
|
1113
|
-
// Lightweight version comparator (sufficient for "pick highest fix version" when several CVEs share the same coord)
|
|
1114
|
-
function compareVersionsLoose(a, b) {
|
|
1115
|
-
const seg = s => String(s).split(/[.\-]/).map(p => /^\d+$/.test(p) ? parseInt(p, 10) : p);
|
|
1116
|
-
const sa = seg(a), sb = seg(b);
|
|
1117
|
-
for (let i = 0; i < Math.max(sa.length, sb.length); i++) {
|
|
1118
|
-
const x = sa[i], y = sb[i];
|
|
1119
|
-
if (x === y) continue;
|
|
1120
|
-
if (typeof x === "number" && typeof y === "number") return x - y;
|
|
1121
|
-
return String(x ?? "").localeCompare(String(y ?? ""));
|
|
1122
|
-
}
|
|
1123
|
-
return 0;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
1157
|
function renderFixRecommendations(recos, allMatches = [], outdatedResults = []) {
|
|
1127
1158
|
// Direct deps to update. Aggregates every direct dep (not
|
|
1128
1159
|
// transitive, not parent, not vendored) that has at least one CVE and
|
|
1129
1160
|
// picks the highest fix-version found across its CVEs as the target.
|
|
1130
1161
|
const directs = buildDirectDepsToUpdate(allMatches, outdatedResults);
|
|
1162
|
+
const warning = `<div class="fp-intro">${t("Review these proposed changes manually: affected ranges, other vulnerabilities, dependency constraints and compatibility can make a suggested version unsuitable. Re-resolve and test the project after changes.")}</div>`;
|
|
1131
1163
|
const directsSection = directs.length
|
|
1132
1164
|
? minorSection(`5.1 ${t("Direct deps to update")} (${directs.length})`, renderDirectDepsToUpdateTable(directs))
|
|
1133
1165
|
: "";
|
|
1134
1166
|
|
|
1135
1167
|
if (!recos.transitivesList.length && !recos.directsList.length) {
|
|
1136
|
-
return directsSection
|
|
1168
|
+
return directsSection ? warning + directsSection : `<div class="empty">${t("No actionable recommendations.")}</div>`;
|
|
1137
1169
|
}
|
|
1138
1170
|
|
|
1139
1171
|
// Group by ecosystemType so each tool gets its own pin/update advice.
|
|
@@ -1150,7 +1182,7 @@ function renderFixRecommendations(recos, allMatches = [], outdatedResults = [])
|
|
|
1150
1182
|
}
|
|
1151
1183
|
|
|
1152
1184
|
const ecoOrder = ORDER;
|
|
1153
|
-
const out = [directsSection];
|
|
1185
|
+
const out = [warning, directsSection];
|
|
1154
1186
|
let sectionNo = directs.length ? 2 : 1;
|
|
1155
1187
|
for (const eco of ecoOrder) {
|
|
1156
1188
|
const slice = byEco[eco];
|
|
@@ -1165,8 +1197,8 @@ function renderFixRecommendations(recos, allMatches = [], outdatedResults = [])
|
|
|
1165
1197
|
|
|
1166
1198
|
/**
|
|
1167
1199
|
* Aggregate direct (non-transitive, non-parent, non-vendored) deps that have
|
|
1168
|
-
* at least one matched CVE.
|
|
1169
|
-
*
|
|
1200
|
+
* at least one matched CVE. Individual advisory candidates remain in their
|
|
1201
|
+
* finding rows; no aggregate target is inferred from their numeric maximum.
|
|
1170
1202
|
*/
|
|
1171
1203
|
function buildDirectDepsToUpdate(matches, outdatedResults) {
|
|
1172
1204
|
const severityRank = { CRITICAL: 4, HIGH: 3, MEDIUM: 2, LOW: 1, NONE: 0, UNKNOWN: 0 };
|
|
@@ -1185,17 +1217,16 @@ function buildDirectDepsToUpdate(matches, outdatedResults) {
|
|
|
1185
1217
|
currentVersion: d.version || null,
|
|
1186
1218
|
cveIds: [],
|
|
1187
1219
|
maxSeverity: "UNKNOWN",
|
|
1188
|
-
fixVersion: null,
|
|
1220
|
+
fixVersion: null, missingFix: false,
|
|
1189
1221
|
};
|
|
1190
1222
|
e.cveIds.push(m.cve.id);
|
|
1223
|
+
if (!m.cve.fixVersion) e.missingFix = true;
|
|
1191
1224
|
if ((severityRank[m.cve.severity] || 0) > (severityRank[e.maxSeverity] || 0)) e.maxSeverity = m.cve.severity;
|
|
1192
|
-
if (m.cve.fixVersion && (!e.fixVersion || compareVersionsLoose(m.cve.fixVersion, e.fixVersion) > 0)) {
|
|
1193
|
-
e.fixVersion = m.cve.fixVersion;
|
|
1194
|
-
}
|
|
1195
1225
|
byKey.set(key, e);
|
|
1196
1226
|
}
|
|
1197
1227
|
// Enrich with outdated lookup
|
|
1198
1228
|
for (const e of byKey.values()) {
|
|
1229
|
+
if (e.missingFix) e.fixVersion = null;
|
|
1199
1230
|
const lookupKey = e.ecosystemType === "maven" ? e.coord : null;
|
|
1200
1231
|
const o = lookupKey ? outByKey.get(lookupKey) : null;
|
|
1201
1232
|
e.latest = o?.latest || null;
|
|
@@ -1206,7 +1237,7 @@ function buildDirectDepsToUpdate(matches, outdatedResults) {
|
|
|
1206
1237
|
}
|
|
1207
1238
|
|
|
1208
1239
|
function renderDirectDepsToUpdateTable(entries) {
|
|
1209
|
-
const intro = `<div class="fp-intro">${t("
|
|
1240
|
+
const intro = `<div class="fp-intro">${t("Advisory candidates address individual advisories only. Other vulnerabilities may affect those versions. No package-wide correction or pin is generated without checking the target version against all advisories. Rescan candidate versions and review compatibility and lockfiles.")}</div>`;
|
|
1210
1241
|
const rows = entries.map(e => `<tr>
|
|
1211
1242
|
<td>${badge(e.maxSeverity)}</td>
|
|
1212
1243
|
<td class="dep">${esc(e.coord)}</td>
|
|
@@ -1216,7 +1247,7 @@ function renderDirectDepsToUpdateTable(entries) {
|
|
|
1216
1247
|
<td class="confidence">${t("{n} CVE:", { n: e.cveIds.length })} ${esc(e.cveIds.slice(0, 4).join(", "))}${e.cveIds.length > 4 ? "…" : ""}</td>
|
|
1217
1248
|
</tr>`).join("\n");
|
|
1218
1249
|
return intro + `<table>
|
|
1219
|
-
<thead><tr><th>${t("Worst sev")}</th><th>${t("Direct dependency")}</th><th>${t("Current")}</th><th>${t("
|
|
1250
|
+
<thead><tr><th>${t("Worst sev")}</th><th>${t("Direct dependency")}</th><th>${t("Current")}</th><th>${t("Suggested version")}</th><th>${t("Maven Central latest")}</th><th>${t("CVEs")}</th></tr></thead>
|
|
1220
1251
|
<tbody>${rows}</tbody>
|
|
1221
1252
|
</table>`;
|
|
1222
1253
|
}
|
|
@@ -1233,11 +1264,11 @@ function renderRecommendationsForEco(slice, meta) {
|
|
|
1233
1264
|
// Section A: pin transitives (eco-specific snippet)
|
|
1234
1265
|
if (slice.trans.length) {
|
|
1235
1266
|
let html = "";
|
|
1236
|
-
const pinnable = slice.trans.filter(x => x.fixVersion);
|
|
1267
|
+
const pinnable = slice.trans.filter(x => x.packageFixVerified === true && x.fixVersion);
|
|
1237
1268
|
if (pinnable.length) {
|
|
1238
1269
|
const top = pinnable.slice(0, 30);
|
|
1239
1270
|
html += `<div class="fix-recipe">
|
|
1240
|
-
<div class="recipe-title">${
|
|
1271
|
+
<div class="recipe-title">${t("Suggested changes for manual review")}</div>
|
|
1241
1272
|
<code>${esc(meta.snippet(top))}</code>
|
|
1242
1273
|
${pinnable.length > 30 ? `<div class="recipe-meta">${t("{n} additional pins omitted from the snippet — see the table below.", { n: pinnable.length - 30 })}</div>` : ""}
|
|
1243
1274
|
</div>`;
|
|
@@ -1245,12 +1276,12 @@ function renderRecommendationsForEco(slice, meta) {
|
|
|
1245
1276
|
const rows = slice.trans.map(tr => `<tr>
|
|
1246
1277
|
<td>${badge(tr.maxSeverity)}</td>
|
|
1247
1278
|
<td class="dep">${esc(tr.ecosystem === "npm" ? "npm:" : `${tr.groupId}:`)}<br>${esc(tr.artifactId)}<br><span style="color:#6b7280">${esc(tr.currentVersion)}</span></td>
|
|
1248
|
-
<td class="dep">${tr.fixVersion ? esc(tr.fixVersion) : `<span style="color:#9ca3af">${t("— (
|
|
1279
|
+
<td class="dep">${tr.packageFixVerified === true && tr.fixVersion ? esc(tr.fixVersion) : `<span style="color:#9ca3af">${t("— (manual triage)")}</span>`}</td>
|
|
1249
1280
|
<td class="confidence">${t("{n} CVE:", { n: tr.cveIds.length })} ${esc(tr.cveIds.slice(0, 4).join(", "))}${tr.cveIds.length > 4 ? "…" : ""}</td>
|
|
1250
1281
|
<td class="dep">${[...tr.rootDirects].slice(0, 3).map(r => esc(r)).join("<br>")}${tr.rootDirects.size > 3 ? `<div class="confidence">${t("+{n} more", { n: tr.rootDirects.size - 3 })}</div>` : ""}</td>
|
|
1251
1282
|
</tr>`).join("\n");
|
|
1252
1283
|
html += `<table>
|
|
1253
|
-
<thead><tr><th>${t("Max Sev")}</th><th>${t("Transitive (current)")}</th><th>${t("
|
|
1284
|
+
<thead><tr><th>${t("Max Sev")}</th><th>${t("Transitive (current)")}</th><th>${t("Package-wide correction")}</th><th>CVE</th><th>${t("Brought in by")}</th></tr></thead>
|
|
1254
1285
|
<tbody>${rows}</tbody>
|
|
1255
1286
|
</table>`;
|
|
1256
1287
|
blocks.push(minorSection(esc(t(meta.pinSection)).replace("<", "<").replace(">", ">"), html));
|
|
@@ -1261,7 +1292,7 @@ function renderRecommendationsForEco(slice, meta) {
|
|
|
1261
1292
|
let html = "";
|
|
1262
1293
|
const rows = slice.directs.map(d => {
|
|
1263
1294
|
const updateNote = d.latest && d.latest !== d.currentVersion
|
|
1264
|
-
? `<span
|
|
1295
|
+
? `<span>${t("Release to review")}: ${esc(d.latest)} — ${t("Package-wide safety has not been verified.")}</span>`
|
|
1265
1296
|
: `<span style="color:#9ca3af">${esc(d.currentVersion || "?")} ${t("(no update available)")}</span>`;
|
|
1266
1297
|
return `<tr>
|
|
1267
1298
|
<td>${badge(d.maxSeverity)}</td>
|
|
@@ -1580,6 +1611,8 @@ function mergeMatches(matches) {
|
|
|
1580
1611
|
continue;
|
|
1581
1612
|
}
|
|
1582
1613
|
const existing = byKey.get(key);
|
|
1614
|
+
existing.cve = { ...existing.cve, ...require('./advisory-fixes').mergeAdvisoryFixes(existing.cve,m.cve),
|
|
1615
|
+
aliases: [...new Set([...(existing.cve.aliases || []), ...(m.cve.aliases || [])])] };
|
|
1583
1616
|
// Union of via paths
|
|
1584
1617
|
const incoming = m.dep.viaPaths || (m.dep.via ? [m.dep.via] : []);
|
|
1585
1618
|
for (const p of incoming) {
|
|
@@ -1980,8 +2013,8 @@ function renderRetireTable(matches) {
|
|
|
1980
2013
|
const isRealIdentifier = id => /^(CVE-|GHSA-|RETIRE-)/i.test(String(id || ""));
|
|
1981
2014
|
const proseLabel = id => { const s = String(id || "?"); return s.length > 100 ? s.slice(0, 100) + "…" : s; };
|
|
1982
2015
|
const idLink = m => {
|
|
1983
|
-
const candidate = m.cve.id
|
|
1984
|
-
? `https://
|
|
2016
|
+
const candidate = /^CVE-\d{4}-\d{4,}$/i.test(String(m.cve.id || ""))
|
|
2017
|
+
? `https://www.vigievuln.fr/cve/${encodeURIComponent(String(m.cve.id).toUpperCase())}`
|
|
1985
2018
|
: (m.cve.osvRefs?.[0]?.url || null);
|
|
1986
2019
|
let href = null;
|
|
1987
2020
|
try { if (candidate && ['https:', 'http:'].includes(new URL(candidate).protocol)) href = candidate; } catch { /* untrusted advisory URL */ }
|
|
@@ -2077,7 +2110,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2077
2110
|
<a class="exec-cve-link" href="#${m.applicationIds?.length ? "chapps" : m.dep?.scope === "vendored" ? "ch2" : "ch1"}">${esc(m.cve.id)}</a>
|
|
2078
2111
|
<code>${esc(depDisplayName(m.dep))}</code>
|
|
2079
2112
|
<span class="exec-ver">${esc(m.dep.version || "?")}</span>
|
|
2080
|
-
|
|
2113
|
+
${m.cve.fixVersion ? `<span class="exec-fix">${t("Advisory candidate")}: ${esc(m.cve.fixVersion)}</span>` : ""}
|
|
2081
2114
|
${cweChips}
|
|
2082
2115
|
${transitiveTag}
|
|
2083
2116
|
</li>`;
|
|
@@ -2206,7 +2239,24 @@ function warningMessage(w) {
|
|
|
2206
2239
|
`${w.sourceId ? ` (${esc(w.sourceId)})` : ""}: ${esc(executionLabel(w.execution))} — ` +
|
|
2207
2240
|
`${esc(t("{n} component(s) not evaluated", { n: w.count || 0 }))} (${esc(w.diagnostic || w.code || "CMS_INCOMPLETE")}). ` +
|
|
2208
2241
|
`${esc(diagnosticAction(w.diagnostic || w.code || "CMS_INCOMPLETE"))}`
|
|
2209
|
-
:
|
|
2242
|
+
: renderTextWithTimestamps(w.message || "");
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
// The source-health ledger emits one general cache notice per source. Keep
|
|
2246
|
+
// specific freshness diagnostics in the warnings list; summarize these dated
|
|
2247
|
+
// notices separately without changing the structured JSON or strict gates.
|
|
2248
|
+
function freshnessNotice(w, online = false) {
|
|
2249
|
+
if (w.type !== 'source-stale') return null;
|
|
2250
|
+
const match = /^([A-Za-z][\w.-]*): (?:the source could not be refreshed; )?cached data (?:from (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)|of unknown age) was used\./.exec(w.message || '') ||
|
|
2251
|
+
/^([A-Za-z][\w.-]*): cached data (?:from (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)|of unknown age) was used and may be outdated\./.exec(w.message || '');
|
|
2252
|
+
if (match) return {source: match[1], at: match[2] || null, message: w.message};
|
|
2253
|
+
return online ? {message: w.message} : null;
|
|
2254
|
+
}
|
|
2255
|
+
function renderFreshnessNotices(notices) {
|
|
2256
|
+
if (!notices.length) return '';
|
|
2257
|
+
const pills = notices.filter(n => n.source).map(n => `<span class="freshness-pill" title="${esc(n.message)}"><strong>${esc(n.source)}</strong> · ${n.at ? renderTimestamp(n.at) : esc(t('unknown date'))}</span>`).join(' ');
|
|
2258
|
+
const details = notices.filter(n => !n.source).map(n => `<span>${renderTextWithTimestamps(n.message)}</span>`).join('<br>');
|
|
2259
|
+
return `<p class="freshness-note">${esc(t('Cached source data used; dates indicate the saved response and may need refreshing.'))}${pills ? `<br>${pills}` : ''}${details ? `<br>${details}` : ''}</p>`;
|
|
2210
2260
|
}
|
|
2211
2261
|
|
|
2212
2262
|
function renderWarnings(warnings) {
|
|
@@ -2343,7 +2393,10 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2343
2393
|
const genericDevMatches = devMatchesActive.filter(m => !m.applicationIds?.length);
|
|
2344
2394
|
const knownAppIds = new Set(applications.map(app => app.id));
|
|
2345
2395
|
const applicationWarnings = (warnings || []).filter(w => w.type === "cms-coverage" && knownAppIds.has(w.applicationId));
|
|
2346
|
-
const
|
|
2396
|
+
const allGeneralWarnings = (warnings || []).filter(w => !applicationWarnings.includes(w));
|
|
2397
|
+
const online = projectInfo?.provenance?.mode === 'online';
|
|
2398
|
+
const freshnessNotices = [...(projectInfo?.provenance?.freshnessNotices || []), ...allGeneralWarnings.map(w => freshnessNotice(w, online)).filter(Boolean)];
|
|
2399
|
+
const generalWarnings = allGeneralWarnings.filter(w => !freshnessNotice(w, online));
|
|
2347
2400
|
const prodAppIds = new Set(applicationMatches.flatMap(m => m.applicationIds || []));
|
|
2348
2401
|
const devAppIds = new Set(applicationDevMatches.flatMap(m => m.applicationIds || []));
|
|
2349
2402
|
const prodAppWarnings = applicationWarnings.filter(w => prodAppIds.has(w.applicationId));
|
|
@@ -2407,6 +2460,8 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2407
2460
|
// CVE root header breakdown: direct vs indirect (transitive) production vulns + the dev count.
|
|
2408
2461
|
const prodDirect = prodMatchesActive.filter(m => m.dep?.scope !== "transitive").length;
|
|
2409
2462
|
const prodIndirect = prodMatchesActive.filter(m => m.dep?.scope === "transitive").length;
|
|
2463
|
+
const devDirect = devMatchesActive.filter(m => m.dep?.scope !== "transitive").length;
|
|
2464
|
+
const devIndirect = devMatchesActive.filter(m => m.dep?.scope === "transitive").length;
|
|
2410
2465
|
|
|
2411
2466
|
// The application view is the first CVE section whenever an application was
|
|
2412
2467
|
// inventoried (a zero-finding instance still shows its synthesis and coverage —
|
|
@@ -2431,7 +2486,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2431
2486
|
{ show: genericDevMatches.length > 0, id: "ch3", title: `${t("Dev dependencies")} (${genericDevMatches.length})`, nav: `${t("Dev")} (${genericDevMatches.length})`, content: n => renderCveBySectionByEco(genericDevMatches, n, projectInfo?.src) },
|
|
2432
2487
|
{ show: fpTotal > 0, id: "ch9", title: `${t("Likely false positives — CPE-filtered")} (${fpTotal})`, nav: `${t("Likely FP")} (${fpTotal})`, content: fpContent },
|
|
2433
2488
|
]);
|
|
2434
|
-
const cveRoot = majorSection(`1. ${t("CVE")} (${t("{direct} direct, {indirect} indirect, {dev} dev", { direct: prodDirect, indirect: prodIndirect,
|
|
2489
|
+
const cveRoot = majorSection(`1. ${t("CVE")} (${t("{direct} direct prod, {indirect} indirect prod, {devDirect} direct dev/test, {devIndirect} indirect dev/test", { direct: prodDirect, indirect: prodIndirect, devDirect, devIndirect })})`,
|
|
2435
2490
|
cveSections.html || `<div class="empty">${t("No CVE matches.")}</div>`, { id: "chcve" });
|
|
2436
2491
|
|
|
2437
2492
|
const binSections = numberedSubsections(2, [
|
|
@@ -2465,7 +2520,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2465
2520
|
|
|
2466
2521
|
// (C) Table of contents — sticky nav, hierarchical (roots + indented sub-chapters).
|
|
2467
2522
|
const toc = renderToc([
|
|
2468
|
-
...(generalWarnings.length ? [{ id: "ch0", label: `0. ${t("Warnings")}` }] : []),
|
|
2523
|
+
...(generalWarnings.length || freshnessNotices.length ? [{ id: "ch0", label: `0. ${t("Warnings")}` }] : []),
|
|
2469
2524
|
...(diff && diff.summary ? [{ id: "chdiff", label: `Δ ${t("Baseline diff")}` }] : []),
|
|
2470
2525
|
{ id: "chcve", label: `1. ${t("CVE")} (${prodStats.total + devStats.total + retireStats.total})`, sub: cveSections.toc },
|
|
2471
2526
|
{ id: "chbin", label: `2. ${t("Unmanaged components")} (${embTotal + unmTotal + vjsTotal + certTotal})`, sub: binSections.toc },
|
|
@@ -2491,7 +2546,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2491
2546
|
<div class="report-subtitle">${t("Multi-ecosystem dependency security audit")}</div>
|
|
2492
2547
|
<div class="meta">
|
|
2493
2548
|
${t("Project:")} <strong>${esc(projectInfo.name)}</strong><br>
|
|
2494
|
-
${t("Generated:")} ${
|
|
2549
|
+
${t("Generated:")} ${projectInfo.generatedAt ? renderTimestamp(projectInfo.generatedAt) : ""}${` · <a class="tool-link" href="${REPO_URL}" target="_blank" rel="noopener" title="${esc(t("vigievuln on GitHub — docs, changelog, issues"))}">VigieVuln${projectInfo.toolVersion ? ` ${esc(projectInfo.toolVersion)}` : ""}</a>`}${projectInfo.cveDataDate ? ` · ${t("CVE data:")} ${renderTimestamp(projectInfo.cveDataDate)}` : ""}
|
|
2495
2550
|
</div>
|
|
2496
2551
|
</header>
|
|
2497
2552
|
${exec}
|
|
@@ -2500,7 +2555,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2500
2555
|
${toc}
|
|
2501
2556
|
${toolbar}
|
|
2502
2557
|
|
|
2503
|
-
${generalWarnings.length ? majorSection(`0. ${t("Warnings & scan-completeness")} (${generalWarnings.length})`, renderWarnings(generalWarnings), { open: true, id: "ch0" }) : ""}
|
|
2558
|
+
${generalWarnings.length || freshnessNotices.length ? majorSection(`0. ${t("Warnings & scan-completeness")} (${generalWarnings.length})`, renderFreshnessNotices(freshnessNotices) + renderWarnings(generalWarnings), { open: true, id: "ch0" }) : ""}
|
|
2504
2559
|
${(diff && diff.summary) ? majorSection(`Δ ${t("Changes since baseline")} (${t("+{n} new prod CVE", { n: diff.summary.cve.addedProduction })})`, renderDiffChapter(diff), { open: true, id: "chdiff" }) : ""}
|
|
2505
2560
|
${cveRoot}
|
|
2506
2561
|
${binRoot}
|
|
@@ -2640,7 +2695,7 @@ function pill(text, bg, fg = "#fff") {
|
|
|
2640
2695
|
}
|
|
2641
2696
|
function renderUnmanagedInventory(inventory, srcRoot) {
|
|
2642
2697
|
if (!inventory.length) return `<div class="empty">${t("No committed native binaries found.")}</div>`;
|
|
2643
|
-
const intro = `<div class="fp-intro">${t("Committed native binaries (<code>.dll</code>/<code>.exe</code>/<code>.so</code>/<code>.dylib</code>) — not governed by any package manager. Identified by checksum (deps.dev + CIRCL). <strong>should-be-managed</strong> = a published package committed as a blob; <strong>name≠checksum</strong> = the filename disagrees with what the hash resolves to; <strong>not recognised by any source</strong> = neither deps.dev nor CIRCL knows this exact file (vendored/custom build — verify its origin manually). Identification is by checksum only; a file absent from both databases stays unidentified even when its name is suggestive (e.g. <code>openssl.exe</code>).")}</div>`;
|
|
2698
|
+
const intro = `<div class="fp-intro"><strong>${t("Analysis limitation:")}</strong> ${t("The binaries in this chapter are not automatically correlated with CVEs. Their metadata may be incomplete, ambiguous or modified, and therefore cannot always reliably identify the exact product and build. Available information is shown to help with manual verification.")}<br><br>${t("Committed native binaries (<code>.dll</code>/<code>.exe</code>/<code>.so</code>/<code>.dylib</code>) — not governed by any package manager. Identified by checksum (deps.dev + CIRCL). <strong>should-be-managed</strong> = a published package committed as a blob; <strong>name≠checksum</strong> = the filename disagrees with what the hash resolves to; <strong>not recognised by any source</strong> = neither deps.dev nor CIRCL knows this exact file (vendored/custom build — verify its origin manually). Identification is by checksum only; a file absent from both databases stays unidentified even when its name is suggestive (e.g. <code>openssl.exe</code>).")}</div>`;
|
|
2644
2699
|
const rows = inventory.map(e => {
|
|
2645
2700
|
let rel = e.path;
|
|
2646
2701
|
if (srcRoot) { try { rel = path.relative(srcRoot, e.path); } catch { /* keep abs */ } }
|
|
@@ -2654,7 +2709,16 @@ function renderUnmanagedInventory(inventory, srcRoot) {
|
|
|
2654
2709
|
e.nameMismatch ? pill(t("name≠checksum"), "#ea580c") : null,
|
|
2655
2710
|
e.noOnlineInfo ? pill(t("not recognised by any source"), "#6b7280") : null,
|
|
2656
2711
|
].filter(Boolean).join(" ");
|
|
2657
|
-
|
|
2712
|
+
const fields = [["CompanyName", "Company"], ["ProductName", "Product"], ["ProductVersion", "Product version"],
|
|
2713
|
+
["FileVersion", "File version"], ["FileDescription", "File description"], ["InternalName", "Internal name"], ["OriginalFilename", "Original filename"]];
|
|
2714
|
+
const metadata = (e.binaryMetadata?.versionStrings || []).map(m => {
|
|
2715
|
+
if (!m || typeof m !== "object" || Array.isArray(m)) return "";
|
|
2716
|
+
const labels = new Map(fields), keys = [...fields.map(([key]) => key), ...Object.keys(m).filter(key => !labels.has(key)).sort()];
|
|
2717
|
+
return keys.filter(key => Object.hasOwn(m, key) && typeof m[key] === "string" && m[key])
|
|
2718
|
+
.map(key => `<div><strong>${esc(labels.has(key) ? t(labels.get(key)) : key)}:</strong> ${esc(m[key])}</div>`).join("");
|
|
2719
|
+
}).filter(Boolean);
|
|
2720
|
+
const details = metadata.length ? `<details class="binary-metadata"><summary>${t("Unverified PE metadata")}</summary>${metadata.map(group => `<div style="margin:6px 0">${group}</div>`).join("")}</details>` : "";
|
|
2721
|
+
return `<tr><td class="dep"><code class="path">${esc(rel)}</code></td><td>${id}${details}</td><td>${flags}</td><td><code class="path" style="color:#6b7280">${esc((e.hashes?.sha256 || "").slice(0, 16))}…</code></td></tr>`;
|
|
2658
2722
|
}).join("\n");
|
|
2659
2723
|
return intro + `<table><thead><tr><th>${t("File")}</th><th>${t("Identity (by checksum)")}</th><th>${t("Status")}</th><th>${t("SHA-256")}</th></tr></thead><tbody>${rows}</tbody></table>`;
|
|
2660
2724
|
}
|
|
@@ -2769,7 +2833,7 @@ function renderMethodologyChapter(projectInfo) {
|
|
|
2769
2833
|
if (prov) {
|
|
2770
2834
|
const rows = (prov.dataSources || []).map(s => {
|
|
2771
2835
|
const [txt, bg] = STATUS_PILL[s.status] || [s.status, "#6b7280"];
|
|
2772
|
-
return `<tr><td>${esc(s.label)}</td><td>${pill(t(txt), bg)}</td><td>${
|
|
2836
|
+
return `<tr><td>${esc(s.label)}</td><td>${pill(t(txt), bg)}</td><td>${s.asOf ? renderTimestamp(s.asOf) : "—"}</td><td><span style="color:#6b7280">${renderTextWithTimestamps(provenanceDetail(s.detail))}</span></td></tr>`;
|
|
2773
2837
|
}).join("\n");
|
|
2774
2838
|
sourcesTable = `<table><thead><tr><th>${t("Data source")}</th><th>${t("State")}</th><th>${t("As of")}</th><th>${t("Detail")}</th></tr></thead><tbody>${rows}</tbody></table>`;
|
|
2775
2839
|
const c = prov.configuration || {};
|
|
@@ -2779,14 +2843,27 @@ function renderMethodologyChapter(projectInfo) {
|
|
|
2779
2843
|
const kv = (k, v) => `<span class="meta-kv"><strong>${esc(t(k))}:</strong> ${esc(typeof v === "boolean" ? t(String(v)) : String(v))}</span>`;
|
|
2780
2844
|
cfgHtml = `<div class="fp-intro" style="margin-top:14px">
|
|
2781
2845
|
${kv("mode", prov.mode)} ${kv("ecosystems", c.ecosystems)} ${kv("transitive", c.transitive ? t("on (depth {n})", { n: c.transitiveDepth || "?" }) : t("off"))}
|
|
2782
|
-
${kv("
|
|
2846
|
+
${c.sourceProfile != null ? kv("source profile", c.sourceProfile) : ""} ${c.cveProject != null ? kv("CVEProject", c.cveProject) : ""} ${c.osvDb != null ? kv("OSV local DB", c.osvDb) : ""} ${c.gcve != null ? kv("GCVE advisories", c.gcve) : ""}
|
|
2847
|
+
${kv("OSV", c.osv)} ${c.advisoryQueryTtlHours != null ? kv("Advisory query TTL (hours)", c.advisoryQueryTtlHours) : ""} ${kv("NVD", c.nvd)} ${kv("EPSS", c.epss)} ${kv("KEV", c.kev)} ${kv("licenses", c.licenses)} ${kv("typosquat", c.typosquat)}
|
|
2783
2848
|
${kv("fail-on", c.failOn)}${c.ignoreFile ? " " + kv("ignore", c.ignoreFile) : ""}${c.vexFile ? " " + kv("vex", c.vexFile) : ""}
|
|
2784
2849
|
${kv("runtime", `${rt.node || "?"} · ${rt.platform || "?"}/${rt.arch || "?"}`)}
|
|
2785
2850
|
</div>`;
|
|
2786
2851
|
}
|
|
2787
2852
|
const intro = `<div class="fp-intro">${t("How this report was produced and what it does <strong>not</strong> cover — stated for audit transparency and reproducibility. The data-source table shows the freshness of every feed used; the configuration line records the run's findings-affecting options. An <code>--offline</code> re-run against the same cache (ship it with <code>--export-cache</code>) reproduces these findings.")}</div>`;
|
|
2853
|
+
const sourceNoteText = message => {
|
|
2854
|
+
const gcve=/^Partial source coverage: (\d+|unknown) GNA source\(s\) not collected; (\d+) source records lack explicit package coordinates\. These records are not necessarily relevant to this project\.$/.exec(message);
|
|
2855
|
+
if (gcve) return t('Partial source coverage: {missing} GNA source(s) not collected; {unindexed} source records lack explicit package coordinates. These records are not necessarily relevant to this project.',{missing:gcve[1],unindexed:gcve[2]});
|
|
2856
|
+
const nvd=/^NVD returned no record for (\d+) package-linked CVE\(s\) at the last consultation\.$/.exec(message);
|
|
2857
|
+
if (nvd) return t('NVD returned no record for {n} package-linked CVE(s) at the last consultation.',{n:nvd[1]});
|
|
2858
|
+
if (message === 'Some product-only candidates lack a reliable Maven package identity; independent OSV evidence is used when available.') return t('Some product-only candidates lack a reliable Maven package identity; independent OSV evidence is used when available.');
|
|
2859
|
+
if (message === 'The Maven lookup uses a partial native or legacy projection; some source records may not be represented.') return t(message);
|
|
2860
|
+
return t(message);
|
|
2861
|
+
};
|
|
2862
|
+
const sourceNotes = Array.isArray(prov?.sourceLimitations) && prov.sourceLimitations.length
|
|
2863
|
+
? `<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>` : '';
|
|
2864
|
+
const depthNote = prov?.mavenDepthLimitReached ? `<p>${esc(t("The configured Maven transitive depth was reached; deeper dependencies were not explored."))}</p>` : '';
|
|
2788
2865
|
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>`;
|
|
2789
|
-
return intro + sourcesTable + cfgHtml + limitations;
|
|
2866
|
+
return intro + sourcesTable + cfgHtml + depthNote + sourceNotes + limitations;
|
|
2790
2867
|
}
|
|
2791
2868
|
|
|
2792
2869
|
// Differential-audit chapter (vs --baseline): what changed since the prior findings JSON.
|
|
@@ -3260,7 +3337,15 @@ function generateHtmlReport(payload) {
|
|
|
3260
3337
|
const body = injectColgroups(buildBody(payload));
|
|
3261
3338
|
return `<!doctype html>
|
|
3262
3339
|
<html lang="${esc(RENDER_CTX.locale)}"><head><meta charset="utf-8"><title>${t("VigieVuln Report")}</title><style>${CSS}</style></head>
|
|
3263
|
-
<body>${body}${browserI18nScript()}${TOGGLE_SCRIPT}${COPY_SCRIPT}${CHART_COPY_SCRIPT}
|
|
3340
|
+
<body>${body}${browserI18nScript()}${TOGGLE_SCRIPT}${COPY_SCRIPT}${CHART_COPY_SCRIPT}<script>
|
|
3341
|
+
document.querySelectorAll('time[datetime]').forEach(function (el) {
|
|
3342
|
+
var date = new Date(el.getAttribute('datetime'));
|
|
3343
|
+
if (Number.isNaN(date.getTime())) return;
|
|
3344
|
+
el.textContent = new Intl.DateTimeFormat(document.documentElement.lang || undefined, {
|
|
3345
|
+
year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', timeZoneName: 'short'
|
|
3346
|
+
}).format(date);
|
|
3347
|
+
});
|
|
3348
|
+
</script></body></html>`;
|
|
3264
3349
|
}
|
|
3265
3350
|
|
|
3266
3351
|
// Word-specific CSS tweaks layered on top of the shared CSS:
|
|
@@ -3458,12 +3543,14 @@ async function writeReports({ cveMatches, devCveMatches, embeddedMatches, retire
|
|
|
3458
3543
|
}
|
|
3459
3544
|
|
|
3460
3545
|
module.exports = {
|
|
3546
|
+
mergeMatches,
|
|
3461
3547
|
descriptorCount, // exported so the descriptor-naming rule is testable
|
|
3462
3548
|
computeStats,
|
|
3463
3549
|
buildEmbeddedInventory,
|
|
3464
3550
|
generateHtmlReport,
|
|
3465
3551
|
generateWordReport,
|
|
3466
3552
|
writeReports,
|
|
3553
|
+
freshnessNotice,
|
|
3467
3554
|
depDisplayName,
|
|
3468
3555
|
depDisplayParts,
|
|
3469
3556
|
esc,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// CVE's versionType determines the ordering. Return null whenever neither an
|
|
4
|
+
// affected nor an unaffected verdict can be proved, rather than guessing.
|
|
5
|
+
const {compareMavenVersions} = require('./maven-version');
|
|
6
|
+
const mavenVersion = value => typeof value === 'string' && /^[0-9][A-Za-z0-9._+-]*$/.test(value) && !/\d{16}/.test(value) && !/\.{2}|\+{2}|-{2}|_{2}/.test(value);
|
|
7
|
+
|
|
8
|
+
function comparator(type) {
|
|
9
|
+
const t=String(type || '').toLowerCase();
|
|
10
|
+
if (t === '' || t === 'maven') return (a,b) => mavenVersion(a) && mavenVersion(b) ? compareMavenVersions(a,b) : null;
|
|
11
|
+
if (t === 'semver') return (a,b) => {
|
|
12
|
+
const result=require('./osv-db').compareSemver(a,b);
|
|
13
|
+
if (result !== null) return result;
|
|
14
|
+
// Some CNAs label Maven milestones such as 9.0.0.M1 as semver. Even
|
|
15
|
+
// without interpreting the qualifier, distinct numeric cores are ordered.
|
|
16
|
+
const core=s=>/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:[.-][A-Za-z0-9][A-Za-z0-9.-]*)?$/.exec(s);
|
|
17
|
+
const x=core(a),y=core(b);if(!x||!y)return null;
|
|
18
|
+
if (a === b) return 0;
|
|
19
|
+
for(let i=1;i<=3;i++){const n=BigInt(x[i]),m=BigInt(y[i]);if(n!==m)return n<m?-1:1;}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Return true/false for membership in an entry, or null if unprovable. */
|
|
26
|
+
function rangeMembership(version, spec) {
|
|
27
|
+
if (!spec || typeof spec !== 'object' || Array.isArray(spec)) return null;
|
|
28
|
+
if (typeof spec.version !== 'string' || !spec.version || spec.version === '*') return null;
|
|
29
|
+
if (spec.lessThan != null && spec.lessThanOrEqual != null) return null;
|
|
30
|
+
const lower=spec.version, upper=spec.lessThan ?? spec.lessThanOrEqual;
|
|
31
|
+
// An exact literal needs no ordering rule: even an unspecified/custom
|
|
32
|
+
// version scheme can establish that the very same version is affected.
|
|
33
|
+
// A different literal still needs the scheme's comparison semantics.
|
|
34
|
+
if (upper == null && String(spec.versionType || '').toLowerCase() !== 'git' && typeof version === 'string' && version === lower && mavenVersion(version)) return true;
|
|
35
|
+
const cmp=comparator(spec.versionType); if(!cmp || typeof version!=='string' || cmp(version,version)!==0) return null;
|
|
36
|
+
const compare=(a,b)=>a==='0'||b==='0' ? (a===b?0:a==='0'?-1:1) : cmp(a,b);
|
|
37
|
+
if (upper != null && (typeof upper !== 'string' || !upper)) return null;
|
|
38
|
+
if (upper && upper !== '*') {
|
|
39
|
+
const ordering=compare(lower,upper);
|
|
40
|
+
if (ordering !== null && (ordering > 0 || (ordering === 0 && spec.lessThan != null))) return null;
|
|
41
|
+
const hi=compare(version,upper);
|
|
42
|
+
if (hi !== null && (spec.lessThan != null ? hi >= 0 : hi > 0)) return false;
|
|
43
|
+
}
|
|
44
|
+
const lo=compare(version,lower); if(lo==null) return null;
|
|
45
|
+
if (upper == null) return lo===0;
|
|
46
|
+
// A valid lower bound already excludes earlier versions. Do not let an
|
|
47
|
+
// unreadable upper bound in a different release branch mask a real hit.
|
|
48
|
+
if (lo < 0) return false;
|
|
49
|
+
if (upper === '*') return lo>=0;
|
|
50
|
+
const hi=compare(version,upper); if(hi==null) return null;
|
|
51
|
+
const ordering=compare(lower,upper); if(ordering==null || ordering>0 || (ordering===0 && spec.lessThan != null)) return null;
|
|
52
|
+
return lo>=0 && (spec.lessThan!=null ? hi<0 : hi<=0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** CVE range statuses can overlap: contradictory or unknown statuses are unknown. */
|
|
56
|
+
function affectedVerdict(version, ranges, defaultStatus = 'unaffected') {
|
|
57
|
+
if (!Array.isArray(ranges)) return null;
|
|
58
|
+
if (!mavenVersion(String(version))) return null;
|
|
59
|
+
if (!ranges.length && arguments.length < 3) return null;
|
|
60
|
+
let affected=false, unaffected=false, unknown=false;
|
|
61
|
+
for(const r of ranges) {
|
|
62
|
+
const status=String(r?.status || '').toLowerCase();
|
|
63
|
+
const membership=rangeMembership(String(version),r);
|
|
64
|
+
if(membership===null) {unknown=true;continue;}
|
|
65
|
+
if(!membership) continue;
|
|
66
|
+
if(status==='affected')affected=true;
|
|
67
|
+
else if(status==='unaffected')unaffected=true;
|
|
68
|
+
else unknown=true;
|
|
69
|
+
}
|
|
70
|
+
if(affected && (unaffected||unknown)) return null;
|
|
71
|
+
if(affected) return true;
|
|
72
|
+
if(unknown) return null;
|
|
73
|
+
if(unaffected) return false;
|
|
74
|
+
const fallback=String(defaultStatus || 'unknown').toLowerCase();
|
|
75
|
+
return fallback==='affected' ? true : fallback==='unaffected' ? false : null;
|
|
76
|
+
}
|
|
77
|
+
module.exports={comparator,rangeMembership,affectedVerdict};
|