vigievuln 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1052
- package/README.md +36 -69
- package/lib/artifacts/applications.js +6 -2
- package/lib/artifacts/component-scope.js +54 -0
- package/lib/artifacts/enrichment.js +1 -0
- package/lib/artifacts/inventory-scope.js +51 -0
- package/lib/artifacts/report-inventory.js +5 -1
- package/lib/artifacts/report.js +28 -8
- package/lib/artifacts/retire.js +80 -0
- package/lib/artifacts/scan.js +39 -21
- package/lib/charts.js +20 -3
- package/lib/cli-image.js +5 -0
- package/lib/cve-record-coverage.js +109 -0
- package/lib/cve-report.js +111 -29
- package/lib/diagnostics.js +14 -1
- package/lib/diff.js +0 -0
- package/lib/euvd.js +6 -2
- package/lib/finding-enrichment.js +8 -7
- package/lib/finding-summary.js +1 -1
- package/lib/i18n.js +16 -1
- package/lib/image-references.js +21 -1
- package/lib/json-export.js +6 -4
- package/lib/nvd.js +52 -16
- package/lib/providers/index.js +6 -6
- package/lib/report-notices.js +38 -3
- package/lib/retire.js +12 -10
- package/lib/source-health.js +47 -23
- package/lib/source-image-scan.js +1 -0
- package/lib/system-inventory/advisories.js +7 -6
- package/lib/system-inventory/alpine-tracker.js +5 -5
- package/lib/system-inventory/collect.js +1 -1
- package/lib/system-inventory/distribution-sources.js +2 -2
- package/lib/system-inventory/nginx-advisories.js +26 -8
- package/package.json +1 -1
- package/vigievuln.js +32 -16
|
@@ -4,19 +4,36 @@
|
|
|
4
4
|
const crypto=require('node:crypto');
|
|
5
5
|
const {createCacheRepository}=require('../cache-repository');
|
|
6
6
|
const {getCacheDir}=require('../cache-directory');
|
|
7
|
+
const PARSER_VERSION=2;
|
|
7
8
|
const SOURCE='nginx-vendor-advisories',URL='https://raw.githubusercontent.com/nginx/nginx.org/master/xml/en/security_advisories.xml',PAGE='https://nginx.org/en/security_advisories.html';
|
|
8
9
|
function ver(s){const m=/^(\d+)\.(\d+)\.(\d+)$/.exec(String(s));return m?m.slice(1).map(Number):null;}
|
|
9
10
|
function cmp(a,b){for(let i=0;i<3;i++)if(a[i]!==b[i])return a[i]-b[i];return 0;}
|
|
10
11
|
function inRange(version,text){const v=ver(version);if(!v)return null;const pieces=String(text||'').split(',').map(s=>s.trim());let unknown=false;for(const piece of pieces){if(piece==='all')return true;const m=/^(\d+\.\d+\.\d+)(?:-(\d+\.\d+\.\d+))?$/.exec(piece);if(!m){unknown=true;continue;}const low=ver(m[1]),high=ver(m[2]||m[1]);if(cmp(v,low)>=0&&cmp(v,high)<=0)return true;}return unknown?null:false;}
|
|
11
|
-
function
|
|
12
|
+
function isNginxPackage(p){return ['dpkg','apk'].includes(p?.manager)&&p.sourceName==='nginx';}
|
|
13
|
+
function fixedInBranch(version,text){
|
|
14
|
+
const current=ver(version);if(!current)return false;
|
|
15
|
+
// Stable fixes are exceptions to the broad vulnerable range, not fixes for
|
|
16
|
+
// a later mainline branch (e.g. 1.30.7 does not fix 1.31.8).
|
|
17
|
+
return String(text||'').split(',').some(piece=>{
|
|
18
|
+
const match=/^(\d+\.\d+\.\d+)\+$/.exec(piece.trim()),fixed=match&&ver(match[1]);
|
|
19
|
+
return fixed&&fixed[0]===current[0]&&fixed[1]===current[1]&&cmp(current,fixed)>=0;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function vendor(p,domains){
|
|
23
|
+
const meta=p.packageMetadata||{},origin=String(meta.origin||'').trim().toLowerCase(),maintainer=String(meta.maintainer||'');
|
|
24
|
+
const email=/<[^<>@\s]+@([^<>\s]+)>\s*$/.exec(maintainer)?.[1]?.toLowerCase();
|
|
25
|
+
// APK origin is a source package name, unlike the dpkg vendor Origin field.
|
|
26
|
+
const vendorOrigin=p.manager==='dpkg'&&(origin==='nginx'||origin==='nginx, inc.');
|
|
27
|
+
return vendorOrigin||!!email&&domains.includes(email)?{status:'third-party',source:vendorOrigin?'dpkg-origin':`${p.manager}-maintainer`,declared:vendorOrigin?meta.origin:meta.maintainer,signatureVerified:false}:null;
|
|
28
|
+
}
|
|
12
29
|
async function parseNginxAdvisories(input,{maxBytes=4*1024*1024}={}){
|
|
13
30
|
const bytes=Buffer.isBuffer(input)?input:Buffer.from(String(input));if(!bytes.length||bytes.length>maxBytes)throw Error('NGINX advisory XML exceeds size limit or is empty');let text=bytes.toString('utf8');
|
|
14
31
|
if(/<!ENTITY\b/i.test(text)||/<!DOCTYPE\s+[^>]*\[/i.test(text))throw Error('NGINX advisory XML contains entity declarations');
|
|
15
32
|
text=text.replace(/<!DOCTYPE\s+article\s+SYSTEM\s+["']\.\.\/\.\.\/dtd\/article\.dtd["']\s*>/i,'');if(/<!DOCTYPE\b/i.test(text))throw Error('unsupported NGINX XML doctype');
|
|
16
33
|
const doc=await require('xml2js').parseStringPromise(text,{strict:true}),sections=doc?.article?.section;if(!Array.isArray(sections))throw Error('invalid NGINX advisory XML');
|
|
17
34
|
const items=sections.flatMap(s=>s.security||[]).flatMap(s=>s.item||[]);if(!items.length)throw Error('NGINX advisory XML has no records');
|
|
18
|
-
const records=[];for(const item of items){const a=item.$||{},
|
|
19
|
-
if(!records.length)throw Error('NGINX advisory XML has no identified records');return {records,sha256:crypto.createHash('sha256').update(bytes).digest('hex')};
|
|
35
|
+
const records=[];for(const item of items){const a=item.$||{},cve=/^(?:CVE-)?(\d{4}-\d{4,})$/.exec(a.cve||''),id=cve?`CVE-${cve[1]}`:null;if(!id)continue;if(typeof a.name!=='string'||typeof a.vulnerable!=='string')throw Error('invalid NGINX advisory record');records.push({id,title:a.name,severity:a.severity||null,vulnerable:a.vulnerable,good:a.good||null,sourceDetails:{attributes:a,content:Object.fromEntries(Object.entries(item).filter(([key])=>key!=='$'))},advisory:typeof a.advisory==='string'&&/^https:\/\//.test(a.advisory)?a.advisory:PAGE});}
|
|
36
|
+
if(!records.length)throw Error('NGINX advisory XML has no identified records');return {records,parserVersion:PARSER_VERSION,sha256:crypto.createHash('sha256').update(bytes).digest('hex')};
|
|
20
37
|
}
|
|
21
38
|
async function syncNginxAdvisories(options={}){
|
|
22
39
|
if(options.offline)throw Error('cannot refresh NGINX advisories offline');const timeout=AbortSignal.timeout(options.timeoutMs??30000),signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;const res=await require('../providers').getResource('nginx','advisories',{}, {fetcher:options.fetcher,signal,streaming:true,noStore:true});if(!res.ok){await res.body?.cancel();throw Error(`NGINX advisory HTTP ${res.status}`);}let size=0,chunks=[];for await(const chunk of res.body){size+=chunk.length;if(size>(options.maxBytes??4*1024*1024))throw Error('NGINX advisory XML exceeds size limit');chunks.push(Buffer.from(chunk));}const parsed=await parseNginxAdvisories(Buffer.concat(chunks),options),now=Date.now(),stamp=Date.parse(res.headers.get('x-fad-proxy-fetched-at')||''),proxy=require('../providers').hasProxyRoute(),valid=Number.isFinite(stamp)&&stamp>0&&stamp<=now;
|
|
@@ -24,16 +41,17 @@ async function syncNginxAdvisories(options={}){
|
|
|
24
41
|
}
|
|
25
42
|
async function assessNginxAdvisories(packages,options={}){
|
|
26
43
|
const matches=[],observations=[],warnings=[],repo=options.cacheRepository||createCacheRepository(options.cacheDir||getCacheDir()),domains=options.allowedMaintainerDomains||['nginx.org','nginx.com','f5.com'];if(!Array.isArray(domains)||domains.some(d=>typeof d!=='string'||!/^[a-z0-9.-]+$/.test(d)))throw Error('invalid NGINX maintainer domains');
|
|
27
|
-
const candidates=(packages||[]).filter(
|
|
44
|
+
const candidates=(packages||[]).filter(isNginxPackage),cached=repo.get('catalogue','nginx-advisories')?.value,ttl=options.ttlMs??86400000;if(!Number.isSafeInteger(ttl)||ttl<=0)throw Error('invalid NGINX advisory TTL');let snapshot=Array.isArray(cached?.records)&&/^[a-f0-9]{64}$/.test(cached.sha256||'')&&Number.isFinite(cached.observedAt)?cached:null;
|
|
28
45
|
if(!candidates.length)return {matches,observations,coverage:[{source:SOURCE,execution:'not-applicable',result:'not-applicable'}],warnings};
|
|
29
|
-
if(!options.offline&&(!snapshot||snapshot.stale||Date.now()-snapshot.observedAt>=ttl||Date.now()<snapshot.observedAt)){try{snapshot=await syncNginxAdvisories(options);}catch(error){warnings.push({type:'source-unavailable',source:SOURCE,message:`NGINX advisories: ${error.message}`});}}
|
|
46
|
+
if(!options.offline&&(!snapshot||snapshot.parserVersion!==PARSER_VERSION||snapshot.stale||Date.now()-snapshot.observedAt>=ttl||Date.now()<snapshot.observedAt)){try{snapshot=await syncNginxAdvisories(options);}catch(error){warnings.push({type:'source-unavailable',source:SOURCE,message:`NGINX advisories: ${error.message}`});}}
|
|
30
47
|
if(!snapshot){if(options.offline)warnings.push({type:'source-unavailable',source:SOURCE,message:'NGINX vendor advisory snapshot is not cached.'});return {matches,observations,coverage:[{source:SOURCE,execution:'partial',result:'indeterminate',reason:'NGINX vendor advisory snapshot unavailable.'}],warnings};}
|
|
31
|
-
|
|
48
|
+
if(snapshot.parserVersion!==PARSER_VERSION)warnings.push({type:'source-unavailable',source:SOURCE,message:'Cached NGINX advisories use an older parser; refresh the catalogue online to restore complete advisory parsing.'});
|
|
49
|
+
for(const p of candidates){const identity=p.packageOrigin?.status==='ambiguous'?null:vendor(p,domains),upstream=/^(\d+\.\d+\.\d+)(?:-[A-Za-z0-9.+~]+)?$/.exec(p.sourceVersion||'')?.[1];for(const record of snapshot.records){const affected=inRange(upstream,record.vulnerable);if(affected===false||fixedInBranch(upstream,record.good))continue;const evidence={sourceURL:URL,sha256:snapshot.sha256,observedAt:snapshot.observedAt,advisoryURL:record.advisory,upstreamVersion:upstream||null,versionRange:record.vulnerable,fixedVersions:record.good,vendorSeverity:record.severity,packageOrigin:identity,signatureVerified:false,configurationApplicability:'unknown',sourceDetails:record.sourceDetails||null};
|
|
32
50
|
if(!identity||affected===null){observations.push({dep:p,cveId:record.id,status:'unknown',reason:!identity?'Vendor package origin is not established.':'Upstream version range cannot be evaluated.',evidence});continue;}
|
|
33
51
|
const current=ver(upstream),fix=(record.good||'').split(',').map(s=>s.trim()).map(s=>/^(\d+\.\d+\.\d+)\+$/.exec(s)?.[1]).filter(Boolean).filter(s=>{const v=ver(s);return v[0]===current[0]&&v[1]===current[1]&&cmp(v,current)>0;}).sort((a,b)=>cmp(ver(a),ver(b)))[0]||null;
|
|
34
52
|
matches.push({dep:{...p,packageOrigin:identity},source:SOURCE,advisoryId:record.id,cve:{id:record.id,summary:record.title,description:record.title,severity:'UNKNOWN',fixVersion:fix,advisorySource:record.advisory,vendorEvidence:evidence}});
|
|
35
53
|
}}
|
|
36
54
|
return {matches,observations,coverage:[{source:SOURCE,execution:snapshot.stale||warnings.length?'partial':'completed',result:'consulted',scope:'upstream-nginx-version',fetchedAt:snapshot.observedAt,sha256:snapshot.sha256,reason:'Version applicability is assessed from vendor declarations; runtime configuration and package signature remain unverified.'}],warnings};
|
|
37
55
|
}
|
|
38
|
-
function nginxPackageOrigin(pkg,options={}){if(pkg
|
|
39
|
-
module.exports={SOURCE,URL,nginxPackageOrigin,parseNginxAdvisories,syncNginxAdvisories,assessNginxAdvisories};
|
|
56
|
+
function nginxPackageOrigin(pkg,options={}){if(!isNginxPackage(pkg))return null;return vendor(pkg,options.allowedMaintainerDomains||['nginx.org','nginx.com','f5.com']);}
|
|
57
|
+
module.exports={SOURCE,URL,isNginxPackage,nginxPackageOrigin,parseNginxAdvisories,syncNginxAdvisories,assessNginxAdvisories};
|
package/package.json
CHANGED
package/vigievuln.js
CHANGED
|
@@ -587,6 +587,8 @@ program
|
|
|
587
587
|
.option("--no-go", "skip the Go codec")
|
|
588
588
|
.option("--no-ruby", "skip the Ruby (Bundler) codec")
|
|
589
589
|
.option("--no-binaries", "skip scanning committed native binaries (.dll/.exe/.so/.dylib)")
|
|
590
|
+
.option("--no-image-retire", "disable RetireJS inspection of image contents")
|
|
591
|
+
.option("--image-retire", "scan bundled JavaScript in image contents with RetireJS (excludes package stores)", false)
|
|
590
592
|
.option("--images", "enable image analysis in source-tree scans (off by default)", false)
|
|
591
593
|
.option("--no-images", "skip image declaration discovery and image analysis in source-tree scans")
|
|
592
594
|
.option("--image-platform <os/arch[/variant]>", "image platform when no platform is declared", "linux/amd64")
|
|
@@ -621,7 +623,7 @@ if (!process.argv.includes("--help-all")) {
|
|
|
621
623
|
const { foldedFlags } = require("./lib/cli-groups");
|
|
622
624
|
const { ADMIN_FLAGS, REPORTS } = require("./lib/cli-groups");
|
|
623
625
|
const folded = new Set([...foldedFlags(), ...ADMIN_FLAGS, ...REPORTS.map(r => `--report-${r}`),
|
|
624
|
-
"--images", "--image-platform", "--reuse-stable-advisories", "--no-reuse-stable-advisories", "--stable-advisory-age-days", "--proxy-rate-limit-wait-ms",
|
|
626
|
+
"--images", "--image-retire", "--no-image-retire", "--image-platform", "--reuse-stable-advisories", "--no-reuse-stable-advisories", "--stable-advisory-age-days", "--proxy-rate-limit-wait-ms",
|
|
625
627
|
"--source", "--list-app-plugins", "--scan-context", "--private-component", "--public-component", "--wordfence-live", "--wordfence-feed", "--drupal-advisories", "--wordfence-feed-url", "--drupal-advisories-live", "--prestashop-advisories", "--prestashop-advisories-live", "--typo3-advisories", "--typo3-advisories-live", "--spip-advisories", "--spip-advisories-live", "--wp-checksums", "--wp-checksums-live", "--wp-checksums-locale", "--max-advisory-age", "--fail-on-incomplete", "--proxy-cache-token", "--advisory-query-ttl", "--prepare-offline", "--output"]);
|
|
626
628
|
for (const opt of program.options) if (folded.has(opt.long)) opt.hidden = true;
|
|
627
629
|
} else {
|
|
@@ -846,8 +848,8 @@ if (!options.offline) {
|
|
|
846
848
|
* Provider outages are coverage warnings by default. Write the partial reports before
|
|
847
849
|
* evaluating an explicitly requested --fail-on-incomplete gate.
|
|
848
850
|
*/
|
|
849
|
-
function warnIfDegraded() {
|
|
850
|
-
const bad = sourceHealth.
|
|
851
|
+
function warnIfDegraded(handledKeys = []) {
|
|
852
|
+
const bad = sourceHealth.unreportedOutages(handledKeys);
|
|
851
853
|
if (!bad.length) return;
|
|
852
854
|
ui.warn(`Sources unavailable: ${bad.map(s => s.id).join(", ")}; report coverage is incomplete.`);
|
|
853
855
|
}
|
|
@@ -1822,6 +1824,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1822
1824
|
// 1. CVE — native scanner contributed by the maven codec (local cvelistV5 index).
|
|
1823
1825
|
let cveMatches = [];
|
|
1824
1826
|
const sourceConsultations = [];
|
|
1827
|
+
const undecidableAdvisories = [];
|
|
1825
1828
|
let cveDataDate = null;
|
|
1826
1829
|
if (willCve) {
|
|
1827
1830
|
const st = progress.start("CVE index (CVEProject)");
|
|
@@ -1853,14 +1856,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1853
1856
|
if (!offline && !options.cveOffline && require('./lib/providers').hasHostedProxy()) {
|
|
1854
1857
|
try {
|
|
1855
1858
|
const status=await require('./lib/cve-npm-proxy').refreshNpmCves(resolved,cveStore,{ttlMs:options.advisoryQueryTtlMs});
|
|
1856
|
-
if(status.incomplete)
|
|
1859
|
+
if(status.incomplete)noteSourceLimitation('CVEProject','Available npm proxy records were assessed; the response does not certify an exhaustive, current catalogue.');
|
|
1857
1860
|
} catch (err) {scanWarnings.push({type:'source-unavailable',message:`CVEProject npm proxy: ${err.message}; cached records are still matched.`});}
|
|
1858
1861
|
}
|
|
1859
1862
|
const npmCves = require('./lib/native-advisories').matchNativeNpmCves(resolved, cveStore);
|
|
1860
1863
|
cveMatches = require('./lib/merge-sources').mergeBySource(cveMatches, npmCves.matches);
|
|
1861
|
-
|
|
1864
|
+
undecidableAdvisories.push(...npmCves.unknown);
|
|
1862
1865
|
const npmNames=require('./lib/cve-npm-proxy').packageNames(resolved);
|
|
1863
|
-
if (!cveStore.getSourceCoverage('cveproject','*')?.complete && npmNames.some(name=>{const q=cveStore.getQuery({source:'cveproject',ecosystem:'npm',name,version:'*'},{ttlMs:options.advisoryQueryTtlMs});return !q || q.provenance?.stale || (!(offline || options.cveOffline) && !q.fresh);}))
|
|
1866
|
+
if (!cveStore.getSourceCoverage('cveproject','*')?.complete && npmNames.some(name=>{const q=cveStore.getQuery({source:'cveproject',ecosystem:'npm',name,version:'*'},{ttlMs:options.advisoryQueryTtlMs});return !q || q.provenance?.stale || (!(offline || options.cveOffline) && !q.fresh);})) noteSourceLimitation('CVEProject','Available native npm records were assessed; this dataset does not certify an exhaustive catalogue.');
|
|
1864
1867
|
} catch (err) { scanWarnings.push({type:'source-unavailable',message:`CVEProject npm: ${err.message}; advisory coverage is incomplete.`}); }
|
|
1865
1868
|
}
|
|
1866
1869
|
|
|
@@ -2064,7 +2067,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2064
2067
|
const unindexed = result.coverage.reduce((n,c)=>n+(c.unindexed || 0),0);
|
|
2065
2068
|
if (!result.sourceCoverage?.complete || (index && (!index.directory?.verified || !result.coverage.length || result.coverage.some(c=>!c.complete) || skipped || unindexed)))
|
|
2066
2069
|
noteSourceLimitation('GCVE',`Partial source coverage: ${skipped ?? 'unknown'} GNA source(s) not collected; ${unindexed} source records lack explicit package coordinates. These records are not necessarily relevant to this project.`);
|
|
2067
|
-
|
|
2070
|
+
undecidableAdvisories.push(...result.unknown);
|
|
2068
2071
|
st.done(`${result.matches.length} matched · +${cveMatches.length-before} new`);
|
|
2069
2072
|
} catch (err) {
|
|
2070
2073
|
st.fail(err.message);
|
|
@@ -2092,7 +2095,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2092
2095
|
}
|
|
2093
2096
|
const native = require('./lib/native-advisories').matchNativePackages(resolved,cveStore,{sources});
|
|
2094
2097
|
cveMatches = mergeBySource(cveMatches,native.matches);
|
|
2095
|
-
|
|
2098
|
+
undecidableAdvisories.push(...native.unknown);
|
|
2096
2099
|
} catch (err) { scanWarnings.push({type:'source-unavailable',message:`Native advisories: ${err.message}; coverage is incomplete.`}); }
|
|
2097
2100
|
}
|
|
2098
2101
|
|
|
@@ -2171,7 +2174,9 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2171
2174
|
st.done(`${uniqueCves} CVE${nvdAdded ? ` · +${nvdAdded} via NVD ranges` : ""}${filtered ? ` · ${filtered} false-positive(s) filtered` : ""}${hasNvdKey || options.vigievulnProxy ? "" : " · no key (slow)"}`);
|
|
2172
2175
|
} catch (err) {
|
|
2173
2176
|
st.fail(err.message);
|
|
2174
|
-
scanWarnings.push(
|
|
2177
|
+
scanWarnings.push(nvdBindings.length || options.nvdCpeMatch
|
|
2178
|
+
? {type:'source-unavailable',message:`NVD: ${err.message}; additional version-range coverage is incomplete.`}
|
|
2179
|
+
: {type:'cve-record-source',source:'nvd',affectsCompleteness:false,message:err.message});
|
|
2175
2180
|
}
|
|
2176
2181
|
}
|
|
2177
2182
|
}
|
|
@@ -2306,12 +2311,13 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2306
2311
|
europeanAdapters:[adapter,...europeanAdapters.filter(a=>a.parent===adapter.id)],
|
|
2307
2312
|
onEnrichmentProgress:event=>st?.tick(`${event.source} ${event.completed}/${event.total}`),
|
|
2308
2313
|
});
|
|
2309
|
-
|
|
2310
|
-
|
|
2314
|
+
const recordEnrichment = adapter.id === 'euvd';
|
|
2315
|
+
sourceConsultations.push(...result.coverage.map(c => ({...c,...(recordEnrichment?{affectsCompleteness:false,diagnostics:result.warnings.filter(w=>w.source===c.collector)}:{})})));
|
|
2316
|
+
if (!recordEnrichment) scanWarnings.push(...result.warnings);
|
|
2311
2317
|
const status = result.coverage[0];
|
|
2312
2318
|
if (status?.execution === 'not-applicable') st?.skip('no CVE');
|
|
2313
2319
|
else if (status?.execution === 'failed') st?.fail(status.reason);
|
|
2314
|
-
else st?.done(`${status?.count || 0} CVE(s) enriched${status?.execution === 'partial' ? ' · incomplete coverage' : ''}`);
|
|
2320
|
+
else st?.done(`${status?.count || 0} CVE(s) enriched${status?.execution === 'partial' ? (recordEnrichment ? ' · some enrichment unavailable' : ' · incomplete coverage') : ''}`);
|
|
2315
2321
|
}
|
|
2316
2322
|
}
|
|
2317
2323
|
|
|
@@ -2533,8 +2539,18 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2533
2539
|
if (retireMatches.length > 8) console.log(chalk.dim(` …and ${retireMatches.length - 8} more`));
|
|
2534
2540
|
}
|
|
2535
2541
|
|
|
2542
|
+
if (undecidableAdvisories.length) scanWarnings.push(require('./lib/diagnostics').advisoryEvidenceDiagnostic(undecidableAdvisories));
|
|
2536
2543
|
const durableIssues = require('./lib/package-versions').drainIssues();
|
|
2537
2544
|
if (durableIssues.length) scanWarnings.push({type:'source-unavailable', message:`${durableIssues.length} package version observation(s) are conflicting or invalid; dependency coverage may be incomplete.`,items:durableIssues});
|
|
2545
|
+
// Reconcile source and image enrichment by CVE identity, once for the whole scan.
|
|
2546
|
+
const recordSummary = require('./lib/cve-record-coverage').summarizeCveRecords([...cveMatches, ...retireMatches], {
|
|
2547
|
+
...options, nvd:willNvd, euvd:willEuvd, offline,
|
|
2548
|
+
coverage:[...sourceConsultations,...imageState.artifacts.flatMap(a=>a.coverage||[])],
|
|
2549
|
+
});
|
|
2550
|
+
const enrichmentRequestKeys = recordSummary.requestKeys;
|
|
2551
|
+
scanWarnings = scanWarnings.filter(w=>w.type!=='cve-enrichment-summary' && w.type!=='cve-record-source');
|
|
2552
|
+
if (recordSummary.warning) scanWarnings.push(recordSummary.warning);
|
|
2553
|
+
sourceConsultations.push(recordSummary.coverage);
|
|
2538
2554
|
{ const split=require('./lib/diagnostics').partitionDiagnostics(scanWarnings); scanWarnings=split.warnings; scanNotices.push(...split.notices); }
|
|
2539
2555
|
if (scanWarnings.length) {
|
|
2540
2556
|
console.log();
|
|
@@ -2633,9 +2649,9 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2633
2649
|
|
|
2634
2650
|
const reportWarnings = [
|
|
2635
2651
|
...triageWarnings,
|
|
2636
|
-
...sourceHealth.unreportedOutages(scanWarnings.flatMap(w=>w.requestKeys||[])).map(s => ({type:"source-unavailable",count:1,
|
|
2652
|
+
...sourceHealth.unreportedOutages([...enrichmentRequestKeys,...scanWarnings.flatMap(w=>w.requestKeys||[])]).map(s => ({type:"source-unavailable",count:1,
|
|
2637
2653
|
message:`${s.id}: requested source data could not be retrieved (${s.codes.join(", ") || "no response"}).`})),
|
|
2638
|
-
...sourceHealth.unreportedStale(scanWarnings.flatMap(w=>w.requestKeys||[])).map(s => ({ type:"source-stale", count:1,...(!s.blocking?{severity:'info'}:{}),...(s.refreshFailure?{refreshFailure:s.refreshFailure}:{}),
|
|
2654
|
+
...sourceHealth.unreportedStale([...enrichmentRequestKeys,...scanWarnings.flatMap(w=>w.requestKeys||[])]).map(s => ({ type:"source-stale", count:1,...(!s.blocking?{severity:'info'}:{}),...(s.refreshFailure?{refreshFailure:s.refreshFailure}:{}),
|
|
2639
2655
|
message:s.blocking ? `${s.id}: source refresh failed${s.refreshFailure ? ` (${s.refreshFailure.cause}, HTTP ${s.refreshFailure.status}${s.refreshFailure.retryAfterSeconds!=null?`, retry after ${s.refreshFailure.retryAfterSeconds}s`:''})` : ''}; cached data${s.at ? ` from ${new Date(s.at).toISOString()}` : " of unknown age"} was used. Coverage may be incomplete.` : `${s.id}: cached data${s.at ? ` from ${new Date(s.at).toISOString()}` : " of unknown age"} was used; freshness was not confirmed.` })),
|
|
2640
2656
|
// A project already on a vendor build of an open-source-EOL cycle: covered by the paid
|
|
2641
2657
|
// support that build comes from, so it is a note, not an EOL finding.
|
|
@@ -2750,7 +2766,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2750
2766
|
const wrote = [];
|
|
2751
2767
|
let exportFailed = false;
|
|
2752
2768
|
// Announce coverage gaps for every output combination, including JSON-only.
|
|
2753
|
-
warnIfDegraded();
|
|
2769
|
+
warnIfDegraded(enrichmentRequestKeys);
|
|
2754
2770
|
for (const [format, label] of [["html", "HTML report"], ["doc", "Word .doc"]]) {
|
|
2755
2771
|
if (!out[format]) continue;
|
|
2756
2772
|
try {
|
|
@@ -2883,7 +2899,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2883
2899
|
if (!required.length || required.some(x => !known.has(x))) {
|
|
2884
2900
|
console.error(chalk.red(`❌ invalid --fail-on-incomplete capabilities: ${raw}`));
|
|
2885
2901
|
process.exitCode = 2;
|
|
2886
|
-
} else if (imageAcquisitionFailed || require("./lib/artifacts/scan").incompleteCapabilities(imageState,required).length || ((required.includes("inventory") || required.includes("sources")) && (mavenDepthLimited || reportWarnings.some(w => w.type === "dependency-coverage" || w.type === "go-coverage"))) || (required.includes("sources") && (sourceHealth.
|
|
2902
|
+
} else if (imageAcquisitionFailed || require("./lib/artifacts/scan").incompleteCapabilities(imageState,required).length || ((required.includes("inventory") || required.includes("sources")) && (mavenDepthLimited || reportWarnings.some(w => w.type === "dependency-coverage" || w.type === "go-coverage"))) || (required.includes("sources") && (sourceHealth.unreportedOutages(enrichmentRequestKeys).length || sourceHealth.unreportedStale(enrichmentRequestKeys).some(s=>s.blocking) || reportWarnings.some(w => w.affectsCompleteness !== false && (w.type === "source-unavailable" || w.type === "source-stale" || w.type === "osv-coverage")))) || !requiredCoverageComplete(appState.coverage, required.filter(x => x !== "sources"))) {
|
|
2887
2903
|
ui.section("Coverage gate");
|
|
2888
2904
|
console.log(chalk.red(`✗ required scan checks incomplete: ${required.join(", ")}`));
|
|
2889
2905
|
process.exitCode = 2;
|