vigievuln 1.3.0 → 1.3.1
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 +7 -1054
- package/README.md +36 -69
- package/lib/artifacts/applications.js +6 -2
- package/lib/artifacts/component-scope.js +31 -0
- package/lib/artifacts/enrichment.js +1 -0
- package/lib/artifacts/inventory-scope.js +50 -0
- package/lib/artifacts/report-inventory.js +1 -1
- package/lib/artifacts/report.js +14 -6
- package/lib/artifacts/scan.js +25 -15
- package/lib/charts.js +20 -3
- package/lib/cve-record-coverage.js +109 -0
- package/lib/cve-report.js +85 -26
- 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 +14 -1
- package/lib/json-export.js +5 -3
- package/lib/nvd.js +52 -16
- package/lib/providers/index.js +6 -6
- package/lib/report-notices.js +38 -3
- package/lib/source-health.js +47 -23
- package/lib/system-inventory/advisories.js +7 -6
- package/lib/system-inventory/alpine-tracker.js +5 -5
- package/lib/system-inventory/distribution-sources.js +1 -1
- package/package.json +1 -1
- package/vigievuln.js +29 -15
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Record retrieval is distinct from dependency/advisory discovery. These facts
|
|
3
|
+
// describe already identified CVEs and must not invalidate inventory coverage.
|
|
4
|
+
const {failureKey}=require('./providers/common');
|
|
5
|
+
const recordSources=new Set(['nvd','euvd','euvd-details']);
|
|
6
|
+
const cveIds=cve=>[...new Set([cve?.id,...(cve?.aliases||[]),...(cve?.upstream||[])]
|
|
7
|
+
.filter(id=>typeof id==='string' && /^CVE-\d{4}-\d{4,}$/i.test(id)).map(id=>id.toUpperCase()))];
|
|
8
|
+
function reasonOf(value,fallback='unavailable') {
|
|
9
|
+
const text=String(value?.reason||value?.failure?.reason||value||'');
|
|
10
|
+
const status=value?.failure?.status || value?.statusCode || (typeof value?.status==='number'?value.status:null);
|
|
11
|
+
if(status===429 || /429|rate.limit/i.test(text))return 'rate limit';
|
|
12
|
+
if(/offline/i.test(text))return 'offline';
|
|
13
|
+
if(/disabled|excluded/i.test(text))return 'disabled';
|
|
14
|
+
if(/not.consulted/i.test(text))return 'not consulted';
|
|
15
|
+
if(/no.match|not.listed|not.found|404/i.test(text))return 'not listed';
|
|
16
|
+
if(/timeout|timed.out|ETIMEDOUT/i.test(text))return 'timeout';
|
|
17
|
+
if(status===403 || /403|forbidden/i.test(text))return 'access denied';
|
|
18
|
+
if(/invalid|malformed|mismatch/i.test(text))return 'invalid response';
|
|
19
|
+
if(/budget|request.limit/i.test(text))return 'request limit';
|
|
20
|
+
if(/stale|freshness|timestamp/i.test(text))return 'freshness unconfirmed';
|
|
21
|
+
const http=/HTTP\s*(\d{3})/i.exec(text);if(http)return `HTTP ${http[1]}`;
|
|
22
|
+
if(/network|unreachable|ENOTFOUND|ECONN/i.test(text))return 'network error';
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
function summarizeCveRecords(matches=[],opts={}) {
|
|
26
|
+
const selected=opts.enrich;
|
|
27
|
+
const enabled=name=>opts[name]!==false && (!Array.isArray(selected)||selected.includes(name));
|
|
28
|
+
const active={nvd:enabled('nvd'),euvd:enabled('euvd')};
|
|
29
|
+
const byId=new Map(),keys=new Set();
|
|
30
|
+
const consultations=opts.coverage||[];
|
|
31
|
+
for(const check of consultations)if(recordSources.has(check.collector))for(const key of check.requestKeys||[])keys.add(key);
|
|
32
|
+
function store(id,source,state){
|
|
33
|
+
if(!byId.has(id))byId.set(id,{id});
|
|
34
|
+
const record=byId.get(id),old=record[source];
|
|
35
|
+
// Different components can reference the same CVE: one usable record covers it.
|
|
36
|
+
const rank=s=>s.status==='available'?(s.stale?3:4):s.status==='no-match'?2:1;
|
|
37
|
+
const failures=[...new Set([...(old?.refreshFailureReasons||[]),...(state.refreshFailed?[state.reason||'unavailable']:[])])].sort();
|
|
38
|
+
const best=!old || rank(state)>rank(old)?state:old;
|
|
39
|
+
record[source]={...best,...(failures.length?{refreshFailed:true,refreshFailureReasons:failures}:{})};
|
|
40
|
+
}
|
|
41
|
+
for(const match of matches){const cve=match.cve||{},ids=cveIds(cve);
|
|
42
|
+
for(const id of ids){
|
|
43
|
+
const evidence=(cve.cveEvidence||[]).find(e=>String(e.id).toUpperCase()===id)||{};
|
|
44
|
+
const nvd=evidence.nvdRecordEvidence || (String(cve.id).toUpperCase()===id?cve.nvdRecordEvidence:null);
|
|
45
|
+
const nvdRecord=cve.nvdEvidence?.records?.some(r=>String(r.id).toUpperCase()===id);
|
|
46
|
+
const euvdEvidence=evidence.euvdDetailsEvidence || (ids.length===1?cve.euvdDetailsEvidence:null)||{};
|
|
47
|
+
const mapping=evidence.euvdEvidence || (ids.length===1?cve.euvdEvidence:null)||{};
|
|
48
|
+
const detail=evidence.euvdDetails || (ids.length===1?cve.euvdDetails:null);
|
|
49
|
+
const hasDetail=!!detail && /^EUVD-\d{4}-\d+$/.test(detail.id||'');
|
|
50
|
+
const sourceFailure=consultations.find(c=>['euvd','euvd-details'].includes(c.collector)&&['failed','partial'].includes(c.execution));
|
|
51
|
+
const euvdReason=euvdEvidence.failure || euvdEvidence.reason || mapping.reason || (mapping.status==='no-match'?'not listed':null) || (opts.offline?'offline':sourceFailure?.reason);
|
|
52
|
+
const states={nvd:nvd || (nvdRecord?{status:'available'}:{status:'unavailable',reason:opts.offline?'offline':'not consulted'}),
|
|
53
|
+
euvd:{status:hasDetail?'available':mapping.status==='no-match'?'no-match':'unavailable',stale:!!euvdEvidence.stale,
|
|
54
|
+
refreshFailed:!!mapping.refreshFailed || (hasDetail && !!euvdEvidence.failure),...((!hasDetail || euvdEvidence.stale || mapping.refreshFailed)?{reason:reasonOf(euvdReason)}:{})}};
|
|
55
|
+
for(const source of ['nvd','euvd']){const state=states[source];store(id,source,active[source]?{...state,...((state.reason || state.status!=='available')?{reason:reasonOf(state.reason,state.status==='no-match'?'not listed':'unavailable')}:{})}:{status:'disabled',reason:'disabled'});}
|
|
56
|
+
if(active.nvd){keys.add(failureKey('nvd','cve',{id}));keys.add(failureKey('nvd','cve-mirror',{id}));}
|
|
57
|
+
const euvdId=detail?.id || evidence.euvd?.id || (ids.length===1?cve.euvd?.id:null);
|
|
58
|
+
if(active.euvd && euvdId)keys.add(failureKey('euvd','vulnerability',{id:euvdId}));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const records=[...byId.values()].sort((a,b)=>a.id.localeCompare(b.id));
|
|
62
|
+
const groups={neither:[],nvdOnly:[],euvdOnly:[],refreshFailed:[],stale:[]};
|
|
63
|
+
for(const r of records){const n=r.nvd.status==='available',e=r.euvd.status==='available';
|
|
64
|
+
if(!n&&!e)groups.neither.push(r);else if(n&&!e)groups.nvdOnly.push(r);else if(e&&!n)groups.euvdOnly.push(r);
|
|
65
|
+
if(r.nvd.refreshFailed||r.euvd.refreshFailed)groups.refreshFailed.push(r);
|
|
66
|
+
if(r.nvd.stale||r.euvd.stale)groups.stale.push(r);
|
|
67
|
+
}
|
|
68
|
+
const counts=Object.fromEntries(Object.entries(groups).map(([key,rows])=>[key,rows.length]));
|
|
69
|
+
const reasons=(rows,sources)=>{const tally=new Map();for(const r of rows){const values=new Set(sources.filter(s=>active[s]&&r[s].status!=='available').map(s=>`${s.toUpperCase()}: ${r[s].reason}`));for(const v of values)tally.set(v,(tally.get(v)||0)+1);}return [...tally].sort().map(([k,n])=>`${k} ${n}`).join(', ');};
|
|
70
|
+
const problem=(active.nvd||active.euvd) && (counts.neither || (active.euvd&&counts.nvdOnly) || (active.nvd&&counts.euvdOnly) || counts.refreshFailed || counts.stale);
|
|
71
|
+
const parts=[];
|
|
72
|
+
if(counts.neither)parts.push(`${counts.neither} CVE record(s) obtained from neither NVD nor EUVD (${reasons(groups.neither,['nvd','euvd'])})`);
|
|
73
|
+
if(active.euvd && counts.nvdOnly)parts.push(`${counts.nvdOnly} obtained from NVD only (${reasons(groups.nvdOnly,['euvd'])})`);
|
|
74
|
+
if(active.nvd && counts.euvdOnly)parts.push(`${counts.euvdOnly} obtained from EUVD only (${reasons(groups.euvdOnly,['nvd'])})`);
|
|
75
|
+
if(counts.refreshFailed){const why=[...new Set(groups.refreshFailed.flatMap(r=>['nvd','euvd'].flatMap(source=>(r[source].refreshFailureReasons||[]).map(reason=>`${source.toUpperCase()}: ${reason}`))))].sort();parts.push(`${counts.refreshFailed} CVE record update(s) failed (${why.join(', ')})`);}
|
|
76
|
+
if(counts.stale)parts.push(`${counts.stale} CVE(s) use cached records with unconfirmed freshness`);
|
|
77
|
+
const affected=new Set([...groups.neither,...(active.euvd?groups.nvdOnly:[]),...(active.nvd?groups.euvdOnly:[]),...groups.refreshFailed,...groups.stale].map(r=>r.id));
|
|
78
|
+
const warning=problem?{type:'cve-enrichment-summary',severity:'warning',affectsCompleteness:false,count:affected.size,consultedCount:records.length,
|
|
79
|
+
counts,records,requestKeys:[...keys],message:`CVE records: ${parts.join('; ')}. Existing findings are retained; this describes enrichment only.`}:null;
|
|
80
|
+
return {warning,records,requestKeys:[...keys],coverage:{capability:'enrichment',collector:'cve-records',affectsCompleteness:false,
|
|
81
|
+
execution:!active.nvd&&!active.euvd?'not-applicable':counts.neither?'partial':'completed',...(!active.nvd&&!active.euvd?{expected:false}:{}),count:records.length,available:records.length-counts.neither,missing:counts.neither}};
|
|
82
|
+
}
|
|
83
|
+
// Report-owned wording only: never translate or reproduce upstream text.
|
|
84
|
+
function formatCveRecordWarning(warning, locale='en') {
|
|
85
|
+
if(!String(locale).toLowerCase().startsWith('fr'))return warning.message || '';
|
|
86
|
+
const records=warning.records || [],counts=warning.counts || {};
|
|
87
|
+
const active=source=>records.some(r=>r[source] && r[source].status!=='disabled');
|
|
88
|
+
const names={ 'rate limit':'limite de débit',offline:'hors ligne',disabled:'désactivé','not consulted':'non consulté','not listed':'non répertorié',timeout:'délai dépassé','access denied':'accès refusé','invalid response':'réponse invalide','request limit':'limite de requêtes','freshness unconfirmed':'actualisation non confirmée','network error':'erreur réseau',unavailable:'indisponible' };
|
|
89
|
+
const label=reason=>names[reason] || (/^HTTP \d{3}$/.test(reason||'')?reason:'indisponible');
|
|
90
|
+
const reasons=(rows,sources)=>{
|
|
91
|
+
const tally=new Map();
|
|
92
|
+
for(const r of rows)for(const source of sources)if(active(source)&&r[source]?.status!=='available'){
|
|
93
|
+
const text=`${source.toUpperCase()} : ${label(r[source]?.reason)}`;tally.set(text,(tally.get(text)||0)+1);
|
|
94
|
+
}
|
|
95
|
+
return [...tally].sort().map(([text,n])=>`${text} ${n}`).join(', ');
|
|
96
|
+
};
|
|
97
|
+
const groups={neither:records.filter(r=>r.nvd?.status!=='available'&&r.euvd?.status!=='available'),nvdOnly:records.filter(r=>r.nvd?.status==='available'&&r.euvd?.status!=='available'),euvdOnly:records.filter(r=>r.euvd?.status==='available'&&r.nvd?.status!=='available')};
|
|
98
|
+
const parts=[];
|
|
99
|
+
if(counts.neither)parts.push(`${counts.neither} fiche(s) CVE obtenue(s) ni auprès de NVD ni auprès d’EUVD (${reasons(groups.neither,['nvd','euvd'])})`);
|
|
100
|
+
if(active('euvd')&&counts.nvdOnly)parts.push(`${counts.nvdOnly} obtenue(s) uniquement auprès de NVD (${reasons(groups.nvdOnly,['euvd'])})`);
|
|
101
|
+
if(active('nvd')&&counts.euvdOnly)parts.push(`${counts.euvdOnly} obtenue(s) uniquement auprès d’EUVD (${reasons(groups.euvdOnly,['nvd'])})`);
|
|
102
|
+
if(counts.refreshFailed){
|
|
103
|
+
const why=[...new Set(records.flatMap(r=>['nvd','euvd'].flatMap(source=>(r[source]?.refreshFailureReasons||[]).map(reason=>`${source.toUpperCase()} : ${label(reason)}`))))].sort();
|
|
104
|
+
parts.push(`${counts.refreshFailed} actualisation(s) de fiche CVE échouée(s) (${why.join(', ')})`);
|
|
105
|
+
}
|
|
106
|
+
if(counts.stale)parts.push(`${counts.stale} CVE utilisent des fiches en cache dont l’actualisation n’est pas confirmée`);
|
|
107
|
+
return `Fiches CVE : ${parts.join(' ; ')}. Les résultats existants sont conservés ; cet avertissement concerne uniquement l’enrichissement.`;
|
|
108
|
+
}
|
|
109
|
+
module.exports={summarizeCveRecords,formatCveRecordWarning,cveIds,recordSources};
|
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; }
|
|
@@ -1673,7 +1677,7 @@ function summaryCards(stats, eol, obs, out, extra = {}) {
|
|
|
1673
1677
|
{ v: extra.imageCount, l: t("Image findings") },
|
|
1674
1678
|
...(extra.sourceCount ? [{ v: extra.sourceCount, l: t("Source findings") }] : []),
|
|
1675
1679
|
...(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") }]),
|
|
1680
|
+
] : extra.hasSourceProject === false ? [] : [{ v: stats.direct, l: t("in Direct") }, { v: stats.transitive, l: t("in Transitive") }]),
|
|
1677
1681
|
{ v: extra.vendored ?? 0, l: t("Vendored JS"), cls: "sev-vendored" },
|
|
1678
1682
|
{ v: eol?.length || 0, l: t("EOL") },
|
|
1679
1683
|
{ v: obs?.length || 0, l: t("Obsolete") },
|
|
@@ -1695,7 +1699,7 @@ function mergeMatches(matches) {
|
|
|
1695
1699
|
for (const m of matches) {
|
|
1696
1700
|
// A finding with a physical occurrence ID must never be merged with a
|
|
1697
1701
|
// 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]);
|
|
1702
|
+
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
1703
|
if (!byKey.has(key)) {
|
|
1700
1704
|
// Deep-ish copy so we can mutate dep.viaPaths
|
|
1701
1705
|
byKey.set(key, { ...m, dep: { ...m.dep, viaPaths: m.dep.viaPaths ? [...m.dep.viaPaths] : (m.dep.via ? [m.dep.via] : []) } });
|
|
@@ -2006,8 +2010,11 @@ function numberedSubsections(chapter, entries) {
|
|
|
2006
2010
|
}
|
|
2007
2011
|
|
|
2008
2012
|
const WARNING_HEADINGS = {
|
|
2013
|
+
"cve-enrichment-summary": { icon: "ℹ️", title: "CVE records" },
|
|
2009
2014
|
"image-scan-failed": { icon: "⚠️", title: "Image analysis blocked" },
|
|
2010
|
-
"
|
|
2015
|
+
"image-source-unavailable": { icon: "⚠️", title: "Unavailable from public sources" },
|
|
2016
|
+
"source-unavailable": { icon: "⚠️", title: "Source data unavailable" },
|
|
2017
|
+
"no-lockfile": { icon: "⚠️", title: "Manifests without a lockfile — best-effort" },
|
|
2011
2018
|
"parse-error": { icon: "⚠️", title: "Manifests that failed to parse — contents not scanned" },
|
|
2012
2019
|
"yarn-berry-unsupported": { icon: "⚠️", title: "Yarn 2+/Berry lockfile" },
|
|
2013
2020
|
"unresolved-versions": { icon: "⚠️", title: "Maven deps without a concrete version — silently skipped, run a real Maven/Snyk scan to complete" },
|
|
@@ -2167,7 +2174,7 @@ function execWeakness(m) {
|
|
|
2167
2174
|
return m.cve.id || t("an unspecified weakness");
|
|
2168
2175
|
}
|
|
2169
2176
|
|
|
2170
|
-
function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, nativeBinaryCount = 0, hasImages = false, interactive = false }) {
|
|
2177
|
+
function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, topImageMatches, nativeBinaryCount = 0, hasImages = false, interactive = false }) {
|
|
2171
2178
|
const unsN = (eolResults || []).filter(e => e.status === "unsupported").length;
|
|
2172
2179
|
const eolN = (eolResults?.length || 0) - unsN; // true end-of-life only
|
|
2173
2180
|
const obsN = obsoleteResults?.length || 0;
|
|
@@ -2183,6 +2190,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2183
2190
|
else if (prodStats.total > 0) level = "UNKNOWN";
|
|
2184
2191
|
|
|
2185
2192
|
const top = topCriticalMatches || [];
|
|
2193
|
+
const imageTop = topImageMatches || [];
|
|
2186
2194
|
const topEol = pickTopEol(eolResults, 2);
|
|
2187
2195
|
|
|
2188
2196
|
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 +2198,9 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2190
2198
|
// ---- Block 1: the 3 most critical (direct prod, transitive fallback) ----
|
|
2191
2199
|
// Each row lists ALL of its CWEs right beside it (the weakness fingerprint
|
|
2192
2200
|
// 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">${
|
|
2201
|
+
const renderTop = (entries, heading) => entries.length ? `<div class="exec-top">
|
|
2202
|
+
<div class="exec-top-title">${heading}</div>
|
|
2203
|
+
<ul class="exec-top-list">${entries.map(m => {
|
|
2196
2204
|
const cwes = Array.isArray(m.cve.cwes) ? m.cve.cwes : [];
|
|
2197
2205
|
const cweChips = cwes.length ? `<span class="exec-cwes-chips">${cwes.map(c => cweChipHtml(c, cweName(c))).join("")}</span>` : "";
|
|
2198
2206
|
const transitiveTag = !m.dep?.artifactTargetId && m.dep?.scope === "transitive"
|
|
@@ -2208,6 +2216,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2208
2216
|
</li>`;
|
|
2209
2217
|
}).join("")}</ul>
|
|
2210
2218
|
</div>` : "";
|
|
2219
|
+
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 }));
|
|
2220
|
+
const imageHeading = t("Top {n} most critical · images to update", { n: imageTop.length });
|
|
2221
|
+
const imageLine = group => {
|
|
2222
|
+
const artifact = group.artifact, update = artifact.imageUpdate;
|
|
2223
|
+
const target = update?.status === 'available' && update.targetTag && update.targetReference ? update.targetReference : null;
|
|
2224
|
+
return { title: require('./artifacts/report').artifactTitle(artifact, projectInfo?.artifacts || []), target, matches: group.matches };
|
|
2225
|
+
};
|
|
2226
|
+
const imageLines = imageTop.map(imageLine);
|
|
2227
|
+
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
2228
|
|
|
2212
2229
|
// ---- Block 2: the 2 most-overdue end-of-life frameworks ----
|
|
2213
2230
|
const eolWhen = e => e.status === "unsupported"
|
|
@@ -2225,7 +2242,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2225
2242
|
|
|
2226
2243
|
// ---- Block 3: totals, including the findings highlighted above ----
|
|
2227
2244
|
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})`);
|
|
2245
|
+
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
2246
|
if (devStats.total) restParts.push(`<strong>${devStats.total}</strong> ${t("dev/test CVE")}`);
|
|
2230
2247
|
if (retireStats.total) restParts.push(`<strong>${retireStats.total}</strong> ${t("vulnerable vendored-JS")}`);
|
|
2231
2248
|
if (eolN) restParts.push(`<strong>${eolN}</strong> ${eolN > 1 ? t("EOL frameworks") : t("EOL framework")}`);
|
|
@@ -2242,13 +2259,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2242
2259
|
let copyUi = "";
|
|
2243
2260
|
if (interactive) {
|
|
2244
2261
|
const stripTags = s => s.replace(/<[^>]+>/g, "");
|
|
2245
|
-
const
|
|
2262
|
+
const sentences = entries => entries.map(m => ({
|
|
2246
2263
|
lib: depDisplayName(m.dep),
|
|
2247
2264
|
ver: m.dep.version || "?",
|
|
2248
2265
|
weakness: execWeakness(m),
|
|
2249
2266
|
crit: (m.cve.severity || "HIGH").toUpperCase(),
|
|
2250
2267
|
transitive: !m.dep?.artifactTargetId && m.dep?.scope === "transitive",
|
|
2251
2268
|
}));
|
|
2269
|
+
const topSentences = sentences(top);
|
|
2270
|
+
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
2271
|
const eolSentence = e => {
|
|
2253
2272
|
const when = e.eol && e.eol !== "true" ? t("end-of-life since {date}", { date: e.eol }) : t("end-of-life");
|
|
2254
2273
|
const head = t('"{product}" ({dep}) is {when}', {
|
|
@@ -2271,6 +2290,10 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2271
2290
|
plainLines.push("", critHeading(topSentences.length));
|
|
2272
2291
|
for (const x of topSentences) plainLines.push(`- ${critSentence(x)}${x.transitive ? ` [${t("transitive")}]` : ""}`);
|
|
2273
2292
|
}
|
|
2293
|
+
if (imageSentences.length) {
|
|
2294
|
+
plainLines.push("", imageHeading);
|
|
2295
|
+
for (const x of imageSentences) plainLines.push(`- ${x}`);
|
|
2296
|
+
}
|
|
2274
2297
|
if (topEol.length) {
|
|
2275
2298
|
plainLines.push("", eolHeading(topEol.length));
|
|
2276
2299
|
for (const e of topEol) plainLines.push(eolSentence(e));
|
|
@@ -2282,9 +2305,9 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2282
2305
|
// The rich flavour bolds the values, so the sentence is translated with placeholder
|
|
2283
2306
|
// markers and the markers are then replaced by the bolded values. Building it by
|
|
2284
2307
|
// 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;">${
|
|
2308
|
+
const richTopList = (entries, heading) => entries.length
|
|
2309
|
+
? `<p style="font-weight:bold; margin:12px 0 4px;">${esc(heading)}</p>
|
|
2310
|
+
<ul style="margin:0; padding-left:22px;">${entries.map(x => {
|
|
2288
2311
|
const marks = { lib: "\u0001", ver: "\u0002", weakness: "\u0003", crit: "\u0004" };
|
|
2289
2312
|
let line = esc(t('The library "{lib}" version "{ver}" is vulnerable to "{weakness}" ( {crit} )', marks));
|
|
2290
2313
|
line = line.replace(marks.lib, `<b>${esc(x.lib)}</b>`).replace(marks.ver, `<b>${esc(x.ver)}</b>`)
|
|
@@ -2300,7 +2323,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2300
2323
|
const richHtml = `<div style="font-family:Calibri,Arial,sans-serif; font-size:11pt; color:#1f2937;">`
|
|
2301
2324
|
+ `<p style="font-size:14pt; font-weight:bold; margin:0 0 2px;">${esc(t("Executive Summary"))} — ${esc(level)}</p>`
|
|
2302
2325
|
+ `<p style="margin:0 0 8px; color:#4b5563;">${esc(totalDeps)} ${esc(t("dependencies scanned"))}</p>`
|
|
2303
|
-
+
|
|
2326
|
+
+ 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
2327
|
|
|
2305
2328
|
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
2329
|
+ `<template class="exec-copy-rich">${richHtml}</template>`
|
|
@@ -2315,12 +2338,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
|
|
|
2315
2338
|
</div>
|
|
2316
2339
|
<div class="exec-meta">${esc(totalDeps)} ${t("dependencies scanned")}</div>
|
|
2317
2340
|
${topBlock}
|
|
2341
|
+
${imageTopBlock}
|
|
2318
2342
|
${eolBlock}
|
|
2319
2343
|
${restBlock}
|
|
2320
2344
|
</div>`;
|
|
2321
2345
|
}
|
|
2322
2346
|
|
|
2323
2347
|
function warningMessage(w) {
|
|
2348
|
+
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."));
|
|
2349
|
+
if (w.type === "cve-enrichment-summary") return esc(require('./cve-record-coverage').formatCveRecordWarning(w, RENDER_CTX.locale));
|
|
2324
2350
|
if (w.type === "commercial-build") {
|
|
2325
2351
|
const until = w.until && w.until !== "true" ? t(" (until {date})", { date: esc(w.until) }) : "";
|
|
2326
2352
|
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 +2374,9 @@ function renderWarnings(warnings) {
|
|
|
2348
2374
|
// intentionally broken CMS test fixture — are grouped into one navigable block per
|
|
2349
2375
|
// type. Every manifest stays listed with its own detail, and the JSON export keeps one
|
|
2350
2376
|
// entry per manifest, so the grouping hides noise without hiding coverage loss.
|
|
2351
|
-
const
|
|
2352
|
-
const
|
|
2377
|
+
const {groupReportWarnings,warningScope} = require('./report-notices');
|
|
2378
|
+
const prepared = groupReportWarnings(warnings);
|
|
2379
|
+
const renderBlock = w => {
|
|
2353
2380
|
const meta = WARNING_HEADINGS[w.type] || { icon: "⚠️", title: w.type };
|
|
2354
2381
|
const itemLimit = w._groupedDiagnostics ? (w.items||[]).length : w.type === "private-libs" ? 200 : 50;
|
|
2355
2382
|
const warningItems = [...(w.items || []), ...(w.artifactTargetId ? [{id:w.artifactTargetId,artifactTargetId:w.artifactTargetId}] : [])];
|
|
@@ -2366,8 +2393,17 @@ function renderWarnings(warnings) {
|
|
|
2366
2393
|
<div class="warn-msg">${message}</div>
|
|
2367
2394
|
${items}
|
|
2368
2395
|
</div>`;
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2396
|
+
};
|
|
2397
|
+
const groups = [
|
|
2398
|
+
{scope:'project', label:t('Project scan warnings')},
|
|
2399
|
+
{scope:'image', label:t('Image scan warnings')},
|
|
2400
|
+
{scope:'global', label:t('Shared source warnings')},
|
|
2401
|
+
];
|
|
2402
|
+
const sections = groups.map(({scope,label}) => {
|
|
2403
|
+
const entries=prepared.filter(w => warningScope(w)===scope);
|
|
2404
|
+
return entries.length ? `<section class="warning-scope warning-scope-${scope}"><h3>${esc(label)}</h3>${entries.map(renderBlock).join('')}</section>` : '';
|
|
2405
|
+
}).join('');
|
|
2406
|
+
return `<div class="warnings warnings-chapter">${sections}</div>`;
|
|
2371
2407
|
}
|
|
2372
2408
|
|
|
2373
2409
|
/**
|
|
@@ -2473,9 +2509,15 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2473
2509
|
// Recos are built from prod matches only (dev/test issues aren't a release blocker).
|
|
2474
2510
|
const sourceMatches = prodMatchesActive.filter(m => !m.dep?.artifactTargetId);
|
|
2475
2511
|
const recos = buildFixRecommendations(sourceMatches, outdatedResults, resolvedDeps);
|
|
2476
|
-
const imageMatches = [...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(m => m.dep?.artifactTargetId);
|
|
2512
|
+
const imageMatches = mergeMatches([...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(m => m.dep?.artifactTargetId));
|
|
2513
|
+
// Image inventory findings are presented together regardless of the input
|
|
2514
|
+
// lane. Count each of those occurrences once in the overview as well.
|
|
2515
|
+
const overviewProdStats = computeStats([...sourceMatches, ...imageMatches]);
|
|
2516
|
+
const overviewDevStats = computeStats(devMatchesActive.filter(m => !m.dep?.artifactTargetId));
|
|
2477
2517
|
const { renderImageCves, renderArtifactEvidence, artifactGroups, artifactAnchor, artifactTitle } = require("./artifacts/report");
|
|
2478
2518
|
const hasImages = Boolean(projectInfo?.artifacts?.length || projectInfo?.imageReferences?.length || rawImageMatches.length);
|
|
2519
|
+
const hasScannedImages = Boolean(projectInfo?.artifacts?.length || rawImageMatches.length);
|
|
2520
|
+
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
2521
|
const chapterOffset = hasImages ? 1 : 0;
|
|
2480
2522
|
const sourceDeps = new Map([...(resolvedDeps || [])].filter(([, d]) => !d.artifactTargetId));
|
|
2481
2523
|
|
|
@@ -2524,11 +2566,12 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2524
2566
|
const nativeBinaryCount = [...(resolvedDeps?.values?.() || [])].filter(d => d.provenance === "binary" && !d.artifactTargetId).length;
|
|
2525
2567
|
|
|
2526
2568
|
const exec = renderExecutiveSummary({
|
|
2527
|
-
projectInfo, prodStats, devStats, retireStats,
|
|
2569
|
+
projectInfo, prodStats: overviewProdStats, devStats: overviewDevStats, retireStats,
|
|
2528
2570
|
eolResults, obsoleteResults, outdatedResults,
|
|
2529
2571
|
warnings: generalWarnings, totalDeps: resolvedDeps?.size || 0,
|
|
2530
|
-
topCriticalMatches: pickTopCriticalMatches(
|
|
2531
|
-
|
|
2572
|
+
topCriticalMatches: hasSourceProject ? pickTopCriticalMatches(sourceMatches, 3) : [],
|
|
2573
|
+
topImageMatches: pickTopImages(projectInfo, imageMatches, 3),
|
|
2574
|
+
nativeBinaryCount, hasImages: hasScannedImages,
|
|
2532
2575
|
interactive: wrapTables, // copy button + scripts only in the HTML output
|
|
2533
2576
|
});
|
|
2534
2577
|
|
|
@@ -2645,7 +2688,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2645
2688
|
// its path relative to the scan root. Single-descriptor scans keep the scope chart.
|
|
2646
2689
|
// moduleNames was resolved at the top of buildBody — every table is rendered by then.
|
|
2647
2690
|
const chartsRow = renderCharts(
|
|
2648
|
-
{ prodMatches:
|
|
2691
|
+
{ prodMatches: [...sourceMatches, ...imageMatches], artifacts: projectInfo.artifacts || [], hasImages: hasScannedImages, hasSourceProject, moduleNames, descriptorCount: moduleNames.size,
|
|
2649
2692
|
applications, applicationInventory, coverage },
|
|
2650
2693
|
{ interactive: wrapTables, t, cweName: id => cweTitle(id).name });
|
|
2651
2694
|
|
|
@@ -2659,7 +2702,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
|
|
|
2659
2702
|
</div>
|
|
2660
2703
|
</header>
|
|
2661
2704
|
${exec}
|
|
2662
|
-
${summaryCards(
|
|
2705
|
+
${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
2706
|
${chartsRow}
|
|
2664
2707
|
${toc}
|
|
2665
2708
|
${toolbar}
|
|
@@ -2717,6 +2760,22 @@ function pickTopCriticalMatches(prodMatches, n) {
|
|
|
2717
2760
|
return out;
|
|
2718
2761
|
}
|
|
2719
2762
|
|
|
2763
|
+
// Rank distinct images by their worst severity, then composite finding priority.
|
|
2764
|
+
function pickTopImages(projectInfo, matches, limit) {
|
|
2765
|
+
const {artifactGroups}=require('./artifacts/report');
|
|
2766
|
+
const severity={CRITICAL:5,HIGH:4,MEDIUM:3,LOW:2,NONE:1,UNKNOWN:0};
|
|
2767
|
+
const compare=(a,b)=>(severity[(b.cve?.severity || 'UNKNOWN').toUpperCase()] || 0)-(severity[(a.cve?.severity || 'UNKNOWN').toUpperCase()] || 0) || byCvePriority(a,b);
|
|
2768
|
+
return artifactGroups(projectInfo,matches).map(group=>{
|
|
2769
|
+
const seen=new Set(), ranked=[];
|
|
2770
|
+
for(const match of group.matches.slice().sort(compare)) {
|
|
2771
|
+
const id=String(match.cve?.id || '').toUpperCase();
|
|
2772
|
+
if(!/^CVE-\d{4}-\d{4,}$/.test(id) || seen.has(id))continue;
|
|
2773
|
+
seen.add(id); ranked.push(match); if(ranked.length===3)break;
|
|
2774
|
+
}
|
|
2775
|
+
return {...group,matches:ranked};
|
|
2776
|
+
}).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);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2720
2779
|
/**
|
|
2721
2780
|
* The 2 (or N) most significant end-of-life findings for the exec summary:
|
|
2722
2781
|
* direct frameworks first, then the most overdue (oldest EOL date). Findings
|
|
@@ -2975,7 +3034,7 @@ function renderMethodologyChapter(projectInfo, {freshnessNotices = [], informati
|
|
|
2975
3034
|
? `<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
3035
|
const depthNote = prov?.mavenDepthLimitReached ? `<p>${esc(t("The configured Maven transitive depth was reached; deeper dependencies were not explored."))}</p>` : '';
|
|
2977
3036
|
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>` : '';
|
|
3037
|
+
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
3038
|
return intro + sourcesTable + cfgHtml + renderFreshnessNotices(freshnessNotices) + observations + depthNote + sourceNotes + limitations;
|
|
2980
3039
|
}
|
|
2981
3040
|
|
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",
|
|
@@ -573,7 +586,7 @@ const fr = {
|
|
|
573
586
|
"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
587
|
|
|
575
588
|
// ---- Chapter 0 — scan warnings ----
|
|
576
|
-
"Manifests without a lockfile — best-effort
|
|
589
|
+
"Manifests without a lockfile — best-effort": "Manifestes sans lockfile — résolution au mieux",
|
|
577
590
|
"Manifests that failed to parse — contents not scanned": "Manifestes illisibles — contenu non analysé",
|
|
578
591
|
"Yarn 2+/Berry lockfile": "Lockfile Yarn 2+/Berry",
|
|
579
592
|
"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/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} : {}),
|
|
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",
|