vigievuln 1.2.0 → 1.3.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 +23 -2
- package/README.md +13 -7
- package/lib/advisory-freshness.js +2 -0
- package/lib/airgap-project.js +35 -7
- package/lib/applicability-evidence.js +12 -0
- package/lib/artifacts/applications.js +54 -0
- package/lib/artifacts/cve-view.js +108 -0
- package/lib/artifacts/enrichment.js +86 -0
- package/lib/artifacts/go-main-identity.js +45 -0
- package/lib/artifacts/go-publisher-advisories.js +24 -0
- package/lib/artifacts/index.js +272 -0
- package/lib/artifacts/publisher-advisories.js +12 -0
- package/lib/artifacts/remediation-report.js +48 -0
- package/lib/artifacts/report-inventory.js +26 -0
- package/lib/artifacts/report.js +191 -0
- package/lib/artifacts/risk-report.js +120 -0
- package/lib/artifacts/sbom.js +68 -0
- package/lib/artifacts/scan.js +401 -0
- package/lib/cache-archive-sqlite.js +41 -25
- package/lib/certs/analyze.js +49 -13
- package/lib/charts.js +124 -32
- package/lib/cli-command-routing.js +20 -6
- package/lib/cli-groups.js +2 -1
- package/lib/cli-image.js +206 -0
- package/lib/codecs/binary/elf-metadata.js +42 -0
- package/lib/codecs/binary/go-buildinfo.js +37 -0
- package/lib/codecs/binary/metadata.js +7 -0
- package/lib/codecs/binary/pe-metadata.js +27 -1
- package/lib/codecs/binary/scan.js +44 -26
- package/lib/codecs/binary/sniff.js +16 -15
- package/lib/codecs/binary.codec.js +27 -4
- package/lib/codecs/go/parse.js +10 -4
- package/lib/codecs/go.codec.js +23 -6
- package/lib/codecs/gradle/parse.js +63 -2
- package/lib/codecs/gradle/versionless.js +175 -0
- package/lib/codecs/gradle.codec.js +20 -3
- package/lib/codecs/index.js +2 -2
- package/lib/codecs/maven.codec.js +9 -4
- package/lib/codecs/npm/collect.js +6 -11
- package/lib/codecs/nuget/parse.js +16 -5
- package/lib/codecs/nuget.codec.js +2 -1
- package/lib/codecs/pypi/parse.js +56 -15
- package/lib/codecs/pypi.codec.js +2 -0
- package/lib/csaf-export.js +46 -11
- package/lib/cve-download.js +33 -29
- package/lib/cve-match.js +10 -0
- package/lib/cve-packages-proxy.js +19 -0
- package/lib/cve-report.js +273 -165
- package/lib/deps-descriptor.js +25 -3
- package/lib/diagnostics.js +12 -0
- package/lib/diff.js +0 -0
- package/lib/epss.js +6 -6
- package/lib/euvd.js +34 -4
- package/lib/finding-enrichment.js +165 -0
- package/lib/finding-summary.js +4 -3
- package/lib/i18n.js +35 -9
- package/lib/image-network.js +54 -0
- package/lib/image-references.js +203 -0
- package/lib/image-registry.js +385 -0
- package/lib/image-update.js +39 -0
- package/lib/json-export.js +100 -10
- package/lib/kev.js +6 -6
- package/lib/maven-bom.js +2 -1
- package/lib/merge-sources.js +3 -0
- package/lib/native-advisories.js +9 -7
- package/lib/native-cna-identities.js +12 -0
- package/lib/native-package-match.js +159 -0
- package/lib/native-source-prepare.js +60 -0
- package/lib/nvd.js +34 -23
- package/lib/osv.js +33 -14
- package/lib/project-descriptor.js +3 -2
- package/lib/provenance.js +8 -2
- package/lib/providers/alpine.js +8 -0
- package/lib/providers/common.js +11 -3
- package/lib/providers/debian.js +11 -0
- package/lib/providers/euvd.js +2 -1
- package/lib/providers/freexian.js +13 -0
- package/lib/providers/github.js +1 -0
- package/lib/providers/go.js +2 -1
- package/lib/providers/index.js +18 -14
- package/lib/providers/nginx.js +5 -0
- package/lib/providers/nvd.js +1 -1
- package/lib/providers/osv.js +1 -1
- package/lib/providers/osvdb.js +2 -2
- package/lib/proxy-throttle.js +89 -29
- package/lib/purl.js +10 -2
- package/lib/record-freshness.js +22 -0
- package/lib/report-notices.js +47 -0
- package/lib/report-time.js +45 -0
- package/lib/request-failure.js +22 -0
- package/lib/resource-cache/engine.js +130 -26
- package/lib/resource-cache/snapshot-projection.js +33 -0
- package/lib/resource-cache/validate.js +22 -5
- package/lib/risk-evidence.js +18 -0
- package/lib/sarif-export.js +17 -9
- package/lib/sbom-export.js +38 -12
- package/lib/source-health.js +25 -8
- package/lib/source-image-scan.js +57 -0
- package/lib/source-profile.js +6 -3
- package/lib/sqlite-driver.js +15 -1
- package/lib/suppress.js +34 -13
- package/lib/system-inventory/advisories.js +169 -0
- package/lib/system-inventory/alpine-tracker.js +47 -0
- package/lib/system-inventory/collect.js +118 -0
- package/lib/system-inventory/current-debian.js +99 -0
- package/lib/system-inventory/distribution-sources.js +132 -0
- package/lib/system-inventory/freexian-ela.js +32 -0
- package/lib/system-inventory/freexian-release-evidence.js +35 -0
- package/lib/system-inventory/freexian-tracker.js +72 -0
- package/lib/system-inventory/historical-debian.js +196 -0
- package/lib/system-inventory/index.js +2 -0
- package/lib/system-inventory/nginx-advisories.js +39 -0
- package/lib/system-inventory/rpm-storage.js +86 -0
- package/lib/system-inventory/targeted.js +70 -0
- package/lib/system-inventory/versions.js +59 -0
- package/lib/transitive.js +11 -2
- package/lib/ui.js +8 -5
- package/lib/unmanaged.js +1 -1
- package/lib/xlsx-export.js +8 -2
- package/package.json +12 -3
- package/vigievuln.js +279 -127
package/lib/deps-descriptor.js
CHANGED
|
@@ -25,7 +25,7 @@ const SCHEMA = "fad-deps/1";
|
|
|
25
25
|
// databases and to group the report. Anything path/URL/host-bearing is dropped:
|
|
26
26
|
// manifestPath(s) / pomPaths, resolved (registry URL), integrity, from
|
|
27
27
|
// (parent chain), depth, lockType.
|
|
28
|
-
const ANON_NOTE = "Dependency coordinates and filtered version hints only. Private coordinates cannot be identified offline: exclude them and review before transfer.";
|
|
28
|
+
const ANON_NOTE = "Dependency coordinates and filtered version hints only. Private coordinates and image references cannot be identified offline: exclude them and review before transfer.";
|
|
29
29
|
|
|
30
30
|
function cleanVersion(value) {
|
|
31
31
|
if (typeof value !== "string") return null;
|
|
@@ -70,8 +70,28 @@ function cleanCoord(c) {
|
|
|
70
70
|
? { groupId: String(c.groupId), artifactId: String(c.artifactId), version: cleanVersion(c.version) } : null;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
// Registry references may themselves reveal private image names or hosts: they
|
|
74
|
+
// follow the descriptor's existing review-before-transfer policy.
|
|
75
|
+
function serializeImageReferences(items, {images=true}={}) {
|
|
76
|
+
if(images===false)return [];
|
|
77
|
+
if(!Array.isArray(items))return [];
|
|
78
|
+
const out=[],seen=new Set();
|
|
79
|
+
for(const item of items){
|
|
80
|
+
if(!item || item.scanEligible===false || item.localBuild || (item.classification && item.classification!=='registry') || (Array.isArray(item.unresolved)&&item.unresolved.length))continue;
|
|
81
|
+
const reference=typeof item.reference==='string'?item.reference.trim():'';
|
|
82
|
+
if(!reference || reference.length>1024 || /[$\x00-\x20\x7f]/.test(reference))continue;
|
|
83
|
+
try{require('./image-registry').parseReference(reference)}catch{continue}
|
|
84
|
+
const platform=item.platform == null ? null : typeof item.platform==='string' && /^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)?$/.test(item.platform) ? item.platform : false;
|
|
85
|
+
if(platform===false)continue;
|
|
86
|
+
const record={reference,...(platform?{platform}:{})};
|
|
87
|
+
const key=JSON.stringify(record);if(!seen.has(key)){seen.add(key);out.push(record);}
|
|
88
|
+
}
|
|
89
|
+
return out.sort((a,b)=>JSON.stringify(a).localeCompare(JSON.stringify(b)));
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
function serializeDeps(resolvedMap, opts = {}) {
|
|
74
93
|
const { generator = "vigievuln", generatedAt = new Date().toISOString(), note = ANON_NOTE } = opts;
|
|
94
|
+
const imageReferences=serializeImageReferences(opts.imageReferences,{images:opts.images});
|
|
75
95
|
const deps = [];
|
|
76
96
|
const byEcosystem = {};
|
|
77
97
|
for (const d of resolvedMap.values()) {
|
|
@@ -129,6 +149,7 @@ function serializeDeps(resolvedMap, opts = {}) {
|
|
|
129
149
|
summary: { total: deps.length, byEcosystem, ...(applications.length ? { applications: applications.length } : {}) },
|
|
130
150
|
...(hasMavenHints ? { maven: { externalParents, importBoms, propertyOverrides, ...(opts.reactor ? { reactor: opts.reactor } : {}) } } : {}),
|
|
131
151
|
...(applications.length ? { applications } : {}),
|
|
152
|
+
...(imageReferences.length ? { imageReferences } : {}),
|
|
132
153
|
deps,
|
|
133
154
|
};
|
|
134
155
|
}
|
|
@@ -139,7 +160,7 @@ function serializeDeps(resolvedMap, opts = {}) {
|
|
|
139
160
|
* Rebuilds depRecords with EMPTY manifestPaths (the descriptor carries none) and
|
|
140
161
|
* a RECOMPUTED coordKey (never trusts the input). Throws on schema mismatch.
|
|
141
162
|
*/
|
|
142
|
-
function deserializeDeps(descriptor) {
|
|
163
|
+
function deserializeDeps(descriptor, opts = {}) {
|
|
143
164
|
if (!descriptor || typeof descriptor !== "object") throw new Error("invalid descriptor: not an object");
|
|
144
165
|
if (descriptor.schema !== SCHEMA) {
|
|
145
166
|
throw new Error(`unsupported descriptor schema: got "${descriptor.schema}", expected "${SCHEMA}"`);
|
|
@@ -191,7 +212,8 @@ function deserializeDeps(descriptor) {
|
|
|
191
212
|
propertyOverrides: (mvn.propertyOverrides && typeof mvn.propertyOverrides === "object") ? mvn.propertyOverrides : {},
|
|
192
213
|
reactor: mvn.reactor ? require('./maven-airgap').restoreReactorHints(mvn.reactor) : null,
|
|
193
214
|
applications,
|
|
215
|
+
imageReferences: serializeImageReferences(descriptor.imageReferences,{images:opts.images}),
|
|
194
216
|
};
|
|
195
217
|
}
|
|
196
218
|
|
|
197
|
-
module.exports = { serializeDeps, deserializeDeps, filterVersionProperties, cleanVersion, SCHEMA, ANON_NOTE };
|
|
219
|
+
module.exports = { serializeDeps, deserializeDeps, serializeImageReferences, filterVersionProperties, cleanVersion, SCHEMA, ANON_NOTE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Informational observations describe the chosen scan context, not failed work.
|
|
4
|
+
// Keep them available for provenance without counting them as alerts or gaps.
|
|
5
|
+
const isInformational = diagnostic => diagnostic?.severity === 'info' || (!diagnostic?.severity &&
|
|
6
|
+
(diagnostic?.informational === true || diagnostic?.reason === 'image-content-unverified'));
|
|
7
|
+
function partitionDiagnostics(diagnostics = []) {
|
|
8
|
+
const warnings = [], notices = [];
|
|
9
|
+
for (const diagnostic of diagnostics) (isInformational(diagnostic) ? notices : warnings).push(diagnostic);
|
|
10
|
+
return {warnings, notices};
|
|
11
|
+
}
|
|
12
|
+
module.exports = {isInformational, partitionDiagnostics};
|
package/lib/diff.js
CHANGED
|
Binary file
|
package/lib/epss.js
CHANGED
|
@@ -20,14 +20,14 @@ const CACHE_TTL_MS = 4 * 3600 * 1000;
|
|
|
20
20
|
const EPSS_BASE = "https://api.first.org/data/v1/epss";
|
|
21
21
|
const BATCH = 100;
|
|
22
22
|
|
|
23
|
-
function loadCache() {
|
|
24
|
-
try { return require('./cache-repository').createCacheRepository(
|
|
23
|
+
function loadCache(cacheDir = CACHE_DIR) {
|
|
24
|
+
try { return require('./cache-repository').createCacheRepository(cacheDir).get('catalogue','epss')?.value || { meta: { fetchedAt: 0 }, entries: {} }; }
|
|
25
25
|
catch { return { meta: { fetchedAt: 0 }, entries: {} }; }
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function saveCache(data) {
|
|
28
|
+
function saveCache(data, cacheDir = CACHE_DIR) {
|
|
29
29
|
try {
|
|
30
|
-
require('./cache-repository').createCacheRepository(
|
|
30
|
+
require('./cache-repository').createCacheRepository(cacheDir).put('catalogue','epss',data,{fetchedAt:data.meta?.fetchedAt||Date.now()});
|
|
31
31
|
} catch { /* ignore */ }
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -62,7 +62,7 @@ async function enrichEpss(matches, opts = {}) {
|
|
|
62
62
|
for (const m of matches || []) if (m.cve?.id?.startsWith("CVE-")) ids.add(m.cve.id);
|
|
63
63
|
if (!ids.size) return matches;
|
|
64
64
|
|
|
65
|
-
const cache = loadCache();
|
|
65
|
+
const cache = loadCache(opts.cacheDir);
|
|
66
66
|
const strictHosted = !offline && require("./providers").hasHostedProxy();
|
|
67
67
|
const fresh = !strictHosted && cache.meta?.fetchedAt && require('./cache-policy').fresh(cache.meta.fetchedAt, CACHE_TTL_MS);
|
|
68
68
|
const previous = !fresh && !offline ? {entries:cache.entries, fetchedAt:cache.meta?.fetchedAt} : null;
|
|
@@ -111,7 +111,7 @@ async function enrichEpss(matches, opts = {}) {
|
|
|
111
111
|
// Hosted responses must still be persisted for an air-gapped scan. The
|
|
112
112
|
// strict hosted path above revalidates online and never trusts this cache
|
|
113
113
|
// as a substitute for contacting the selected proxy.
|
|
114
|
-
if (!offline) { require('./cache-policy').preserveEntries(cache, previous); saveCache(cache); }
|
|
114
|
+
if (!offline) { require('./cache-policy').preserveEntries(cache, previous); saveCache(cache, opts.cacheDir); }
|
|
115
115
|
|
|
116
116
|
for (const m of matches || []) {
|
|
117
117
|
const v = byId.get(m.cve?.id);
|
package/lib/euvd.js
CHANGED
|
@@ -59,6 +59,30 @@ function euvdDate(raw) {
|
|
|
59
59
|
return `${m[3]}-${String(MONTHS[m[1]]).padStart(2, "0")}-${m[2].padStart(2, "0")}`;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** Convert ENISA dates to an unzoned calendar day without inventing UTC. */
|
|
63
|
+
function normalizeEuvdCalendarDate(raw) {
|
|
64
|
+
const value=typeof raw==='string'?raw.trim():'';
|
|
65
|
+
const iso=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/.exec(value);
|
|
66
|
+
const day=iso?.[1] || euvdDate(value);if(!day)return null;
|
|
67
|
+
const parsed=new Date(day+'T00:00:00Z');
|
|
68
|
+
if(!Number.isFinite(parsed.getTime()) || parsed.toISOString().slice(0,10)!==day)return null;
|
|
69
|
+
if(iso){if(iso[2] && (+iso[2]>23 || +iso[3]>59 || +(iso[4]||0)>59))return null;return value;}
|
|
70
|
+
const clock=/^[A-Z][a-z]{2} \d{1,2}, \d{4}, (\d{1,2}):(\d{2}):(\d{2}) (AM|PM)$/i.exec(value);
|
|
71
|
+
if(!clock)return /^[A-Z][a-z]{2} \d{1,2}, \d{4}$/.test(value) ? day : null;
|
|
72
|
+
const h=Number(clock[1]),m=Number(clock[2]),sec=Number(clock[3]);if(h<1||h>12||m>59||sec>59)return null;
|
|
73
|
+
const hour=(h%12)+(clock[4].toUpperCase()==='PM'?12:0);
|
|
74
|
+
return `${day}T${String(hour).padStart(2,'0')}:${clock[2]}:${clock[3]}`;
|
|
75
|
+
}
|
|
76
|
+
function normalizeEuvdDetailDates(detail) {
|
|
77
|
+
if(!detail || typeof detail!=='object')return detail;
|
|
78
|
+
const out={...detail};
|
|
79
|
+
for(const key of ['published','modified']){
|
|
80
|
+
const raw=detail[key] ?? detail[key+'Original'];
|
|
81
|
+
if(raw!=null){out[key]=normalizeEuvdCalendarDate(raw) || raw;if(out[key+'Original']==null && out[key]!==raw)out[key+'Original']=raw;}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
62
86
|
/** Pure: one exploited-search page → { "CVE-…": "YYYY-MM-DD" | "" } (every CVE alias). */
|
|
63
87
|
function parseExploitedPage(json) {
|
|
64
88
|
const out = {};
|
|
@@ -103,9 +127,10 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
103
127
|
if (hostedProxy && !offline) {
|
|
104
128
|
const ids = [...new Set(matches.map(m => m.cve?.id).filter(id => /^CVE-\d{4}-\d{4,7}$/.test(id || "")))];
|
|
105
129
|
const byId = new Map();
|
|
130
|
+
opts.onEnrichmentProgress?.({source:'euvd',completed:0,total:ids.length});
|
|
106
131
|
for (let i = 0; i < ids.length; i += 100) {
|
|
107
132
|
const res = await require("./providers").getResource("euvd", "cves", { ids: ids.slice(i, i + 100) }, { fetcher, noStore: true, streaming: true });
|
|
108
|
-
if (!res.ok) throw
|
|
133
|
+
if (!res.ok) throw require('./request-failure').responseError('EUVD mapping',res,{viaProxy:true});
|
|
109
134
|
const data = await res.json();
|
|
110
135
|
if (!Array.isArray(data.items)) throw new Error("invalid hosted EUVD response");
|
|
111
136
|
const requested=ids.slice(i,i+100), requestedSet=new Set(requested);
|
|
@@ -117,7 +142,12 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
117
142
|
const rawDate=res.headers?.get?.('x-fad-proxy-fetched-at'),parsed=Date.parse(rawDate||'');
|
|
118
143
|
const fetchedAt=Number.isFinite(parsed)&&parsed>0&&parsed<=Date.now()+300000 ? parsed : null;
|
|
119
144
|
const stale=res.headers?.get?.('x-fad-proxy')==='stale' || fetchedAt===null;
|
|
120
|
-
for (const id of requested)
|
|
145
|
+
for (const id of requested) {
|
|
146
|
+
const item=received.get(id)||null, old=targeted.entries[id];
|
|
147
|
+
const preserve=old?.details && item?.id && old.details.id===item.id;
|
|
148
|
+
targeted.entries[id]={item,fetchedAt,stale,...(preserve?{details:old.details,detailsFetchedAt:old.detailsFetchedAt,detailsStale:old.detailsStale,detailsOrigin:old.detailsOrigin,detailsFailure:old.detailsFailure}:{})};
|
|
149
|
+
}
|
|
150
|
+
opts.onEnrichmentProgress?.({source:'euvd',completed:Math.min(i+100,ids.length),total:ids.length});
|
|
121
151
|
}
|
|
122
152
|
repository.put('catalogue','euvd-targeted',targeted);
|
|
123
153
|
for (const m of matches) {
|
|
@@ -148,7 +178,7 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
148
178
|
body = await fetchSnapshot({ fetcher, verbose });
|
|
149
179
|
writeCache(cacheDir, body);
|
|
150
180
|
} catch (err) {
|
|
151
|
-
if (verbose)
|
|
181
|
+
if (verbose) require('./ui').networkNotice(` EUVD fetch failed: ${err.message}${body ? " — serving the cached snapshot" : ""}`);
|
|
152
182
|
}
|
|
153
183
|
}
|
|
154
184
|
if (!body?.byCve) return matches;
|
|
@@ -164,4 +194,4 @@ async function enrichEuvd(matches, opts = {}) {
|
|
|
164
194
|
return matches;
|
|
165
195
|
}
|
|
166
196
|
|
|
167
|
-
module.exports = { enrichEuvd, fetchSnapshot, parseMappingCsv, parseExploitedPage, euvdDate, CACHE_FILE };
|
|
197
|
+
module.exports = { enrichEuvd, fetchSnapshot, parseMappingCsv, parseExploitedPage, euvdDate, normalizeEuvdCalendarDate, normalizeEuvdDetailDates, CACHE_FILE };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Shared European context for already identified CVEs. This module does not
|
|
3
|
+
// discover package vulnerabilities or change version applicability.
|
|
4
|
+
const {createCacheRepository}=require('./cache-repository');
|
|
5
|
+
const {getCacheDir}=require('./cache-directory');
|
|
6
|
+
const TTL=4*3600*1000;
|
|
7
|
+
const CVE=/^CVE-\d{4}-\d{4,}$/i;
|
|
8
|
+
const ids=c=>[...new Set([c?.id,...(c?.aliases||[]),...(c?.upstream||[])].filter(x=>typeof x==='string'&&CVE.test(x)).map(x=>x.toUpperCase()))];
|
|
9
|
+
function record(cve,id){if(!Array.isArray(cve.cveEvidence))cve.cveEvidence=[];let entry=cve.cveEvidence.find(x=>x.id===id);if(!entry){entry={id};cve.cveEvidence.push(entry);}return entry;}
|
|
10
|
+
function assign(matches,id,key,value){
|
|
11
|
+
for(const m of matches){if(!ids(m.cve).includes(id))continue;record(m.cve,id)[key]=value;
|
|
12
|
+
const c=m.cve,identity=String(c.id||'').toUpperCase()===id || (ids(c).length===1 && (c.aliases||[]).some(x=>String(x).toUpperCase()===id));
|
|
13
|
+
if(identity)c[key]=value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function responseTime(res){const at=Date.parse(res.headers?.get?.('x-fad-proxy-fetched-at')||'');const valid=Number.isFinite(at)&&at>0&&at<=Date.now()+300000;return {fetchedAt:valid?at:null,stale:!valid||res.headers?.get?.('x-fad-proxy')==='stale'};}
|
|
17
|
+
function freshness(stamp,stale,offline=false){return !!stale || !stamp || (!offline && Date.now()-stamp>=TTL);}
|
|
18
|
+
function severityFromScore(score){return score>=9?'CRITICAL':score>=7?'HIGH':score>=4?'MEDIUM':score>0?'LOW':'NONE';}
|
|
19
|
+
async function boundedJson(response,maxBytes){
|
|
20
|
+
const budgetError=()=>{const error=Error(`EUVD response exceeds the scanner's ${maxBytes}-byte metadata budget`);error.code='metadata-budget-exceeded';return error;};
|
|
21
|
+
const declared=Number(response.headers?.get?.('content-length'));if(declared>maxBytes){await response.body?.cancel();throw budgetError();}
|
|
22
|
+
if(!response.body)throw Error('empty EUVD metadata response');let length=0;const chunks=[];
|
|
23
|
+
for await(const part of response.body){length+=part.length;if(length>maxBytes)throw budgetError();chunks.push(Buffer.from(part));}
|
|
24
|
+
try{return JSON.parse(Buffer.concat(chunks).toString('utf8'));}catch{throw Error('invalid EUVD metadata JSON');}
|
|
25
|
+
}
|
|
26
|
+
function parseEuvdDetail(body,id,cve){
|
|
27
|
+
if(!body || body.id!==id)throw Error('EUVD metadata identifier mismatch');
|
|
28
|
+
const aliases=Array.isArray(body.aliases)?body.aliases:typeof body.aliases==='string'?body.aliases.split(/[\s,]+/):[];
|
|
29
|
+
if(!aliases.some(alias=>String(alias).toUpperCase()===cve))throw Error('EUVD metadata lacks the requested CVE identity');
|
|
30
|
+
const score=typeof body.baseScore==='number' && Number.isFinite(body.baseScore) && body.baseScore>=0 && body.baseScore<=10?body.baseScore:null;
|
|
31
|
+
const version=typeof body.baseScoreVersion==='string' && /^\d+(?:\.\d+)?$/.test(body.baseScoreVersion)?`CVSS:${body.baseScoreVersion}`:null;
|
|
32
|
+
const text=(x,max)=>typeof x==='string' && x.length<=max ? x : null;
|
|
33
|
+
const rawRefs=Array.isArray(body.references)?body.references:typeof body.references==='string'?body.references.split(/\s+/):[];
|
|
34
|
+
const references=rawRefs.map(x=>typeof x==='string'?x:x?.url).filter(x=>typeof x==='string').slice(0,1000).filter(x=>{try{const u=new URL(x);return ['http:','https:'].includes(u.protocol)&&!u.username&&!u.password;}catch{return false;}});
|
|
35
|
+
const date=raw=>require('./euvd').normalizeEuvdCalendarDate(text(raw,128));
|
|
36
|
+
return {id,source:'euvd',description:text(body.description,100000),score,severity:score===null?null:severityFromScore(score),cvssVersion:version,
|
|
37
|
+
cvssVector:text(body.baseScoreVector,1024),published:date(body.datePublished),modified:date(body.dateUpdated),publishedOriginal:text(body.datePublished,128),modifiedOriginal:text(body.dateUpdated,128),references};
|
|
38
|
+
}
|
|
39
|
+
function applyEuvdDetails(matches,id,detail){
|
|
40
|
+
detail=require('./euvd').normalizeEuvdDetailDates(detail);
|
|
41
|
+
for(const m of matches){if(!ids(m.cve).includes(id))continue;const c=m.cve;record(c,id).euvdDetails=detail;
|
|
42
|
+
if(ids(c).length!==1)continue;
|
|
43
|
+
const identity=String(c.id||'').toUpperCase()===id || (c.aliases||[]).some(x=>String(x).toUpperCase()===id);
|
|
44
|
+
c.euvdDetails=detail;
|
|
45
|
+
if(!c.description && detail.description)c.description=detail.description;
|
|
46
|
+
if(c.riskEvidence && c.riskEvidence.source!=='euvd')continue;
|
|
47
|
+
const knownSeverity=!!c.severity && String(c.severity).toUpperCase()!=='UNKNOWN';
|
|
48
|
+
const compatible=!knownSeverity || !detail.severity || String(c.severity).toUpperCase()===detail.severity;
|
|
49
|
+
let filled=false;
|
|
50
|
+
if(c.score==null && detail.score!=null && compatible){c.score=detail.score;c.scoreSource='euvd';filled=true;}
|
|
51
|
+
if(c.scoreSource==='euvd'){
|
|
52
|
+
if(!knownSeverity && detail.severity){c.severity=detail.severity;c.severitySource='euvd';filled=true;}
|
|
53
|
+
if(!c.cvssVector && detail.cvssVector)c.cvssVector=detail.cvssVector;
|
|
54
|
+
if(!c.cvssVersion && detail.cvssVersion)c.cvssVersion=detail.cvssVersion;
|
|
55
|
+
}
|
|
56
|
+
if(filled)c.riskEvidence={source:'euvd',id,relationship:identity?'identity':'upstream'};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const europeanAdapters=[
|
|
61
|
+
{id:'gcve',async run(matches,opts,context){for(const id of context.ids){const value=require('./gcve').gcveId(id);if(!value)continue;
|
|
62
|
+
for(const m of matches){const c=m.cve;if(!ids(c).includes(id))continue;const entry=record(c,id);entry.gcveAlias=value;entry.gcveEvidence={kind:'derived-alias',source:'gcve-rules'};
|
|
63
|
+
const identity=String(c.id||'').toUpperCase()===id || (ids(c).length===1 && (c.aliases||[]).some(x=>String(x).toUpperCase()===id));
|
|
64
|
+
if(identity && !c.gcve){c.gcve=value;c.gcveEvidence=entry.gcveEvidence;}
|
|
65
|
+
}
|
|
66
|
+
}return {result:'derived-alias',count:context.ids.length};}},
|
|
67
|
+
{id:'euvd',async run(matches,opts,context){
|
|
68
|
+
const copies=context.ids.map(id=>({cve:{id}}));
|
|
69
|
+
await require('./euvd').enrichEuvd(copies,{...opts,hostedProxy:context.hosted});
|
|
70
|
+
const targeted=context.repo.get('catalogue','euvd-targeted')?.value?.entries || {},bulkEntry=context.repo.get('catalogue','euvd'),bulk=bulkEntry?.value;
|
|
71
|
+
let consulted=0,stale=0,matched=0;
|
|
72
|
+
for(const copy of copies){const id=copy.cve.id,entry=targeted[id];let available=false,old=false;
|
|
73
|
+
if(entry && (opts.offline || context.hosted)){available=true;old=freshness(entry.fetchedAt,entry.stale,opts.offline);}
|
|
74
|
+
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});
|
|
77
|
+
if(copy.cve.euvd){assign(matches,id,'euvd',copy.cve.euvd);matched++;}
|
|
78
|
+
}
|
|
79
|
+
return {result:matched?'enriched':consulted===context.ids.length?'no-match':'unavailable',count:matched,consulted,missing:context.ids.length-consulted,stale};
|
|
80
|
+
}},
|
|
81
|
+
{id:'euvd-details',parent:'euvd',async run(matches,opts,context){
|
|
82
|
+
const stored=context.repo.get('catalogue','euvd-targeted')?.value || {entries:{}},pending=[],failures=[];let missing=0,stale=0,enriched=0;
|
|
83
|
+
// ENISA records include large product catalogues; real individual records
|
|
84
|
+
// exceed 12 MiB. Keep a configurable finite bound without truncating them.
|
|
85
|
+
const limit=opts.maxEuvdDetails ?? 10000,maxBytes=opts.maxEuvdMetadataBytes ?? 32*1024*1024;
|
|
86
|
+
if(!Number.isSafeInteger(limit)||limit<1||!Number.isSafeInteger(maxBytes)||maxBytes<1)throw Error('invalid EUVD metadata limits');
|
|
87
|
+
for(const id of context.ids){
|
|
88
|
+
const related=matches.filter(m=>ids(m.cve).includes(id));
|
|
89
|
+
const euvd=related.map(m=>m.cve.cveEvidence?.find(x=>x.id===id)?.euvd?.id).find(Boolean);
|
|
90
|
+
if(!euvd){assign(matches,id,'euvdDetailsEvidence',{status:'not-consulted'});continue;}
|
|
91
|
+
const old=stored.entries[id],detail=old?.details;
|
|
92
|
+
const stable=detail && !old?.detailsStale && old?.detailsFetchedAt > 0 && old.detailsFetchedAt <= Date.now() && old?.detailsOrigin === require('./providers').resourceOrigin() && require('./record-freshness').stableRecord('euvd',detail,opts);
|
|
93
|
+
if(detail && detail.id===euvd && (opts.offline || stable || (!opts.forceUpdate && (opts.reuseStableAdvisories === false || old.detailsOrigin === require('./providers').resourceOrigin()) && !freshness(old.detailsFetchedAt,old.detailsStale)))){applyEuvdDetails(matches,id,detail);enriched++;const oldStamp=stable ? false : freshness(old.detailsFetchedAt,old.detailsStale,opts.offline);const failure=oldStamp && old.detailsFailure;if(failure)failures.push(failure);assign(matches,id,'euvdDetailsEvidence',{status:'enriched',stale:oldStamp,...(failure?{failure}:{}),...(stable?{reusedStable:true,fetchedAt:old.detailsFetchedAt}: {})});if(oldStamp)stale++;continue;}
|
|
94
|
+
if(opts.offline){missing++;const failure=old?.detailsFailure;if(failure)failures.push(failure);assign(matches,id,'euvdDetailsEvidence',{status:'unavailable',...(failure?{failure}:{})});continue;}
|
|
95
|
+
if(pending.length>=limit){missing++;assign(matches,id,'euvdDetailsEvidence',{status:'unavailable',reason:'request-limit'});continue;}const observed=related.map(m=>m.cve.cveEvidence?.find(x=>x.id===id)?.euvd).find(Boolean);pending.push({id,euvd,observed});
|
|
96
|
+
}
|
|
97
|
+
let processed=0;
|
|
98
|
+
opts.onEnrichmentProgress?.({source:'euvd-details',completed:0,total:pending.length});
|
|
99
|
+
const limitWork=require('p-limit')(6);
|
|
100
|
+
await Promise.all(pending.map(item=>limitWork(async()=>{
|
|
101
|
+
try{
|
|
102
|
+
const res=await require('./providers').getResource('euvd','vulnerability',{id:item.euvd},{fetcher:opts.fetcher,streaming:true,noStore:true,forceRefresh:opts.forceUpdate || require('./cache-policy').shouldForceUpdate()});
|
|
103
|
+
if(!res.ok){await res.body?.cancel();throw require('./request-failure').responseError('EUVD detail',res,{viaProxy:require('./providers').hasProxyRoute()});}
|
|
104
|
+
const detail=parseEuvdDetail(await boundedJson(res,maxBytes),item.euvd,item.id);
|
|
105
|
+
const stamp=require('./providers').hasProxyRoute()?responseTime(res):{fetchedAt:Date.now(),stale:false};
|
|
106
|
+
const scope=res.headers.get('x-fad-proxy-scope'),checked=res.headers.get('x-fad-proxy-checked-at'),rawStaleReason=res.headers.get('x-fad-proxy-stale-reason');
|
|
107
|
+
const staleReason=rawStaleReason && /^[a-z0-9-]{1,80}$/.test(rawStaleReason) ? rawStaleReason : null;
|
|
108
|
+
const checkedAt=checked && Number.isFinite(Date.parse(checked)) ? new Date(Date.parse(checked)).toISOString() : null;
|
|
109
|
+
detail.provenance={resource:require('./providers/euvd').build('vulnerability',{id:item.euvd}).url,origin:require('./providers').resourceOrigin(),sourceScope:scope && scope.length<=256 ? scope : (require('./providers').hasProxyRoute() ? 'unspecified' : 'enisa-detail'),observedAt:stamp.fetchedAt ? new Date(stamp.fetchedAt).toISOString() : null,...(checkedAt?{checkedAt}:{}),...(staleReason?{staleReason}:{})};
|
|
110
|
+
const existing=stored.entries[item.id]||{},bulk=context.repo.get('catalogue','euvd')?.value;
|
|
111
|
+
const mappingAt=existing.fetchedAt || bulk?._fetchedAt || stamp.fetchedAt;
|
|
112
|
+
stored.entries[item.id]={...existing,item:existing.item || item.observed,fetchedAt:mappingAt,stale:existing.stale ?? freshness(mappingAt,false),details:detail,detailsFetchedAt:stamp.fetchedAt,detailsStale:stamp.stale,detailsOrigin:require('./providers').resourceOrigin()};delete stored.entries[item.id].detailsFailure;
|
|
113
|
+
let failure;if(stamp.stale && staleReason){const http=/^upstream-http-(\d{3})$/.exec(staleReason);failure={code:'source-refresh-failed',source:'euvd-details',status:http?Number(http[1]):null,requestKey:require('./providers/common').failureKey('euvd','vulnerability',{id:item.euvd}),reason:`EUVD mirror refresh failed (${staleReason}); cached detail retained`,resources:[item.euvd],attemptedAt:Date.now()};failures.push(failure);stored.entries[item.id].detailsFailure=failure;}
|
|
114
|
+
applyEuvdDetails(matches,item.id,detail);assign(matches,item.id,'euvdDetailsEvidence',{status:'enriched',stale:stamp.stale,...(failure?{failure}:{})});enriched++;if(stamp.stale)stale++;
|
|
115
|
+
}catch(error){const old=stored.entries[item.id]||{},failure={code:error.code||'source-request-failed',source:'euvd-details',status:error.status||null,requestKey:require('./providers/common').failureKey('euvd','vulnerability',{id:item.euvd}),...(error.layer?{layer:error.layer}:{}),...(error.retryAfterSeconds!=null?{retryAfterSeconds:error.retryAfterSeconds}:{}),reason:error.message,resources:[item.euvd],attemptedAt:Date.now()};failures.push(failure);stored.entries[item.id]={...old,item:old.item||item.observed,detailsFailure:failure};if(old.details?.id===item.euvd){applyEuvdDetails(matches,item.id,old.details);assign(matches,item.id,'euvdDetailsEvidence',{status:'enriched',stale:true,failure});enriched++;stale++;}else{missing++;assign(matches,item.id,'euvdDetailsEvidence',{status:'unavailable',failure});}}
|
|
116
|
+
processed++;opts.onEnrichmentProgress?.({source:'euvd-details',completed:processed,total:pending.length});
|
|
117
|
+
})));
|
|
118
|
+
if(pending.length)context.repo.put('catalogue','euvd-targeted',stored);
|
|
119
|
+
return {result:enriched?'enriched':missing?'unavailable':'not-applicable',count:enriched,consulted:enriched,missing,stale,...(failures.length?{failures,reason:`${failures.length} EUVD detail request(s) failed: ${[...new Set(failures.map(f=>f.reason))].join('; ')}`}:{})};
|
|
120
|
+
}},
|
|
121
|
+
{id:'certfr',async run(matches,opts,context){
|
|
122
|
+
const copies=context.ids.map(id=>({cve:{id}})),saved=context.repo.get('catalogue','certfr-targeted')?.value || {entries:{}};
|
|
123
|
+
if(context.hosted&&!opts.offline){
|
|
124
|
+
for(let i=0;i<context.ids.length;i+=100){const request=context.ids.slice(i,i+100),res=await require('./providers').getResource('certfr','cves',{ids:request},{fetcher:opts.fetcher,noStore:true,streaming:true});
|
|
125
|
+
if(!res.ok)throw Error(`hosted CERT-FR unavailable (HTTP ${res.status})`);const payload=await res.json();if(!Array.isArray(payload.items))throw Error('invalid hosted CERT-FR response');
|
|
126
|
+
const byId=new Map();for(const item of payload.items){if(!item||!request.includes(item.cve)||byId.has(item.cve)||!Array.isArray(item.advisories))throw Error('invalid hosted CERT-FR record');byId.set(item.cve,item.advisories);}
|
|
127
|
+
const stamp=responseTime(res);for(const id of request)saved.entries[id]={items:byId.get(id)||[],...stamp};
|
|
128
|
+
}
|
|
129
|
+
context.repo.put('catalogue','certfr-targeted',saved);
|
|
130
|
+
}else if(!opts.offline)await require('./certfr').enrichCertFr(copies,{...opts,hostedProxy:false});
|
|
131
|
+
const bulkEntry=context.repo.get('catalogue','certfr'),bulk=bulkEntry?.value;const bulkByCve=opts.offline && bulk?.entries ? require('./certfr').indexByCve(bulk.entries) : null;let consulted=0,stale=0,matched=0;
|
|
132
|
+
for(const copy of copies){const id=copy.cve.id,entry=saved.entries[id];let hits=copy.cve.certfr,available=false,old=false;
|
|
133
|
+
if(entry && (opts.offline||context.hosted)){available=true;old=freshness(entry.fetchedAt,entry.stale,opts.offline);hits=entry.items;}
|
|
134
|
+
else if(bulk?.entries && typeof bulk.entries==='object' && bulk.meta?.fetchedAt){available=true;old=freshness(bulk.meta.fetchedAt,bulkEntry.stale,opts.offline);if(opts.offline)hits=bulkByCve[id];}
|
|
135
|
+
if(!available){assign(matches,id,'certfrEvidence',{status:'unavailable'});continue;}consulted++;if(old)stale++;assign(matches,id,'certfrEvidence',{status:hits?.length?'enriched':'no-match',stale:old});if(hits?.length){assign(matches,id,'certfr',hits);matched++;}
|
|
136
|
+
}
|
|
137
|
+
return {result:matched?'enriched':consulted===context.ids.length?'no-match':'unavailable',count:matched,consulted,missing:context.ids.length-consulted,stale};
|
|
138
|
+
}},
|
|
139
|
+
];
|
|
140
|
+
/** Enrich matched CVEs without altering affected ranges. coverage records use
|
|
141
|
+
* completed/partial/failed/not-run/not-applicable and result distinguishes
|
|
142
|
+
* enriched/no-match/unavailable/not-consulted/derived-alias. Individual source
|
|
143
|
+
* statuses and signals are attached to cve.cveEvidence by explicit CVE ID.
|
|
144
|
+
* opts.europeanAdapters supports injected {id,run(matches,opts,context)} sources.
|
|
145
|
+
*/
|
|
146
|
+
async function enrichEuropeanFindings(matches,opts={}){
|
|
147
|
+
const active=opts.europeanAdapters || europeanAdapters;if(!Array.isArray(active)||active.some(a=>!a || typeof a.id!=='string'||typeof a.run!=='function'))throw Error('Invalid European enrichment adapter registry');
|
|
148
|
+
const context={ids:[...new Set((matches||[]).flatMap(m=>ids(m.cve)))],hosted:opts.hostedProxy ?? require('./providers').hasHostedProxy()};
|
|
149
|
+
let repository;
|
|
150
|
+
Object.defineProperty(context,'repo',{get(){if(!repository)repository=createCacheRepository(opts.cacheDir||getCacheDir());return repository;}});
|
|
151
|
+
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
|
+
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
|
+
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,opts,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
|
+
const incomplete=!!result.missing||!!result.stale||result.result==='unavailable';
|
|
157
|
+
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
|
+
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
|
+
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
|
+
}
|
|
163
|
+
return {coverage,warnings};
|
|
164
|
+
}
|
|
165
|
+
module.exports={enrichEuropeanFindings,europeanAdapters};
|
package/lib/finding-summary.js
CHANGED
|
@@ -6,8 +6,8 @@ const SEVERITIES = ["critical", "high", "medium", "low", "none", "unknown"];
|
|
|
6
6
|
function identity(m) {
|
|
7
7
|
if (m.findingId) return m.findingId;
|
|
8
8
|
const dep = m.dep || {};
|
|
9
|
-
return [m.cve?.id || "", dep.ecosystem || "", dep.coordKey || `${dep.groupId || dep.namespace || ""}:${dep.artifactId || dep.name || ""}`,
|
|
10
|
-
dep.version || "", dep.manifestPaths?.[0] || dep.pomPaths?.[0] || ""].join("\0");
|
|
9
|
+
return [m.cve?.id || "", dep.ecosystem || "", dep.artifactTargetId || "", dep.coordKey || `${dep.groupId || dep.namespace || ""}:${dep.artifactId || dep.name || ""}`,
|
|
10
|
+
dep.version || "", dep.artifactPath || dep.manifestPaths?.[0] || dep.pomPaths?.[0] || ""].join("\0");
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function uniqueFindings(matches = []) {
|
|
@@ -38,7 +38,7 @@ function coalescePhysicalFindings(matches = [], srcRoot = null) {
|
|
|
38
38
|
const location = file && srcRoot && path.isAbsolute(file) ? path.relative(srcRoot, file) : file;
|
|
39
39
|
const rel = location ? String(location).split(path.sep).join("/") : null;
|
|
40
40
|
const physical = dep.ecosystem === "composer" && rel && dep.coordKey && dep.version && match.cve?.id;
|
|
41
|
-
const key = physical ? [match.cve.id, dep.coordKey, dep.version, rel].join("\0") : identity(match);
|
|
41
|
+
const key = physical ? [match.cve.id, dep.coordKey, dep.version, rel, ...(dep.artifactTargetId ? [dep.artifactTargetId] : [])].join("\0") : identity(match);
|
|
42
42
|
const findingId = physical ? `fad-cve-${crypto.createHash("sha256").update(key).digest("hex").slice(0, 24)}` : match.findingId;
|
|
43
43
|
const previous = byKey.get(key);
|
|
44
44
|
if (!previous) { byKey.set(key, { ...match, ...(findingId ? { findingId } : {}) }); continue; }
|
|
@@ -48,6 +48,7 @@ function coalescePhysicalFindings(matches = [], srcRoot = null) {
|
|
|
48
48
|
cve.severityScheme = previous.cve.severityScheme || "cvss";
|
|
49
49
|
}
|
|
50
50
|
cve.aliases = union(previous.cve?.aliases, match.cve?.aliases);
|
|
51
|
+
cve.upstream = union(previous.cve?.upstream, match.cve?.upstream);
|
|
51
52
|
cve.osvRefs = refs(previous.cve?.osvRefs, match.cve?.osvRefs);
|
|
52
53
|
cve.nvdRefs = refs(previous.cve?.nvdRefs, match.cve?.nvdRefs);
|
|
53
54
|
byKey.set(key, { ...previous, cve, findingId: findingId || previous.findingId,
|
package/lib/i18n.js
CHANGED
|
@@ -46,6 +46,25 @@ function normaliseLocale(raw) {
|
|
|
46
46
|
// tool and flag names) are deliberately absent: they are names, not prose, and fall
|
|
47
47
|
// through to English.
|
|
48
48
|
const fr = {
|
|
49
|
+
"Replace or rebuild the image — remediation details": "Remplacer ou reconstruire l’image — détail des corrections",
|
|
50
|
+
"Unrated advisory": "Avis non coté",
|
|
51
|
+
"Scores per linked CVE": "Scores par CVE associée",
|
|
52
|
+
"Severity not supplied by the available sources": "Criticité non fournie par les sources disponibles",
|
|
53
|
+
"Risk evidence": "Origine de la cotation",
|
|
54
|
+
"No categorised finding.": "Aucun résultat catégorisé.",
|
|
55
|
+
"Top {n} most critical · production findings": "Les {n} résultats de production les plus critiques",
|
|
56
|
+
"Image findings": "Résultats images",
|
|
57
|
+
"Source findings": "Résultats sources",
|
|
58
|
+
"CWE — findings (by severity)": "CWE — résultats (par sévérité)",
|
|
59
|
+
"Findings per component": "Résultats par composant",
|
|
60
|
+
"Unattributed": "Non attribué",
|
|
61
|
+
"Shared": "Partagé",
|
|
62
|
+
"Findings by severity": "Résultats par sévérité",
|
|
63
|
+
"Shared findings count once per affected module.": "Un résultat partagé est compté une fois par module concerné.",
|
|
64
|
+
"Images": "Images",
|
|
65
|
+
"Images & OS": "Images & OS",
|
|
66
|
+
"Evidence in image": "Preuves dans l’image",
|
|
67
|
+
"For faster scans with the VigieVuln DB or a seed → vigievuln setup": "Pour des scans plus rapides avec la DB VigieVuln ou un seed → vigievuln setup",
|
|
49
68
|
// ---- Report header ----
|
|
50
69
|
"VigieVuln Report": "Rapport VigieVuln",
|
|
51
70
|
"Multi-ecosystem dependency security audit": "Audit de sécurité des dépendances, multi-écosystème",
|
|
@@ -116,8 +135,6 @@ const fr = {
|
|
|
116
135
|
"indeterminate": "indéterminé",
|
|
117
136
|
"Application coverage gaps": "Limites de couverture applicative",
|
|
118
137
|
"Most vulnerable instances": "Instances les plus vulnérables",
|
|
119
|
-
"Indirect CVEs per direct dependency": "CVE indirectes par dépendance directe",
|
|
120
|
-
"No indirect application CVE.": "Aucune CVE applicative indirecte.",
|
|
121
138
|
"+{n} indirect CVE(s) with no proven origin": "+{n} CVE indirecte(s) sans origine prouvée",
|
|
122
139
|
"No critical or high application CVE.": "Aucune CVE applicative critical ou high.",
|
|
123
140
|
"Critical/high application findings per exposed instance — a shared occurrence counts in each.": "Constats applicatifs critical/high par instance exposée — une occurrence partagée compte dans chacune.",
|
|
@@ -147,6 +164,7 @@ const fr = {
|
|
|
147
164
|
"{n} unique physical finding(s); {exposures} application exposure(s).": "{n} constat(s) physiques distinct(s) ; {exposures} exposition(s) applicative(s).",
|
|
148
165
|
"Unassessed": "Non évalués",
|
|
149
166
|
"unassessed because advisory coverage is incomplete": "non évalués car la couverture des avis est incomplète",
|
|
167
|
+
"{n} currently observed finding(s) cannot be classified as new because baseline advisory coverage was incomplete.": "{n} résultat(s) observé(s) actuellement ne peuvent pas être classés comme nouveaux car la couverture des avis de référence était incomplète.",
|
|
150
168
|
"Unmanaged components": "Composants non gérés",
|
|
151
169
|
"Embedded": "Embarqués",
|
|
152
170
|
"Native": "Natifs",
|
|
@@ -176,8 +194,8 @@ const fr = {
|
|
|
176
194
|
"EOL since {date}": "en fin de vie depuis le {date}",
|
|
177
195
|
"end-of-life": "en fin de vie",
|
|
178
196
|
"→ latest {ver}": "→ dernière {ver}",
|
|
179
|
-
"
|
|
180
|
-
"no
|
|
197
|
+
"Overall:": "Au total :",
|
|
198
|
+
"no findings": "aucun constat",
|
|
181
199
|
"production CVE": "CVE de production",
|
|
182
200
|
"dev/test CVE": "CVE de dev/test",
|
|
183
201
|
"vulnerable vendored-JS": "JS embarqué vulnérable",
|
|
@@ -194,6 +212,8 @@ const fr = {
|
|
|
194
212
|
"Product version": "Version du produit",
|
|
195
213
|
"Suggested version": "Version proposée",
|
|
196
214
|
"Advisory-specific candidate": "Version candidate pour cet avis",
|
|
215
|
+
"Image / component update": "Mise à jour image / composant",
|
|
216
|
+
"Image update evidence": "Mise à jour de l’image : éléments vérifiés",
|
|
197
217
|
"Advisory candidate": "Version candidate pour cet avis",
|
|
198
218
|
"Package-wide safety has not been verified.": "L’absence d’autres vulnérabilités dans cette version n’a pas été vérifiée.",
|
|
199
219
|
"This exact version was verified unaffected by this advisory; other versions remain unknown.": "Cette version précise a été vérifiée comme non affectée par cet avis ; les autres versions restent indéterminées.",
|
|
@@ -239,13 +259,11 @@ const fr = {
|
|
|
239
259
|
// ---- Overview charts ----
|
|
240
260
|
"Overview charts": "Graphiques de synthèse",
|
|
241
261
|
"CWE — direct vulns (by criticality)": "CWE — vulnérabilités directes (par criticité)",
|
|
242
|
-
"Sub-dep CVEs per dependency": "CVE de sous-dépendances par dépendance",
|
|
243
262
|
"Most vulnerable components": "Composants les plus vulnérables",
|
|
244
263
|
"Direct vs transitive (by severity)": "Directes vs transitives (par sévérité)",
|
|
245
264
|
"Fix priority": "Priorité de correction",
|
|
246
265
|
"No categorised direct CVE.": "Aucune CVE directe catégorisée.",
|
|
247
|
-
"No
|
|
248
|
-
"No critical or high production CVE.": "Aucune CVE critique ou élevée en production.",
|
|
266
|
+
"No critical or high production findings attributed to a project descriptor.": "Aucun résultat critique ou élevé en production attribué à un fichier de description du projet.",
|
|
249
267
|
"No production CVE.": "Aucune CVE en production.",
|
|
250
268
|
"Direct": "Directes",
|
|
251
269
|
"Transitive": "Transitives",
|
|
@@ -349,6 +367,7 @@ const fr = {
|
|
|
349
367
|
"parent POM": "POM parent",
|
|
350
368
|
"defined in:": "définie dans :",
|
|
351
369
|
"version managed by:": "version gérée par :",
|
|
370
|
+
"version resolved through:": "version résolue via :",
|
|
352
371
|
"pulled in via:": "apportée via :",
|
|
353
372
|
"version pinned (dependencyManagement) in:": "version fixée (dependencyManagement) dans :",
|
|
354
373
|
"+{n} more": ["+{n} autre", "+{n} autres"],
|
|
@@ -401,7 +420,12 @@ const fr = {
|
|
|
401
420
|
"Replace or remove the vendored binary": "Remplacer ou supprimer le binaire embarqué",
|
|
402
421
|
|
|
403
422
|
// ---- Chapter titles ----
|
|
404
|
-
"{
|
|
423
|
+
"{n} direct prod": "{n} en direct prod",
|
|
424
|
+
"{n} indirect prod": "{n} en indirect prod",
|
|
425
|
+
"{n} direct dev/test": "{n} en direct dev/test",
|
|
426
|
+
"{n} indirect dev/test": "{n} en indirect dev/test",
|
|
427
|
+
"No CVEs detected": "Aucune CVE détectée",
|
|
428
|
+
"No scannable components": "Aucun élément analysable",
|
|
405
429
|
"Production": "Production",
|
|
406
430
|
"Vendored JS vulns": "Vulnérabilités JS embarqué",
|
|
407
431
|
"Dev dependencies": "Dépendances de développement",
|
|
@@ -429,6 +453,7 @@ const fr = {
|
|
|
429
453
|
"Scanned dependency descriptors": "Descripteurs de dépendances analysés",
|
|
430
454
|
"Ignored directories": "Répertoires ignorés",
|
|
431
455
|
"Methodology, data sources & limitations": "Méthodologie, sources de données et limites",
|
|
456
|
+
"Image analysis blocked": "Analyse d’image bloquée",
|
|
432
457
|
"Warnings & scan-completeness": "Avertissements et complétude du scan",
|
|
433
458
|
"Cached source data used; dates indicate the saved response and may need refreshing.": "Données de sources en cache utilisées ; les dates indiquent les réponses conservées, qui peuvent nécessiter une actualisation.",
|
|
434
459
|
"unknown date": "date inconnue",
|
|
@@ -438,6 +463,7 @@ const fr = {
|
|
|
438
463
|
"All — direct": "Toutes — directes",
|
|
439
464
|
"All — transitive": "Toutes — transitives",
|
|
440
465
|
"By {kind}": "Par {kind}",
|
|
466
|
+
"Gradle descriptor": "fichier de description Gradle",
|
|
441
467
|
"{n} file": "{n} fichier",
|
|
442
468
|
"{n} files": "{n} fichiers",
|
|
443
469
|
"manifest": "manifeste",
|
|
@@ -635,7 +661,7 @@ const fr = {
|
|
|
635
661
|
"Limitations — vigievuln does not assess:": "Limites — vigievuln n'évalue pas :",
|
|
636
662
|
"<strong>Reachability / exploitability in your app.</strong> Findings flag a vulnerable version on the dependency graph; they do <em>not</em> prove the vulnerable code path is actually called at runtime. Triage with your application context.": "<strong>L'atteignabilité ou l'exploitabilité dans votre application.</strong> Les constats signalent une version vulnérable sur le graphe de dépendances ; ils ne prouvent <em>pas</em> que le chemin de code vulnérable est réellement appelé à l'exécution. Triez-les avec le contexte de votre application.",
|
|
637
663
|
"<strong>Runtime configuration & mitigations.</strong> WAFs, feature flags, network isolation, disabled features, and other compensating controls are not modelled.": "<strong>La configuration d'exécution et les mesures d'atténuation.</strong> Les WAF, les feature flags, l'isolation réseau, les fonctionnalités désactivées et les autres contrôles compensatoires ne sont pas modélisés.",
|
|
638
|
-
"<strong>Secrets, IaC &
|
|
664
|
+
"<strong>Secrets, IaC & unobserved image contents.</strong> No general secret or infrastructure-as-code analysis. Image findings require an inventory; Dockerfile declarations alone do not establish the contents of a final image.": "<strong>Les secrets, l'IaC et les contenus d'images non observés.</strong> Aucune analyse générale des secrets ou de l'infrastructure-as-code. Les résultats sur une image nécessitent un inventaire ; les seules déclarations du Dockerfile ne prouvent pas le contenu de l'image finale.",
|
|
639
665
|
"<strong>Business-logic & first-party code flaws.</strong> No SAST of your own source; only third-party components are assessed.": "<strong>Les failles de logique métier et du code propriétaire.</strong> Aucune analyse SAST de vos propres sources ; seuls les composants tiers sont évalués.",
|
|
640
666
|
"<strong>Malware beyond the available signal.</strong> Supply-chain risk uses OSV <code>MAL-</code> advisories and the free CIRCL <code>KnownMalicious</code> flag; there is no antivirus/behavioural lane.": "<strong>Les logiciels malveillants au-delà du signal disponible.</strong> Le risque sur la chaîne d'approvisionnement s'appuie sur les avis OSV <code>MAL-</code> et sur l'indicateur gratuit <code>KnownMalicious</code> de CIRCL ; il n'existe aucune voie antivirus ou comportementale.",
|
|
641
667
|
"<strong>License legal advice.</strong> License classification is informational SPDX categorisation, not a legal determination.": "<strong>Le conseil juridique sur les licences.</strong> La classification des licences est une catégorisation SPDX informative, pas une détermination juridique.",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Image acquisition is an explicitly requested registry operation; advisory
|
|
3
|
+
// providers use the same scoped cache and guarded proxy transport as source scans.
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const crypto = require('node:crypto');
|
|
6
|
+
const fs = require('node:fs');
|
|
7
|
+
const config = require('./config');
|
|
8
|
+
const { loadLayers, applyLayers } = require('./options-env');
|
|
9
|
+
const { proxyScope, proxyOrigin, requireHttpConsent } = require('./proxy-scope');
|
|
10
|
+
const { resolveHostedProxy } = require('./hosted-proxy');
|
|
11
|
+
const { applySourceProfile, proxyOnlyFetch } = require('./source-profile');
|
|
12
|
+
const { configureResourceRoute } = require('./providers');
|
|
13
|
+
const { setActiveCacheDir, getCacheDir } = require('./cache-directory');
|
|
14
|
+
|
|
15
|
+
function configureImageNetwork(command, injected = {}) {
|
|
16
|
+
const initial=command.opts(),layers=loadLayers({cwd:process.cwd(),configPath:initial.config,program:command});
|
|
17
|
+
const options=applyLayers(command,layers,config.load());
|
|
18
|
+
if(options.forceUpdate && options.offline)throw Error('--force-update requires an online scan or cache preparation.');
|
|
19
|
+
if(options.stableAdvisoryAgeDays!==undefined && (!Number.isSafeInteger(options.stableAdvisoryAgeDays)||options.stableAdvisoryAgeDays<1||options.stableAdvisoryAgeDays>36500))throw Error('--stable-advisory-age-days must be an integer from 1 to 36500.');
|
|
20
|
+
const previousForce=require('./cache-policy').shouldForceUpdate();
|
|
21
|
+
Object.assign(options,resolveHostedProxy(options));
|
|
22
|
+
const inherited = command.getOptionValueSource('proxyCacheToken') !== 'cli' &&
|
|
23
|
+
!Object.hasOwn(layers.fileLayer,'proxyCacheToken') && !Object.hasOwn(layers.envLayer,'proxyCacheToken') &&
|
|
24
|
+
!process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN;
|
|
25
|
+
const savedOrigin=config.get('proxyCacheTokenOrigin');
|
|
26
|
+
if(options.proxyCache && inherited && config.get('proxyAnonymousOrigin')===String(options.proxyCache).replace(/\/+$/,''))options.proxyCacheToken=null;
|
|
27
|
+
if(options.proxyCache && options.proxyCacheToken && inherited && savedOrigin && savedOrigin!==String(options.proxyCache).replace(/\/+$/,''))throw Error('Saved proxy key belongs to another server; supply its key explicitly.');
|
|
28
|
+
if(options.proxyCache && !options.vigievulnProxy && options.proxyCacheToken && inherited && savedOrigin!==String(options.proxyCache).replace(/\/+$/,''))throw Error('Saved proxy key cannot be sent to an unbound custom proxy; supply its key explicitly.');
|
|
29
|
+
const profile=applySourceProfile(options,{explicit:name=>command.getOptionValueSource(name)==='cli'});Object.assign(options,profile.options);
|
|
30
|
+
const originalFetch=globalThis.fetch, baseFetch=injected.fetcher || originalFetch;
|
|
31
|
+
if(options.proxyCache){
|
|
32
|
+
const origin=proxyOrigin(options.proxyCache);
|
|
33
|
+
if(!options.offline)requireHttpConsent(origin,{acceptedOrigin:config.get('insecureHttpOrigin'),allow:command.getOptionValueSource('allowInsecureHttp')==='cli' && !!options.allowInsecureHttp});
|
|
34
|
+
// Even under profile=all, proxy-confirmed evidence must never mix with a
|
|
35
|
+
// direct-source cache. A custom cache-dir becomes the root of scoped stores.
|
|
36
|
+
const scopeOpts=options.cacheDir ? {homeDir:path.resolve(options.cacheDir)} : {};
|
|
37
|
+
if(scopeOpts.homeDir)fs.mkdirSync(scopeOpts.homeDir,{recursive:true,mode:0o700});
|
|
38
|
+
setActiveCacheDir(proxyScope(origin,scopeOpts));
|
|
39
|
+
} else if(options.cacheDir) setActiveCacheDir(path.resolve(options.cacheDir));
|
|
40
|
+
const cacheDir=getCacheDir();
|
|
41
|
+
const guarded=options.offline ? async()=>{throw Error('offline: network request blocked');} : options.proxyCache ? proxyOnlyFetch(baseFetch,options.proxyCache) : baseFetch;
|
|
42
|
+
if(options.proxyCache && !options.offline){
|
|
43
|
+
const {createCacheStore}=require('./proxy-cache');
|
|
44
|
+
const hosted=!!options.vigievulnProxy;
|
|
45
|
+
configureResourceRoute({proxyUrl:options.proxyCache,hosted,resetRateLimit:true,proxyRateLimitMaxWaitMs:options.proxyRateLimitWaitMs,token:options.proxyCacheToken || process.env.VIGIEVULN_PROXY_CACHE_TOKEN || process.env.FAD_PROXY_CACHE_TOKEN || null,
|
|
46
|
+
fetcher:guarded,store:hosted?null:createCacheStore(path.join(cacheDir,'resource-cache')),
|
|
47
|
+
hostedStore:hosted?createCacheStore(path.join(cacheDir,'hosted-resources',crypto.createHash('sha256').update(options.proxyCache).digest('hex'))):null});
|
|
48
|
+
}else configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null});
|
|
49
|
+
require('./cache-policy').setForceUpdate(!!options.forceUpdate);
|
|
50
|
+
globalThis.fetch=guarded;
|
|
51
|
+
return {options:{...options,...injected,cacheDir,fetcher:guarded,registryFetcher:options.offline?guarded:(injected.registryFetcher||baseFetch)},warnings:profile.warnings,notices:profile.notices,
|
|
52
|
+
restore(){globalThis.fetch=originalFetch;configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null});setActiveCacheDir(null);require('./cache-policy').setForceUpdate(previousForce);}};
|
|
53
|
+
}
|
|
54
|
+
module.exports={configureImageNetwork};
|