vigievuln 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +51 -141
- package/completions/vigievuln.bash +1 -1
- package/completions/vigievuln.zsh +1 -0
- package/lib/account-client.js +21 -14
- package/lib/account-session.js +6 -2
- package/lib/advisory-compression.js +25 -0
- package/lib/advisory-fixes.js +21 -0
- package/lib/advisory-store-sqlite.js +156 -0
- package/lib/advisory-store.js +484 -0
- package/lib/airgap-project.js +117 -0
- package/lib/application-plugins/runner.js +22 -13
- package/lib/application-plugins/wordpress.js +4 -3
- package/lib/application-providers/live-snapshot.js +1 -12
- package/lib/application-providers/snapshot-cache.js +27 -0
- package/lib/application-providers/wordfence-client.js +3 -3
- package/lib/attribution.js +2 -2
- package/lib/cache-archive-sqlite.js +215 -0
- package/lib/cache-archive.js +357 -26
- package/lib/cache-db.js +142 -0
- package/lib/cache-directory.js +18 -74
- package/lib/cache-policy.js +25 -0
- package/lib/cache-repository.js +48 -0
- package/lib/cache-startup.js +54 -0
- package/lib/certfr.js +9 -9
- package/lib/cli-command-routing.js +29 -6
- package/lib/cli-groups.js +32 -3
- package/lib/cli-project-commands.js +47 -6
- package/lib/cli-setup.js +300 -0
- package/lib/codecs/binary/pe-metadata.js +79 -0
- package/lib/codecs/binary/scan.js +4 -3
- package/lib/codecs/binary.codec.js +4 -2
- package/lib/codecs/composer/registry.js +8 -6
- package/lib/codecs/go/parse.js +7 -9
- package/lib/codecs/go/registry.js +7 -5
- package/lib/codecs/go.codec.js +5 -0
- package/lib/codecs/maven.codec.js +73 -8
- package/lib/codecs/npm/collect.js +12 -5
- package/lib/codecs/npm/parse.js +12 -5
- package/lib/codecs/npm/registry.js +42 -12
- package/lib/codecs/nuget/registry.js +8 -6
- package/lib/codecs/pypi/registry.js +8 -6
- package/lib/codecs/ruby/registry.js +7 -5
- package/lib/compression-dictionary.js +5 -0
- package/lib/coverage-diagnostics.js +26 -0
- package/lib/cve-download.js +157 -41
- package/lib/cve-legacy-ranges.js +59 -0
- package/lib/cve-match.js +85 -17
- package/lib/cve-npm-proxy.js +29 -0
- package/lib/cve-report.js +145 -58
- package/lib/cve-version-verdict.js +77 -0
- package/lib/deps-descriptor.js +8 -3
- package/lib/epss.js +13 -8
- package/lib/euvd.js +32 -8
- package/lib/gcve-feed.js +103 -0
- package/lib/gcve-index.js +181 -0
- package/lib/gcve.js +1 -1
- package/lib/github-publisher-maven.js +40 -0
- package/lib/hash-id.js +5 -5
- package/lib/hosted-proxy.js +6 -1
- package/lib/i18n.js +31 -8
- package/lib/json-cache.js +18 -0
- package/lib/json-export.js +16 -2
- package/lib/kev.js +7 -8
- package/lib/line-stream.js +23 -0
- package/lib/maven-airgap.js +80 -0
- package/lib/maven-cache.js +21 -0
- package/lib/maven-license.js +2 -1
- package/lib/maven-presence.js +2 -2
- package/lib/maven-reactor.js +23 -14
- package/lib/maven-repo.js +11 -6
- package/lib/merge-sources.js +25 -18
- package/lib/native-advisories.js +268 -0
- package/lib/nvd-bulk.js +145 -0
- package/lib/nvd-package-ranges.js +109 -0
- package/lib/nvd.js +52 -24
- package/lib/osv-db.js +253 -59
- package/lib/osv-legacy.js +57 -0
- package/lib/osv.js +241 -168
- package/lib/outdated.js +11 -12
- package/lib/package-metadata.js +141 -0
- package/lib/package-versions.js +52 -0
- package/lib/packagist-audit.js +6 -6
- package/lib/provenance.js +73 -19
- package/lib/providers/common.js +11 -1
- package/lib/providers/gcve.js +17 -0
- package/lib/providers/github.js +1 -0
- package/lib/providers/index.js +49 -26
- package/lib/providers/vigievuln.js +7 -0
- package/lib/proxy-cache.js +1 -1
- package/lib/proxy-scope.js +59 -0
- package/lib/proxy-throttle.js +71 -0
- package/lib/resource-cache/engine.js +36 -9
- package/lib/resource-cache/sqlite-store.js +95 -0
- package/lib/resource-cache/validate.js +5 -0
- package/lib/retire.js +24 -24
- package/lib/ruby-version.js +36 -0
- package/lib/sarif-export.js +1 -1
- package/lib/sbom-export.js +11 -7
- package/lib/snyk.js +32 -20
- package/lib/source-profile.js +67 -0
- package/lib/sqlite-driver.js +46 -0
- package/lib/transitive.js +69 -34
- package/lib/unmanaged.js +2 -1
- package/lib/vigievuln-advisories.js +47 -0
- package/package.json +7 -6
- package/vigievuln.js +380 -107
package/vigievuln.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
const fs = require("fs");
|
|
14
14
|
const path = require("path");
|
|
15
|
+
if (!process.env.__FAD_RETIRE__) require('./lib/cache-startup').prepareDirectCache();
|
|
15
16
|
const { rimraf } = require("rimraf");
|
|
16
17
|
const chalk = require("chalk");
|
|
17
18
|
const pLimit = require("p-limit");
|
|
@@ -44,7 +45,11 @@ try {
|
|
|
44
45
|
process.argv = [...process.argv.slice(0, 2), ...routed.args];
|
|
45
46
|
} catch (error) { console.error(`❌ ${error.message}`); process.exit(2); }
|
|
46
47
|
|
|
47
|
-
if (
|
|
48
|
+
if (process.argv[2] === "setup") {
|
|
49
|
+
require("./lib/cli-setup").run(process.argv.slice(3)).catch(err => {
|
|
50
|
+
console.error(`❌ ${err.message}`); process.exitCode = 2;
|
|
51
|
+
}).finally(() => process.exit(process.exitCode || 0));
|
|
52
|
+
} else if (["auth", "project", "watch"].includes(process.argv[2])) {
|
|
48
53
|
require("./lib/cli-project-commands").run(process.argv.slice(2)).catch(err=>{
|
|
49
54
|
console.error(`❌ ${err.message}`); process.exitCode=2;
|
|
50
55
|
}).finally(()=>process.exit(process.exitCode || 0));
|
|
@@ -69,6 +74,7 @@ if (process.argv.includes("--completion")) {
|
|
|
69
74
|
// -------- --set-nvd-key shortcut (must run before required-options parse) --------
|
|
70
75
|
if (process.argv.includes("--set-proxy-cache-token") || process.argv.includes("--unset-proxy-cache-token")) {
|
|
71
76
|
const config = require("./lib/config");
|
|
77
|
+
config.set("proxyCacheTokenOrigin", null);
|
|
72
78
|
if (process.argv.includes("--unset-proxy-cache-token")) config.set("proxyCacheToken", null);
|
|
73
79
|
else {
|
|
74
80
|
const token = process.argv[process.argv.indexOf("--set-proxy-cache-token") + 1];
|
|
@@ -81,6 +87,10 @@ if (process.argv.includes("--set-proxy-cache-token") || process.argv.includes("-
|
|
|
81
87
|
if (process.argv.includes("--set-proxy-cache") || process.argv.includes("--unset-proxy-cache")) {
|
|
82
88
|
const config = require("./lib/config");
|
|
83
89
|
if (process.argv.includes("--unset-proxy-cache")) {
|
|
90
|
+
if (config.get("sourceProfile") === "proxy") {
|
|
91
|
+
console.error("The saved source profile requires this proxy. Run 'vigievuln setup --mode direct --sources all' (or choose us/eu) to explicitly switch to direct sources, or run setup to select another proxy.");
|
|
92
|
+
process.exit(2);
|
|
93
|
+
}
|
|
84
94
|
config.set("proxyCache", null);
|
|
85
95
|
console.log("Proxy cache removed from " + config.CONFIG_PATH);
|
|
86
96
|
} else {
|
|
@@ -217,26 +227,43 @@ if (process.argv.includes("--add-repo") || process.argv.includes("--remove-repo"
|
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
229
|
|
|
230
|
+
if (process.argv.includes('--prepare-offline') && (process.argv.includes('--export-cache') || process.argv.includes('--import-cache'))) {
|
|
231
|
+
console.error(chalk.red('❌ cache prepare cannot be combined with cache import or export.'));
|
|
232
|
+
process.exit(2);
|
|
233
|
+
}
|
|
220
234
|
// -------- --export-cache / --import-cache (handled before program.parse) --------
|
|
221
235
|
if (process.argv.includes("--export-cache") || process.argv.includes("--import-cache")) {
|
|
222
236
|
(async () => {
|
|
223
|
-
|
|
237
|
+
try {
|
|
238
|
+
// Resolve the same profile layers as a scan before the early archive command.
|
|
239
|
+
const { Command } = require("commander");
|
|
240
|
+
const archiveProgram = new Command().allowUnknownOption(true).allowExcessArguments(true)
|
|
241
|
+
.option("--config <file>").option("--source-profile <profile>")
|
|
242
|
+
.option("--proxy-cache <url>").option("--vigievuln-proxy [domain]");
|
|
243
|
+
archiveProgram.parse(process.argv);
|
|
244
|
+
const layersApi = require("./lib/options-env");
|
|
245
|
+
const layers = layersApi.loadLayers({ configPath: archiveProgram.opts().config, program: archiveProgram });
|
|
246
|
+
let archiveOptions = layersApi.applyLayers(archiveProgram, layers, require("./lib/config").load());
|
|
247
|
+
archiveOptions = { ...archiveOptions, ...require("./lib/hosted-proxy").resolveHostedProxy({ ...archiveOptions, offline: true }) };
|
|
248
|
+
archiveOptions = require("./lib/source-profile").applySourceProfile(archiveOptions).options;
|
|
249
|
+
const proxyOrigin = archiveOptions.sourceProfile === "proxy" ? require("./lib/proxy-scope").proxyOrigin(archiveOptions.proxyCache) : null;
|
|
250
|
+
const cacheDir = proxyOrigin ? require("./lib/proxy-scope").proxyScope(proxyOrigin) : require("./lib/cache-directory").getCacheDir();
|
|
251
|
+
const { exportCache, importCache } = require("./lib/cache-archive-sqlite");
|
|
224
252
|
const verbose = process.argv.includes("--verbose");
|
|
225
253
|
const exportIdx = process.argv.indexOf("--export-cache");
|
|
226
254
|
const importIdx = process.argv.indexOf("--import-cache");
|
|
227
|
-
try {
|
|
228
255
|
if (exportIdx !== -1) {
|
|
229
256
|
const dest = process.argv[exportIdx + 1];
|
|
230
257
|
if (!dest || dest.startsWith("-")) {
|
|
231
258
|
console.error(chalk.red("❌ --export-cache requires a destination path (e.g. vigievuln-cache.tar.gz)"));
|
|
232
259
|
process.exit(1);
|
|
233
260
|
}
|
|
234
|
-
const
|
|
235
|
-
const { path: out, size, excluded } = await exportCache(dest, { verbose, includeConfig });
|
|
261
|
+
const { path: out, size, excluded, scope } = await exportCache(dest, { sourceDir: cacheDir, proxyOrigin });
|
|
236
262
|
const mb = (size / 1024 / 1024).toFixed(2);
|
|
237
263
|
console.log(chalk.green(`✅ Cache exported (${mb} MB) → ${out}`));
|
|
238
|
-
console.log(chalk.gray(` Source: ${
|
|
239
|
-
|
|
264
|
+
console.log(chalk.gray(` Source: ${cacheDir}`));
|
|
265
|
+
console.log(chalk.gray(` Scope: ${scope === 'project' ? 'last prepared project' : 'complete local cache'}`));
|
|
266
|
+
if (excluded?.length) console.log(chalk.gray(` Local configuration excluded: ${excluded.join(", ")}`));
|
|
240
267
|
} else {
|
|
241
268
|
const src = process.argv[importIdx + 1];
|
|
242
269
|
if (!src || src.startsWith("-")) {
|
|
@@ -245,14 +272,17 @@ if (process.argv.includes("--export-cache") || process.argv.includes("--import-c
|
|
|
245
272
|
}
|
|
246
273
|
const force = process.argv.includes("--force");
|
|
247
274
|
const replace = process.argv.includes("--replace");
|
|
248
|
-
const {
|
|
275
|
+
const phases = {validating:'Checking bundle contents',extracting:'Extracting SQLite database',checking:'Checking SQLite integrity',merging:'Merging SQLite cache'};
|
|
276
|
+
const { dir, mode, stats } = await importCache(src, { force, replace, targetDir: cacheDir, proxyOrigin,
|
|
277
|
+
onProgress: ({phase}) => { if (phases[phase]) console.error(chalk.gray(` ${phases[phase]}…`)); } });
|
|
249
278
|
if (mode === "merge") {
|
|
250
279
|
console.log(chalk.green(`✅ Cache merged → ${dir}`));
|
|
251
|
-
|
|
252
|
-
if (stats.skipped.length) console.
|
|
280
|
+
console.log(chalk.gray(` SQLite database merged with local entries.`));
|
|
281
|
+
if (stats.skipped.length) console.warn(chalk.yellow(` Cache entries not imported: ${stats.skipped.join(", ")}`));
|
|
253
282
|
} else {
|
|
254
283
|
console.log(chalk.green(`✅ Cache imported → ${dir}`));
|
|
255
|
-
|
|
284
|
+
console.log(chalk.gray(` SQLite database installed; local configuration retained.`));
|
|
285
|
+
if (stats.skipped.length) console.warn(chalk.yellow(` Cache entries not imported: ${stats.skipped.join(", ")}`));
|
|
256
286
|
}
|
|
257
287
|
}
|
|
258
288
|
process.exit(0);
|
|
@@ -410,6 +440,7 @@ program
|
|
|
410
440
|
.option("-s, --src <src>", "source directory (legacy alternative to scan <dir>)")
|
|
411
441
|
.option("--source <src>", "alias of --src")
|
|
412
442
|
.option("--config <file>", "load default options from a trusted JSON file")
|
|
443
|
+
.option("--source-profile <profile>", "vulnerability service operators: all (default), us, eu or proxy")
|
|
413
444
|
.option("-d, --disable <list>", "turn features OFF (comma-separated) — see the token list below")
|
|
414
445
|
.option("-a, --activate <list>", "turn ON what is off by default (comma-separated) — see below")
|
|
415
446
|
.option("-r, --report <list>", "outputs to write, comma-separated: html,doc,xlsx,sbom,csaf,json,sarif (default: html,json)")
|
|
@@ -418,11 +449,13 @@ program
|
|
|
418
449
|
.option("--exclude-path <glob...>", "ignore sub-paths during the walk (gitignore-style glob, relative to --src). Repeatable")
|
|
419
450
|
.option("--no-default-excludes", "walk everything, including node_modules/vendor/target/…")
|
|
420
451
|
.option("--verbose", "verbose") // -v is the version flag; verbose is long-form only
|
|
452
|
+
.option("--force-update", "revalidate all consulted online sources, retaining cached data on failure")
|
|
421
453
|
// Defaults: report + transitive + allLibs all ON. Use --no-* to disable.
|
|
422
454
|
.option("--no-report", "write NO output files at all — the scan, terminal summary and --fail-on gate still run (gate-only / CI mode)")
|
|
423
455
|
.option("--no-transitive", "skip transitive dependency resolution")
|
|
424
456
|
.option("--no-all-libs", "skip Maven Central queries (outdated check + missing-on-central check)")
|
|
425
457
|
.option("--no-osv", "skip OSV.dev (Google/GitHub aggregated Maven CVE feed)")
|
|
458
|
+
.option("--advisory-query-ttl <hours>", "hours before refreshing advisory consultations (0–8760; default 4; 0 always refreshes)")
|
|
426
459
|
.option("--no-packagist-audit", "skip the Packagist security-advisories lane for Composer deps (the data `composer audit` queries — closes CVEs OSV carries without composer coordinates)")
|
|
427
460
|
.option("--no-nvd", "skip NIST NVD enrichment of matched CVEs")
|
|
428
461
|
.option("--nvd-cpe-match", "ALSO match deps against NVD CPE version ranges (opt-in, LOW PRECISION: ~12% of the findings it adds were corroborated by another scanner — triage aid, not a default)")
|
|
@@ -430,6 +463,8 @@ program
|
|
|
430
463
|
.option("--no-eol", "skip the end-of-life check (endoflife.date)")
|
|
431
464
|
.option("--no-kev", "skip CISA KEV (known-exploited) enrichment")
|
|
432
465
|
.option("--no-euvd", "skip ENISA EUVD enrichment (EUVD id + ENISA exploited catalogue)")
|
|
466
|
+
.option("--no-gcve", "skip independent GCVE advisory collection and matching")
|
|
467
|
+
.option("--gcve-offline", "use the local GCVE index without refreshing it")
|
|
433
468
|
.option("--no-certfr", "skip CERT-FR (ANSSI) advisory references")
|
|
434
469
|
// Output family: each --report-<type> takes an OPTIONAL path (omit → default name
|
|
435
470
|
// under --report-output). With NO --report-* flag at all, HTML + findings JSON are written
|
|
@@ -453,6 +488,7 @@ program
|
|
|
453
488
|
.option("--no-nvd-mirror", "NVD only: don't fall back to the fkie-cad/nvd-json-data-feeds mirror when NVD does not answer")
|
|
454
489
|
.option("--retries <n>", "retries (waiting 5+n s each) before a data source is marked unavailable; 0 = none", "5")
|
|
455
490
|
.option("--proxy-cache <url|vigievuln|default>", "shared data-source cache or official VigieVuln proxy")
|
|
491
|
+
.option("--allow-insecure-http", "allow unencrypted HTTP to the selected proxy for this invocation")
|
|
456
492
|
.option("--set-proxy-cache <url|vigievuln|default>", "save the proxy cache for future scans")
|
|
457
493
|
.option("--unset-proxy-cache", "remove the saved proxy cache")
|
|
458
494
|
.option("--set-proxy-cache-token <token>", "save a proxy key for future scans")
|
|
@@ -462,27 +498,29 @@ program
|
|
|
462
498
|
.option("--proxy <url>", "corporate proxy for all requests")
|
|
463
499
|
.option("--set-nvd-key <key>", "save NVD API key to ~/.vigie-vuln/config.json (10× faster NVD enrichment)")
|
|
464
500
|
.option("--show-config", "print the persisted ~/.vigie-vuln/config.json")
|
|
465
|
-
.option("--export-cache <file>", "
|
|
501
|
+
.option("--export-cache <file>", "export the SQLite cache as a tar.gz bundle (excludes local configuration)")
|
|
466
502
|
.option("--import-cache <file>", "merge a previously exported archive into ~/.vigie-vuln/ (keeps the local cache + config.json; newest entry wins)")
|
|
467
503
|
.option("--replace", "with --import-cache: replace ~/.vigie-vuln/ wholesale instead of merging (previous dir kept as .bak unless --force)")
|
|
468
504
|
.option("--include-config", "with --export-cache: also bundle config.json (contains the NVD API key)")
|
|
469
505
|
.option("--export-anonymized <file>", "offline: write a path-free dependency descriptor and exit")
|
|
470
506
|
.option("--prepare-project <file>", "offline: prepare a path-free project descriptor for review")
|
|
471
507
|
.option("--import-anonymized <file>", "online, no --src: scan a descriptor to warm the caches")
|
|
508
|
+
.option("--prepare-offline <file>", "prepare a project archive from an anonymized descriptor")
|
|
509
|
+
.option("--output <file>", "archive destination for --prepare-offline")
|
|
472
510
|
.option("--force", "allow replacing a non-empty --target directory; with --import-cache --replace, skip backup")
|
|
473
511
|
.option("-o, --report-output <dir>", "report output directory", "./vigievuln-report")
|
|
474
512
|
.option("--ignore-test", "skip test-scoped dependencies in report")
|
|
475
513
|
.option("--cve-refresh", "force re-download of CVE database")
|
|
476
514
|
.option("--cve-offline", "use cached CVE index only (no download)")
|
|
477
|
-
.option("--osv-db", "
|
|
478
|
-
.option("--no-osv-db", "skip
|
|
479
|
-
.option("--osv-db-refresh", "
|
|
515
|
+
.option("--osv-db", "enable matching against locally stored OSV advisories")
|
|
516
|
+
.option("--no-osv-db", "skip range matching against locally stored OSV advisories")
|
|
517
|
+
.option("--osv-db-refresh", "revalidate OSV package/version queries online")
|
|
480
518
|
.option("--snyk", "run snyk on cleaned POMs and merge into report (requires --target)")
|
|
481
519
|
.option("--typosquat", "flag npm/PyPI deps whose name is one edit from a popular package (heuristic typosquat/slopsquat detection)")
|
|
482
520
|
.option("--no-retire", "skip retire.js vendored-JS scan")
|
|
483
521
|
.option("--no-vendored-js-inventory", "don't list ALL identified vendored JS libs (chapter 1D) — keep only the vulnerable ones (chapter 2)")
|
|
484
522
|
.option("--retire-refresh", "ignore retire cache and re-scan")
|
|
485
|
-
.option("--transitive-depth <n>", "max transitive resolution depth", "
|
|
523
|
+
.option("--transitive-depth <n>", "max transitive resolution depth", "20")
|
|
486
524
|
.option("--ecosystem <list>", "auto (default) | all | comma list of codec ids", "auto")
|
|
487
525
|
.option("--app-plugins <list>", "auto (default) | none | all | comma list of bundled application plugins", "auto")
|
|
488
526
|
.option("--scan-context <kind>", "application input context: source (default) | installation | component", "source")
|
|
@@ -532,12 +570,11 @@ program
|
|
|
532
570
|
// The -d / -a vocabularies, laid out once under the options instead of wrapped inside two
|
|
533
571
|
// option descriptions where they cost fifteen lines.
|
|
534
572
|
program.addHelpText("after", `
|
|
535
|
-
-d eol nvd nvd-mirror osv packagist-audit epss kev euvd certfr retire transitive all-libs checksums
|
|
573
|
+
-d eol nvd nvd-mirror osv packagist-audit epss kev euvd gcve certfr retire transitive all-libs checksums
|
|
536
574
|
osv-db report vendored-js-inventory default-excludes
|
|
537
575
|
maven gradle npm yarn nuget composer pypi go ruby js jars binaries certs
|
|
538
576
|
-a licenses eol-support typosquat snyk osv-db nvd-cpe-match cve-refresh
|
|
539
|
-
cve-offline osv-db-refresh retire-refresh
|
|
540
|
-
|
|
577
|
+
cve-offline gcve-offline osv-db-refresh retire-refresh
|
|
541
578
|
e.g. vigievuln scan . -d nvd,epss,certs -a licenses,typosquat -o ./audit
|
|
542
579
|
--help-all lists the individual flags these replace. Full guide: docs/USAGE.md`);
|
|
543
580
|
// -d / -a fold thirty-six boolean flags into two lists. The flags still WORK — hiding them
|
|
@@ -547,7 +584,7 @@ if (!process.argv.includes("--help-all")) {
|
|
|
547
584
|
const { foldedFlags } = require("./lib/cli-groups");
|
|
548
585
|
const { ADMIN_FLAGS, REPORTS } = require("./lib/cli-groups");
|
|
549
586
|
const folded = new Set([...foldedFlags(), ...ADMIN_FLAGS, ...REPORTS.map(r => `--report-${r}`),
|
|
550
|
-
"--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"]);
|
|
587
|
+
"--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"]);
|
|
551
588
|
for (const opt of program.options) if (folded.has(opt.long)) opt.hidden = true;
|
|
552
589
|
} else {
|
|
553
590
|
process.argv = process.argv.map(a => a === "--help-all" ? "--help" : a);
|
|
@@ -603,8 +640,37 @@ try {
|
|
|
603
640
|
process.exit(1);
|
|
604
641
|
}
|
|
605
642
|
Object.assign(options, applyLayers(program, _layers, require("./lib/config").load()));
|
|
643
|
+
if (options.prepareOffline) {
|
|
644
|
+
if (options.importAnonymized || !options.output || options.offline || options.src || options.source) {
|
|
645
|
+
console.error(chalk.red('❌ cache prepare requires a descriptor and --output, runs online, and cannot be combined with --src or --import-anonymized.'));
|
|
646
|
+
process.exit(2);
|
|
647
|
+
}
|
|
648
|
+
if (path.resolve(options.prepareOffline) === path.resolve(options.output)) {
|
|
649
|
+
console.error(chalk.red('❌ archive destination must differ from the descriptor.'));
|
|
650
|
+
process.exit(2);
|
|
651
|
+
}
|
|
652
|
+
options.importAnonymized=options.prepareOffline;
|
|
653
|
+
} else if (options.output) {
|
|
654
|
+
console.error(chalk.red('❌ --output is used with cache prepare.'));
|
|
655
|
+
process.exit(2);
|
|
656
|
+
}
|
|
606
657
|
// An anonymized export is strictly local, including proxy resolution and preflight.
|
|
607
658
|
if (options.exportAnonymized || options.prepareProject) options.offline = true;
|
|
659
|
+
if (!options.offline && /^http:\/\//i.test(String(options.proxyCache || ''))) {
|
|
660
|
+
try {
|
|
661
|
+
const {proxyOrigin,requireHttpConsent,HTTP_WARNING}=require('./lib/proxy-scope');
|
|
662
|
+
const config=require('./lib/config'), origin=proxyOrigin(options.proxyCache);
|
|
663
|
+
const allowed=program.getOptionValueSource('allowInsecureHttp') === 'cli' && !!options.allowInsecureHttp;
|
|
664
|
+
ui.warn(HTTP_WARNING);
|
|
665
|
+
if (!allowed && config.get('insecureHttpOrigin') !== origin && process.stdin.isTTY && process.stderr.isTTY) {
|
|
666
|
+
process.stderr.write(`Allow unencrypted HTTP to ${origin}? [y/N] `);
|
|
667
|
+
const input=Buffer.alloc(1024), n=require('node:fs').readSync(0,input,0,input.length,null);
|
|
668
|
+
if (!/^y(?:es)?$/i.test(input.subarray(0,n).toString('utf8').trim())) throw new Error('Scan cancelled: HTTP connection not approved.');
|
|
669
|
+
config.set('insecureHttpOrigin',origin);
|
|
670
|
+
}
|
|
671
|
+
requireHttpConsent(origin,{acceptedOrigin:config.get('insecureHttpOrigin'),allow:allowed});
|
|
672
|
+
} catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
|
|
673
|
+
}
|
|
608
674
|
let hostedAccountSession = null;
|
|
609
675
|
if (!options.offline && !options.proxyCacheToken && !process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN &&
|
|
610
676
|
(options.vigievulnProxy || /^(default|vigievuln|https:\/\/api\.vigievuln\.(fr|com)\/?$)$/i.test(String(options.proxyCache || "")))) {
|
|
@@ -613,35 +679,74 @@ if (!options.offline && !options.proxyCacheToken && !process.env.VIGIEVULN_PROXY
|
|
|
613
679
|
}
|
|
614
680
|
try { Object.assign(options, require("./lib/hosted-proxy").resolveHostedProxy({ ...options, allowProxyLogin: !!hostedAccountSession || !!(process.stdin.isTTY && process.stderr.isTTY) })); }
|
|
615
681
|
catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
|
|
682
|
+
// An explicitly anonymous server must not receive an inherited key from a
|
|
683
|
+
// different setup. An explicit CLI/environment/file token still takes priority.
|
|
684
|
+
if (options.proxyCache && require('./lib/config').get('proxyAnonymousOrigin') === String(options.proxyCache).replace(/\/+$/, '') &&
|
|
685
|
+
!program.getOptionValueSource('proxyCacheToken')?.match(/^(cli|env)$/) &&
|
|
686
|
+
!Object.hasOwn(_layers.fileLayer, 'proxyCacheToken') && !Object.hasOwn(_layers.envLayer, 'proxyCacheToken') &&
|
|
687
|
+
!process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN) options.proxyCacheToken = null;
|
|
688
|
+
const savedProxyTokenOrigin = require('./lib/config').get('proxyCacheTokenOrigin');
|
|
689
|
+
if (options.proxyCache && options.proxyCacheToken && savedProxyTokenOrigin &&
|
|
690
|
+
!program.getOptionValueSource('proxyCacheToken')?.match(/^(cli|env)$/) &&
|
|
691
|
+
!Object.hasOwn(_layers.fileLayer, 'proxyCacheToken') && !Object.hasOwn(_layers.envLayer, 'proxyCacheToken') &&
|
|
692
|
+
!process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN &&
|
|
693
|
+
savedProxyTokenOrigin !== String(options.proxyCache).replace(/\/+$/, '')) {
|
|
694
|
+
console.error(chalk.red('❌ The saved proxy key belongs to another server. Sign in to the configured proxy or provide its key explicitly.'));
|
|
695
|
+
process.exit(2);
|
|
696
|
+
}
|
|
616
697
|
// A saved official account key must never follow a changed proxy URL to an
|
|
617
698
|
// unrelated service. Custom proxies require a token supplied for this run.
|
|
618
699
|
if (options.proxyCache && !options.vigievulnProxy && options.proxyCacheToken &&
|
|
619
700
|
!program.getOptionValueSource('proxyCacheToken')?.match(/^(cli|env)$/) &&
|
|
620
701
|
!Object.hasOwn(_layers.fileLayer, 'proxyCacheToken') && !Object.hasOwn(_layers.envLayer, 'proxyCacheToken') &&
|
|
621
|
-
!process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN
|
|
702
|
+
!process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN &&
|
|
703
|
+
require('./lib/config').get('proxyCacheTokenOrigin') !== String(options.proxyCache).replace(/\/+$/, '')) {
|
|
622
704
|
console.error(chalk.red('❌ A saved proxy key cannot be sent to a custom proxy. Supply its token explicitly for this run.'));
|
|
623
705
|
process.exit(2);
|
|
624
706
|
}
|
|
625
707
|
// --source CLI alias → src (applyLayers already maps the file/env JSON 'source' key).
|
|
626
708
|
if (!options.src && options.source) options.src = options.source;
|
|
627
709
|
|
|
628
|
-
//
|
|
629
|
-
//
|
|
710
|
+
// Grouped and individual switches have the same layer precedence. Direct
|
|
711
|
+
// switches win over conflicting groups in the same layer.
|
|
630
712
|
{
|
|
631
|
-
const {
|
|
713
|
+
const { applyLayeredGroups } = require("./lib/cli-groups");
|
|
632
714
|
const { applyReports } = require("./lib/cli-groups");
|
|
633
|
-
const { errors } =
|
|
715
|
+
const { errors } = applyLayeredGroups(options, { program, layers: _layers, globalStore: require("./lib/config").load() });
|
|
634
716
|
errors.push(...applyReports(options, options.report && options.report !== true ? options.report : "").errors);
|
|
635
717
|
if (errors.length) {
|
|
636
718
|
for (const e of errors) console.error(chalk.red(`❌ ${e}`));
|
|
637
719
|
process.exit(2);
|
|
638
720
|
}
|
|
639
721
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
722
|
+
if (options.offline && options.snyk) {
|
|
723
|
+
console.error(chalk.red('❌ --snyk requires network access and cannot be combined with --offline.'));
|
|
724
|
+
process.exit(1);
|
|
725
|
+
}
|
|
726
|
+
if (options.advisoryQueryTtl !== undefined && (!/^(?:0|[1-9]\d*)$/.test(String(options.advisoryQueryTtl)) || Number(options.advisoryQueryTtl) > 8760)) {
|
|
727
|
+
console.error(chalk.red('❌ --advisory-query-ttl must be an integer from 0 to 8760 hours.'));
|
|
643
728
|
process.exit(2);
|
|
644
729
|
}
|
|
730
|
+
options.advisoryQueryTtlMs = options.advisoryQueryTtl === undefined ? 4 * 3600 * 1000 : Number(options.advisoryQueryTtl) * 3600 * 1000;
|
|
731
|
+
if (options.forceUpdate && (options.offline || options.exportAnonymized || options.prepareProject)) {
|
|
732
|
+
console.error(chalk.red('❌ --force-update requires an online scan or cache preparation.'));
|
|
733
|
+
process.exit(2);
|
|
734
|
+
}
|
|
735
|
+
require('./lib/cache-policy').setForceUpdate(!!options.forceUpdate);
|
|
736
|
+
let profileWarnings = [];
|
|
737
|
+
try {
|
|
738
|
+
const explicit = name => program.getOptionValueSource(name) === 'cli' || (name === 'osvDb' && String(options.activate || '').split(',').includes('osv-db'));
|
|
739
|
+
const result = require('./lib/source-profile').applySourceProfile(options, {explicit});
|
|
740
|
+
Object.assign(options, result.options); profileWarnings = result.warnings;
|
|
741
|
+
for (const warning of profileWarnings) ui.warn(warning);
|
|
742
|
+
} catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
|
|
743
|
+
if (options.sourceProfile === 'proxy') {
|
|
744
|
+
try {
|
|
745
|
+
const scoped = require('./lib/proxy-scope').proxyScope(options.proxyCache);
|
|
746
|
+
require('./lib/cache-directory').setActiveCacheDir(scoped);
|
|
747
|
+
} catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
|
|
748
|
+
}
|
|
749
|
+
const deps2Exclude = options.exclude ? new RegExp(options.exclude) : null;
|
|
645
750
|
const verbose = !!options.verbose;
|
|
646
751
|
|
|
647
752
|
// ---- Source health: a remote source that goes dark must not produce a quiet hole ----
|
|
@@ -650,13 +755,17 @@ const verbose = !!options.verbose;
|
|
|
650
755
|
// globalThis.fetch, so wrapping it once covers all of them — and a lookup served from the
|
|
651
756
|
// warm cache issues no request at all, which IS the "100% from cache, stay silent" rule.
|
|
652
757
|
const sourceHealth = createSourceHealth();
|
|
758
|
+
const officialAccountFetch = options.sourceProfile === 'proxy' && options.vigievulnProxy && !options.offline
|
|
759
|
+
? require('./lib/source-profile').officialAccountFetch(globalThis.fetch) : null;
|
|
653
760
|
try { setRetryAttempts(options.retries == null ? 5 : options.retries); }
|
|
654
761
|
catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
|
|
655
762
|
if (!options.offline) {
|
|
656
763
|
// The mirror/registry rotations report their own exhaustion (their requests bypass the
|
|
657
764
|
// guard: they carry their own AbortSignal and failover).
|
|
658
765
|
setActiveLedger(sourceHealth);
|
|
659
|
-
const baseFetch =
|
|
766
|
+
const baseFetch = options.sourceProfile === 'proxy'
|
|
767
|
+
? require('./lib/source-profile').proxyOnlyFetch(globalThis.fetch, options.proxyCache)
|
|
768
|
+
: globalThis.fetch;
|
|
660
769
|
// Public data clients call getResource(provider, type, params); configure its
|
|
661
770
|
// transport once, before any lookup. Custom registry URLs stay direct.
|
|
662
771
|
if (options.proxyCache) {
|
|
@@ -666,7 +775,8 @@ if (!options.offline) {
|
|
|
666
775
|
configureResourceRoute({ proxyUrl: options.proxyCache, hosted: !!options.vigievulnProxy,
|
|
667
776
|
token: options.proxyCacheToken || (process.env.VIGIEVULN_PROXY_CACHE_TOKEN ?? process.env.FAD_PROXY_CACHE_TOKEN) || null,
|
|
668
777
|
health: sourceHealth, fetcher: baseFetch,
|
|
669
|
-
store: options.vigievulnProxy ? null : createCacheStore(require("node:path").join(require("./lib/cache-directory").getCacheDir(), "resource-cache"))
|
|
778
|
+
store: options.vigievulnProxy ? null : createCacheStore(require("node:path").join(require("./lib/cache-directory").getCacheDir(), "resource-cache")),
|
|
779
|
+
hostedStore: options.vigievulnProxy ? createCacheStore(require("node:path").join(require("./lib/cache-directory").getCacheDir(), "hosted-resources", require("node:crypto").createHash("sha256").update(options.proxyCache).digest("hex"))) : null });
|
|
670
780
|
} catch (err) {
|
|
671
781
|
console.error(chalk.red(`❌ ${err.message}`));
|
|
672
782
|
process.exit(2);
|
|
@@ -776,7 +886,8 @@ async function classifyMavenLibs(ids, repos) {
|
|
|
776
886
|
if (!probeRepos.length) ui.warn("no Maven repository reachable — existence check skipped, cache reused; pass --offline on an air-gapped box");
|
|
777
887
|
}
|
|
778
888
|
const noNetwork = options.offline || !probeRepos.length;
|
|
779
|
-
const fresh = cache.meta?.fetchedAt &&
|
|
889
|
+
const fresh = cache.meta?.fetchedAt && require('./lib/cache-policy').fresh(cache.meta.fetchedAt, MAX_AGE_MS);
|
|
890
|
+
const previous = !fresh && !noNetwork ? {entries:cache.entries,fetchedAt:cache.meta?.fetchedAt} : null;
|
|
780
891
|
if (!fresh && !noNetwork) cache.entries = {};
|
|
781
892
|
const limit = pLimit(10);
|
|
782
893
|
const results = await Promise.all([...new Set(ids)].map(id => limit(async () => {
|
|
@@ -784,6 +895,7 @@ async function classifyMavenLibs(ids, repos) {
|
|
|
784
895
|
return { id, found: await checkMavenLibExist(g, a, probeRepos, cache, { offline: noNetwork, configuredRepos: repos }) };
|
|
785
896
|
})));
|
|
786
897
|
if (!noNetwork) cache.meta = { fetchedAt: Date.now() };
|
|
898
|
+
if (!noNetwork) require('./lib/cache-policy').preserveEntries(cache,previous);
|
|
787
899
|
if (!noNetwork || migrated) saveJsonCache(MAVEN_EXISTS_CACHE_PATH, cache);
|
|
788
900
|
const absent = results.filter(r => r.found === false).map(r => r.id);
|
|
789
901
|
const unknown = results.filter(r => r.found === null).length;
|
|
@@ -863,11 +975,12 @@ async function timedPhase(label, fn) {
|
|
|
863
975
|
rl.question("", answer => { rl.close(); if (secret) process.stderr.write("\n"); resolve(answer); });
|
|
864
976
|
});
|
|
865
977
|
if (hostedAccountSession) {
|
|
866
|
-
const account = require("./lib/account-client").createAccountClient();
|
|
978
|
+
const account = require("./lib/account-client").createAccountClient(officialAccountFetch ? {fetcher:officialAccountFetch} : {});
|
|
867
979
|
const current = await account.me();
|
|
868
980
|
await require("./lib/account-terms").requireTerms({account, terms:current.terms, ask});
|
|
869
981
|
options.proxyCacheToken = await require("./lib/hosted-proxy").createProxyKey(account);
|
|
870
982
|
require("./lib/config").set("proxyCacheToken", options.proxyCacheToken);
|
|
983
|
+
require("./lib/config").set("proxyCacheTokenOrigin", null);
|
|
871
984
|
require("./lib/providers").configureResourceRoute({proxyUrl:options.proxyCache,token:options.proxyCacheToken});
|
|
872
985
|
console.error("Proxy key created from your signed-in account and saved for future scans.");
|
|
873
986
|
} else {
|
|
@@ -875,8 +988,9 @@ async function timedPhase(label, fn) {
|
|
|
875
988
|
console.error("No account? Register at https://www.vigievuln.fr/account");
|
|
876
989
|
const email = await ask("Email: ");
|
|
877
990
|
const password = await ask("Password: ", true);
|
|
878
|
-
options.proxyCacheToken = await require("./lib/hosted-proxy").loginForProxy({email,password,ask});
|
|
991
|
+
options.proxyCacheToken = await require("./lib/hosted-proxy").loginForProxy({email,password,ask,...(officialAccountFetch ? {fetcher:officialAccountFetch} : {})});
|
|
879
992
|
require("./lib/config").set("proxyCacheToken", options.proxyCacheToken);
|
|
993
|
+
require("./lib/config").set("proxyCacheTokenOrigin", null);
|
|
880
994
|
require("./lib/providers").configureResourceRoute({proxyUrl:options.proxyCache,token:options.proxyCacheToken});
|
|
881
995
|
console.error("Proxy key saved for future scans.");
|
|
882
996
|
}
|
|
@@ -934,6 +1048,11 @@ async function timedPhase(label, fn) {
|
|
|
934
1048
|
if (excludePath.length) ui.kv("exclude-path", chalk.white(excludePath.join(chalk.dim(", "))));
|
|
935
1049
|
if (!defaultExcludes) ui.kv("default-excludes", chalk.yellow("off (walking node_modules/vendor/.git/…)"));
|
|
936
1050
|
ui.kv("mode", chalk.white(runMode));
|
|
1051
|
+
if (options.proxyCache && !options.offline) {
|
|
1052
|
+
let proxyDisplay = 'configured';
|
|
1053
|
+
try { const url = new URL(options.proxyCache); url.username = ''; url.password = ''; url.search = ''; url.hash = ''; proxyDisplay = url.toString(); } catch { /* do not print malformed credentials */ }
|
|
1054
|
+
ui.kv("proxy", chalk.white(proxyDisplay));
|
|
1055
|
+
}
|
|
937
1056
|
|
|
938
1057
|
let wrotePom = 0;
|
|
939
1058
|
|
|
@@ -948,11 +1067,14 @@ async function timedPhase(label, fn) {
|
|
|
948
1067
|
let imported;
|
|
949
1068
|
try { imported = deserializeDeps(descriptor); }
|
|
950
1069
|
catch (e) { console.error(chalk.red(`❌ invalid descriptor: ${e.message}`)); process.exit(1); }
|
|
951
|
-
const { resolved, activeIds, runMaven, runNpm, externalParents = [], importBoms = [], propertyOverrides = {}, applications = [] } = imported;
|
|
1070
|
+
const { resolved, activeIds, runMaven, runNpm, externalParents = [], importBoms = [], propertyOverrides = {}, applications = [], reactor } = imported;
|
|
1071
|
+
// Resolve the project and query its package versions below. A global OSV
|
|
1072
|
+
// seed is optional and must not be downloaded for a project archive.
|
|
952
1073
|
ui.section("Anonymized descriptor");
|
|
953
1074
|
ui.ok(`imported ${chalk.bold(resolved.size)} dep(s) across ${activeIds.join(", ") || "—"}`
|
|
954
1075
|
+ (applications.length ? ` · ${chalk.bold(applications.length)} application(s) (${[...new Set(applications.map(a => a.type))].join(", ")})` : ""));
|
|
955
1076
|
if (options.offline) ui.warn("--offline: caches won't warm; only useful to re-render from an already-warm cache");
|
|
1077
|
+
if (runMaven && !reactor) ui.warn("This descriptor lacks Maven module resolution information; the offline cache may be incomplete. Re-export the descriptor from the extracted manifests with this version.");
|
|
956
1078
|
if (!resolved.size && !applications.length) { ui.warn("descriptor has no dependencies or applications — nothing to scan"); process.exit(0); }
|
|
957
1079
|
// Replay the external-parent / import-BOM backfill from the descriptor's carried hints.
|
|
958
1080
|
// Workflow B has no source tree here, so the mainline store-based backfill can't run —
|
|
@@ -977,7 +1099,7 @@ async function timedPhase(label, fn) {
|
|
|
977
1099
|
// descriptor's drupal/* identities and PrestaShop/TYPO3 are whole-repository
|
|
978
1100
|
// feeds, so no source tree is needed. Application identities also justify SPIP
|
|
979
1101
|
// and WordPress snapshots; --wordfence-live can use a key held by the proxy.
|
|
980
|
-
if (!options.offline) {
|
|
1102
|
+
if (!options.offline && options.appPlugins !== "none") {
|
|
981
1103
|
const { warmCmsAdvisorySnapshots } = require("./lib/cms-snapshot-warm");
|
|
982
1104
|
try {
|
|
983
1105
|
const warmed = await warmCmsAdvisorySnapshots(resolved, {
|
|
@@ -1016,7 +1138,17 @@ async function timedPhase(label, fn) {
|
|
|
1016
1138
|
? await classifyMavenLibs([...resolved.values()].filter(d => d.ecosystem === "maven")
|
|
1017
1139
|
.map(d => `${d.namespace || d.groupId}:${d.name || d.artifactId}`), mavenRepos)
|
|
1018
1140
|
: [];
|
|
1019
|
-
await runReportFlow(resolved, { activeIds, runMaven, runNpm, privateLibIds, mavenRepos, regMap, collectWarnings: [], walkOpts });
|
|
1141
|
+
const warmedReport = await runReportFlow(resolved, { activeIds, runMaven, runNpm, privateLibIds, mavenRepos, regMap, collectWarnings: [], walkOpts, mavenStore: reactor?.store, mavenPropsByPom: reactor?.propsByPom });
|
|
1142
|
+
if (options.prepareOffline && !process.exitCode) {
|
|
1143
|
+
const scope=require('./lib/airgap-project').buildProjectScope(resolved,{applications,cves:warmedReport?.cveIds || []});
|
|
1144
|
+
const cacheDir=require('./lib/cache-directory').getCacheDir();
|
|
1145
|
+
const proxyOrigin=options.sourceProfile==='proxy' ? require('./lib/proxy-scope').proxyOrigin(options.proxyCache) : null;
|
|
1146
|
+
if(!scope.packages.length) ui.warn('no package scope available; exporting the complete local cache');
|
|
1147
|
+
try {
|
|
1148
|
+
const result=await require('./lib/cache-archive-sqlite').exportCache(options.output,{sourceDir:cacheDir,proxyOrigin,project:scope.packages.length?scope:null});
|
|
1149
|
+
ui.ok(`offline archive prepared: ${result.path} (${(result.size/1048576).toFixed(2)} MiB; ${scope.packages.length} packages)`);
|
|
1150
|
+
} catch(error) {console.error(chalk.red(`❌ could not prepare offline archive: ${error.message}`));process.exitCode=2;}
|
|
1151
|
+
}
|
|
1020
1152
|
return;
|
|
1021
1153
|
}
|
|
1022
1154
|
|
|
@@ -1128,8 +1260,8 @@ async function timedPhase(label, fn) {
|
|
|
1128
1260
|
const pkgVersion = require("./package.json").version;
|
|
1129
1261
|
// Carry the Maven resolution hints so a no-source-tree online warm run (Phase 2) can
|
|
1130
1262
|
// resolve the versionless deps' versions and warm their CVE caches in ONE exchange.
|
|
1131
|
-
const externalParents = mavenCtx?.store ? collectExternalParents(mavenCtx.store) : [];
|
|
1132
|
-
const importBoms = mavenCtx?.propsByPom ? collectImportBoms(mavenCtx.propsByPom) : [];
|
|
1263
|
+
const externalParents = (mavenCtx?.store ? collectExternalParents(mavenCtx.store) : []).filter(c => !deps2Exclude || !deps2Exclude.test(c.groupId || ''));
|
|
1264
|
+
const importBoms = (mavenCtx?.propsByPom ? collectImportBoms(mavenCtx.propsByPom) : []).filter(c => !deps2Exclude || !deps2Exclude.test(c.groupId || ''));
|
|
1133
1265
|
const propertyOverrides = mavenCtx?.store ? collectPropertyOverrides(mavenCtx.store) : {};
|
|
1134
1266
|
// Application identities (public product coordinates — type + core version, no
|
|
1135
1267
|
// paths): they let a Phase-2 online run warm what no package coordinate carries
|
|
@@ -1160,7 +1292,8 @@ async function timedPhase(label, fn) {
|
|
|
1160
1292
|
} catch { /* the descriptor stays valid without application identities */ }
|
|
1161
1293
|
}
|
|
1162
1294
|
let omittedProperties = 0;
|
|
1163
|
-
const
|
|
1295
|
+
const reactor = mavenCtx?.store && mavenCtx?.propsByPom ? require('./lib/maven-airgap').buildReactorHints(mavenCtx, { exclude: deps2Exclude, versionPropertyNames: collectVersionPropertyNames(mavenCtx.store) }) : null;
|
|
1296
|
+
const descriptor = serializeDeps(resolved, { generator: `vigievuln ${pkgVersion}`, externalParents, importBoms, reactor,
|
|
1164
1297
|
propertyOverrides, versionPropertyNames: collectVersionPropertyNames(mavenCtx?.store), applications,
|
|
1165
1298
|
onOmittedProperties: n => { omittedProperties = n; } });
|
|
1166
1299
|
try { fs.writeFileSync(options.exportAnonymized, JSON.stringify(descriptor, null, 2) + "\n"); }
|
|
@@ -1177,8 +1310,7 @@ async function timedPhase(label, fn) {
|
|
|
1177
1310
|
const srcShown = options.src || "./proj";
|
|
1178
1311
|
ui.section("Next steps");
|
|
1179
1312
|
ui.info(`${chalk.dim("Phase 2 —")} ${chalk.cyan("ONLINE")} ${chalk.dim("(any box, no --src): warm the caches, then bundle them")}`);
|
|
1180
|
-
ui.info(" " + chalk.white(`vigievuln
|
|
1181
|
-
ui.info(" " + chalk.white("vigievuln --export-cache fad-cache.tar.gz"));
|
|
1313
|
+
ui.info(" " + chalk.white(`vigievuln cache prepare ${descFile} --output fad-cache.tar.gz`));
|
|
1182
1314
|
ui.info(`${chalk.dim("Phase 3 —")} ${chalk.cyan("OFFLINE")} ${chalk.dim("(back here): import the cache, then run the full report")}`);
|
|
1183
1315
|
ui.info(" " + chalk.white("vigievuln --import-cache fad-cache.tar.gz"));
|
|
1184
1316
|
ui.info(" " + chalk.white(`vigievuln -s ${srcShown} --offline`));
|
|
@@ -1335,13 +1467,17 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1335
1467
|
// Collection counts already shown in the "Collection" section by main();
|
|
1336
1468
|
// for --import-anonymized they were shown in the "Anonymized descriptor" section.
|
|
1337
1469
|
const npmWarnings = collectWarnings || [];
|
|
1338
|
-
let scanWarnings =
|
|
1470
|
+
let scanWarnings = profileWarnings.map(message => ({type:'source-unavailable', message}));
|
|
1471
|
+
const sourceLimitations = [];
|
|
1472
|
+
const noteSourceLimitation = (source, message) => {
|
|
1473
|
+
if (!sourceLimitations.some(note => note.source === source && note.message === message)) sourceLimitations.push({source,message});
|
|
1474
|
+
};
|
|
1339
1475
|
let registryPrivateHits = [];
|
|
1340
1476
|
const directCount = resolved.size;
|
|
1341
1477
|
let appState = { applications: [], inventory: [], findings: [], coverage: [], diagnostics: [] };
|
|
1342
1478
|
let applicationRelations = [];
|
|
1343
1479
|
if (options.src) {
|
|
1344
|
-
const wordfenceApiKey = options.wordfenceApiKey || process.env.WORDFENCE_API_KEY || null;
|
|
1480
|
+
const wordfenceApiKey = ['us', 'eu'].includes(options.sourceProfile) ? null : (options.wordfenceApiKey || process.env.WORDFENCE_API_KEY || null);
|
|
1345
1481
|
const { DRUPAL_ADVISORIES_URL, WORDFENCE_PRODUCTION_URL, PRESTASHOP_GITHUB_ADVISORIES_URL, TYPO3_GITHUB_ADVISORIES_URL } = require("./lib/application-providers/live-snapshot");
|
|
1346
1482
|
const wordfenceLiveUrl = options.wordfenceFeedUrl || ((options.wordfenceLive || wordfenceApiKey) && !options.wordfenceFeed ? WORDFENCE_PRODUCTION_URL : null);
|
|
1347
1483
|
const spipLiveUrl = options.spipAdvisoriesLive
|
|
@@ -1430,7 +1566,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1430
1566
|
else ui.info(chalk.dim("First scans may take longer while caches fill."));
|
|
1431
1567
|
|
|
1432
1568
|
const hasNvdKey = !!getNvdApiKey();
|
|
1433
|
-
if (options.nvd && !offline && !hasNvdKey) {
|
|
1569
|
+
if (options.nvd && !offline && !hasNvdKey && !options.vigievulnProxy) {
|
|
1434
1570
|
ui.warn(chalk.yellow("No NVD API key — enrichment throttled to 5 req/30s (slow)."));
|
|
1435
1571
|
ui.info(chalk.dim("Free & instant key: https://nvd.nist.gov/developers/request-an-api-key"));
|
|
1436
1572
|
ui.info(chalk.dim("then: vigievuln --set-nvd-key <KEY>"));
|
|
@@ -1441,9 +1577,13 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1441
1577
|
// and the Maven-Central transitive/BOM/outdated/EOL passes cover them — they're EXCLUDED
|
|
1442
1578
|
// from the per-codec registry loop below to avoid double-processing.
|
|
1443
1579
|
const cveScanner = (runMaven || runGradle) ? (getCodec("maven").nativeScanners || []).find(s => s.kind === "cve") : null;
|
|
1444
|
-
const
|
|
1580
|
+
const cveStore = require("./lib/advisory-store").openAdvisoryStore();
|
|
1581
|
+
const cveIndexExists = !!require("./lib/cve-download").loadCveIndex() || !!cveStore.getSourceCoverage("cveproject", "*") || !!cveStore.getSourceCoverage("cveproject-legacy", "*");
|
|
1445
1582
|
const otherRegistryIds = activeIds.filter(id => id !== "maven" && id !== "gradle" && id !== "npm" && id !== "yarn" && getCodec(id)?.checkRegistry);
|
|
1446
|
-
const willCve = !!cveScanner && (!(options.cveOffline || offline) || cveIndexExists);
|
|
1583
|
+
const willCve = !options.disableCveProject && !!cveScanner && (!(options.cveOffline || offline) || cveIndexExists);
|
|
1584
|
+
if (!options.disableCveProject && cveScanner && (options.cveOffline || offline) && !cveIndexExists) {
|
|
1585
|
+
scanWarnings.push({type: "source-unavailable", message: "CVEProject: local Maven CVE index is missing; Maven CVE coverage is incomplete."});
|
|
1586
|
+
}
|
|
1447
1587
|
// Maven with a source tree: every module is resolved on ITS OWN effective model
|
|
1448
1588
|
// (lib/maven-reactor.js) and the scan set is rebuilt from the union — this replaces the
|
|
1449
1589
|
// old global merged pass + additive per-module overlay, which let one project's pins
|
|
@@ -1473,21 +1613,18 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1473
1613
|
const externalParents = (runMaven && mavenStore)
|
|
1474
1614
|
? require("./lib/maven-bom").collectExternalParents(mavenStore) : [];
|
|
1475
1615
|
const willBom = allBoms.length > 0 || externalParents.length > 0;
|
|
1476
|
-
const willOsv = !!options.osv;
|
|
1616
|
+
const willOsv = !!options.osv || options.osvDb === true;
|
|
1477
1617
|
// Packagist security-advisories lane (Composer): the advisory DB `composer audit`
|
|
1478
1618
|
// queries. OSV misses CVEs that exist there only as CVEProject entries without
|
|
1479
1619
|
// Packagist coordinates (measured: twig/twig CVE-2026-46636/46627, knp-snappy
|
|
1480
1620
|
// CVE-2026-46643 on the real-instance corpus) — this lane is their official home.
|
|
1481
1621
|
const willPackagistAudit = options.packagistAudit !== false &&
|
|
1482
1622
|
[...resolved.values()].some(d => d.ecosystem === "composer");
|
|
1483
|
-
// Local OSV DB import (Maven): offline-complete OSV recall, independent of the per-dep
|
|
1484
|
-
// OSV.dev cache. Opt-in (downloads ~9 MB once); then matches online or offline.
|
|
1485
|
-
const { autoEnableOsvDb, hasOsvDbIndex } = require("./lib/osv-db");
|
|
1486
|
-
const willOsvDb = autoEnableOsvDb(options, { runMaven, runGradle, hasIndex: hasOsvDbIndex("maven") });
|
|
1487
1623
|
const willOutdated = !!options.allLibs;
|
|
1488
1624
|
const willNvd = !!options.nvd;
|
|
1489
1625
|
const willEpss = !!options.epss;
|
|
1490
1626
|
const willKev = !!options.kev;
|
|
1627
|
+
const willGcve = options.gcve !== false && !options.disableGcve;
|
|
1491
1628
|
const willEuvd = options.euvd !== false;
|
|
1492
1629
|
const willCertFr = options.certfr !== false;
|
|
1493
1630
|
const willEol = options.eol !== false;
|
|
@@ -1497,13 +1634,26 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1497
1634
|
const willCerts = options.certs !== false && !!options.src;
|
|
1498
1635
|
const certExpiryDays = parseInt(options.certExpiryDays, 10) || 90;
|
|
1499
1636
|
// Identify committed native binaries by checksum (deps.dev + CIRCL) when present.
|
|
1500
|
-
const willBinaryId = [...resolved.values()].some(d => d.provenance === "binary");
|
|
1637
|
+
const willBinaryId = !options.disableBinaryId && [...resolved.values()].some(d => d.provenance === "binary");
|
|
1501
1638
|
// License detection piggybacks on the registry passes (same fetched metadata),
|
|
1502
1639
|
// so it adds no progress step of its own.
|
|
1503
1640
|
const totalSteps = [willBom, willReactor, willTransitive, willCve, willEol, willEol && composerPlatforms.length > 0,
|
|
1504
|
-
willOutdated, /*npm reg*/ true, ...otherRegistryIds.map(() => true), willOsv, willPackagistAudit,
|
|
1505
|
-
willNvd, willEpss, willKev, willEuvd, willCertFr, willRetire, willCerts, willBinaryId].filter(Boolean).length;
|
|
1641
|
+
willOutdated, /*npm reg*/ true, ...otherRegistryIds.map(() => true), willOsv, willPackagistAudit,
|
|
1642
|
+
willNvd, willEpss, willKev, willGcve, willEuvd, willCertFr, willRetire, willCerts, willBinaryId].filter(Boolean).length;
|
|
1506
1643
|
const progress = new ui.Progress(totalSteps);
|
|
1644
|
+
// Missing POMs and truncated traversal make the dependency inventory
|
|
1645
|
+
// incomplete even when every advisory source is available. Keep coordinates
|
|
1646
|
+
// in memory only; reports disclose the count rather than private names.
|
|
1647
|
+
const missingMavenPoms = new Set();
|
|
1648
|
+
const mavenVariantCollisions = new Set();
|
|
1649
|
+
let mavenDepthLimited = false;
|
|
1650
|
+
let mavenResolutionErrors = 0;
|
|
1651
|
+
const mavenCoverage = {
|
|
1652
|
+
onMissingPom: ({groupId, artifactId, version}) => missingMavenPoms.add(`${groupId}:${artifactId}:${version}`),
|
|
1653
|
+
onDepthLimit: count => { if (count > 0) mavenDepthLimited = true; },
|
|
1654
|
+
onVariantCollision: ({groupId, artifactId}) => mavenVariantCollisions.add(`${groupId}:${artifactId}`),
|
|
1655
|
+
onResolutionError: () => { mavenResolutionErrors++; },
|
|
1656
|
+
};
|
|
1507
1657
|
|
|
1508
1658
|
// The external import-BOM + <parent> managed table, kept for the transitive pass: Maven
|
|
1509
1659
|
// pins transitive versions with it too, not only versionless declarations.
|
|
@@ -1513,7 +1663,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1513
1663
|
try {
|
|
1514
1664
|
const { resolveBomManagedVersions, backfillVersions } = require("./lib/maven-bom");
|
|
1515
1665
|
const effCache = new Map();
|
|
1516
|
-
const base = { repos: mavenRepos, offline, verbose, effCache };
|
|
1666
|
+
const base = { repos: mavenRepos, offline, verbose, effCache, ...mavenCoverage };
|
|
1517
1667
|
// Import BOMs first: a local <scope>import</scope> declaration wins over the
|
|
1518
1668
|
// versions inherited from an external parent (Maven precedence). Import BOMs
|
|
1519
1669
|
// resolve in their own context — the project's property overrides do NOT reach
|
|
@@ -1528,7 +1678,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1528
1678
|
bomDepMgmt = mgmt;
|
|
1529
1679
|
const filled = backfillVersions(resolved, mgmt);
|
|
1530
1680
|
st.done(`${filled} dep version(s) from ${allBoms.length} BOM(s) + ${externalParents.length} parent(s)`);
|
|
1531
|
-
} catch (err) { st.fail(err.message); }
|
|
1681
|
+
} catch (err) { st.fail(err.message); scanWarnings.push({type:'dependency-coverage',message:'Maven BOM or parent resolution failed; dependency coverage is incomplete.'}); }
|
|
1532
1682
|
}
|
|
1533
1683
|
|
|
1534
1684
|
if (willReactor) {
|
|
@@ -1538,15 +1688,16 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1538
1688
|
const rr = await resolveReactor(resolved, mavenStore, mavenPropsByPom, {
|
|
1539
1689
|
verbose,
|
|
1540
1690
|
offline,
|
|
1541
|
-
maxDepth: parseInt(options.transitiveDepth, 10) ||
|
|
1691
|
+
maxDepth: parseInt(options.transitiveDepth, 10) || 20,
|
|
1542
1692
|
includeTestDeps: !options.ignoreTest,
|
|
1543
1693
|
repos: mavenRepos,
|
|
1544
1694
|
transitive: !!options.transitive,
|
|
1545
1695
|
deps2Exclude,
|
|
1696
|
+
...mavenCoverage,
|
|
1546
1697
|
});
|
|
1547
1698
|
st.done(`${rr.modules} module(s), ${resolved.size} dependencies${rr.dropped.length ? `, ${rr.dropped.length} managed-only coord(s) on no classpath` : ""}`);
|
|
1548
1699
|
if (verbose && rr.dropped.length) console.log(chalk.gray(` not on any classpath, not scanned: ${rr.dropped.slice(0, 10).join(", ")}${rr.dropped.length > 10 ? ", …" : ""}`));
|
|
1549
|
-
} catch (err) { st.fail(err.message); }
|
|
1700
|
+
} catch (err) { st.fail(err.message); scanWarnings.push({type:'dependency-coverage',message:'Maven reactor resolution failed; dependency coverage is incomplete.'}); }
|
|
1550
1701
|
}
|
|
1551
1702
|
|
|
1552
1703
|
if (willTransitive) {
|
|
@@ -1554,15 +1705,22 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1554
1705
|
await expandWithTransitives(resolved, {
|
|
1555
1706
|
verbose,
|
|
1556
1707
|
offline,
|
|
1557
|
-
maxDepth: parseInt(options.transitiveDepth, 10) ||
|
|
1708
|
+
maxDepth: parseInt(options.transitiveDepth, 10) || 20,
|
|
1558
1709
|
includeTestDeps: !options.ignoreTest,
|
|
1559
1710
|
repos: mavenRepos,
|
|
1560
1711
|
bomDepMgmt,
|
|
1712
|
+
...mavenCoverage,
|
|
1561
1713
|
// With the reactor in charge of the Maven records, only Gradle ones are seeded here.
|
|
1562
1714
|
...(willReactor ? { only: d => d.ecosystemType === "gradle" } : {}),
|
|
1563
1715
|
});
|
|
1564
1716
|
st.done(`+${resolved.size - directCount} transitive (total ${resolved.size})`);
|
|
1565
1717
|
}
|
|
1718
|
+
if (missingMavenPoms.size) scanWarnings.push({type:'dependency-coverage',count:missingMavenPoms.size,
|
|
1719
|
+
message:`${missingMavenPoms.size} Maven POM(s) could not be resolved; transitive dependency coverage may be incomplete.`});
|
|
1720
|
+
if (mavenVariantCollisions.size) scanWarnings.push({type:'dependency-coverage',count:mavenVariantCollisions.size,
|
|
1721
|
+
message:`${mavenVariantCollisions.size} Maven coordinate(s) occur with different types or classifiers; version and transitive dependency coverage may be incomplete.`});
|
|
1722
|
+
if (mavenResolutionErrors) scanWarnings.push({type:'dependency-coverage',count:mavenResolutionErrors,
|
|
1723
|
+
message:'Maven transitive resolution failed for part of the dependency graph; coverage is incomplete.'});
|
|
1566
1724
|
|
|
1567
1725
|
// <dependencyManagement>-only pins: keep the ones a resolution pass reached (now
|
|
1568
1726
|
// transitives), drop the rest — a pin nothing pulls in is on no classpath.
|
|
@@ -1579,7 +1737,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1579
1737
|
// are flagged, not the ones we just resolved from spring-boot-dependencies & co.
|
|
1580
1738
|
if (runMaven || runGradle) {
|
|
1581
1739
|
const { detectScanCompletenessWarnings } = require("./lib/scan-completeness");
|
|
1582
|
-
scanWarnings
|
|
1740
|
+
scanWarnings.push(...detectScanCompletenessWarnings(resolved, { ranSnyk: !!options.snyk, ranTransitive: !!options.transitive }));
|
|
1583
1741
|
}
|
|
1584
1742
|
|
|
1585
1743
|
// 1. CVE — native scanner contributed by the maven codec (local cvelistV5 index).
|
|
@@ -1588,9 +1746,22 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1588
1746
|
if (willCve) {
|
|
1589
1747
|
const st = progress.start("CVE index (CVEProject)");
|
|
1590
1748
|
try {
|
|
1591
|
-
const r = await cveScanner.scan(resolved, { cveRefresh: !!options.cveRefresh, cveOffline: !!options.cveOffline, offline, verbose, hostedProxy: !!options.vigievulnProxy });
|
|
1749
|
+
const r = await cveScanner.scan(resolved, { cveRefresh: !!options.cveRefresh, cveOffline: !!options.cveOffline, offline, verbose, hostedProxy: !!options.vigievulnProxy, queryTtlMs:options.advisoryQueryTtlMs });
|
|
1592
1750
|
cveMatches = r.matches || [];
|
|
1593
1751
|
cveDataDate = r.meta?.cveDataDate || null;
|
|
1752
|
+
if (r.meta?.incomplete) {
|
|
1753
|
+
if (!offline && !r.meta.refreshError) noteSourceLimitation('CVEProject','The Maven lookup uses a partial native or legacy projection; some source records may not be represented.');
|
|
1754
|
+
else scanWarnings.push({type:"source-unavailable",message:`CVEProject: ${r.meta.refreshError ? `refresh failed (${r.meta.refreshError}); ` : ""}native or legacy source coverage is partial; Maven advisory coverage is incomplete.`});
|
|
1755
|
+
}
|
|
1756
|
+
if (r.meta?.identityUncertain) {
|
|
1757
|
+
const candidates=r.meta.uncertainCandidates || [];
|
|
1758
|
+
const needsReview=require('./lib/coverage-diagnostics').needsMavenReview;
|
|
1759
|
+
if (r.meta.oldProjection || candidates.some(candidate=>needsReview(candidate,cveStore,{ttlMs:options.advisoryQueryTtlMs})))
|
|
1760
|
+
scanWarnings.push({type:"source-unavailable",message:"CVEProject: some advisory product identities or version ranges could not be verified; those candidates were not reported and coverage is incomplete."});
|
|
1761
|
+
else noteSourceLimitation('CVEProject','Some product-only candidates lack a reliable Maven package identity; independent OSV evidence is used when available.');
|
|
1762
|
+
}
|
|
1763
|
+
if (r.meta?.stale || r.meta?.timestampUnknown) scanWarnings.push({type:"source-stale",message:`CVEProject: proxy response ${r.meta.timestampUnknown ? "has no trustworthy collection timestamp" : "is stale"}; advisory coverage may be outdated.`});
|
|
1764
|
+
if (r.meta?.conflict) scanWarnings.push({type:"source-unavailable",message:"CVEProject: a native record conflicts with the proxy corpus; the native revision or rejection was used."});
|
|
1594
1765
|
st.done(`${cveMatches.length} match(es)${cveDataDate ? ` · ${String(cveDataDate).slice(0, 10)}` : ""}`);
|
|
1595
1766
|
} catch (err) {
|
|
1596
1767
|
st.fail(err.message);
|
|
@@ -1598,6 +1769,25 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1598
1769
|
}
|
|
1599
1770
|
}
|
|
1600
1771
|
|
|
1772
|
+
// CVEProject also publishes explicit npm PURLs. They are independent of
|
|
1773
|
+
// the Maven-only projected index and complement OSV when a CNA advisory is
|
|
1774
|
+
// absent there; never infer npm identity from the product description.
|
|
1775
|
+
if (!options.disableCveProject && runNpm) {
|
|
1776
|
+
try {
|
|
1777
|
+
if (!offline && !options.cveOffline && require('./lib/providers').hasHostedProxy()) {
|
|
1778
|
+
try {
|
|
1779
|
+
const status=await require('./lib/cve-npm-proxy').refreshNpmCves(resolved,cveStore,{ttlMs:options.advisoryQueryTtlMs});
|
|
1780
|
+
if(status.incomplete)scanWarnings.push({type:'source-unavailable',message:'CVEProject: the npm proxy index is partial or stale; advisory coverage is incomplete.'});
|
|
1781
|
+
} catch (err) {scanWarnings.push({type:'source-unavailable',message:`CVEProject npm proxy: ${err.message}; cached records are still matched.`});}
|
|
1782
|
+
}
|
|
1783
|
+
const npmCves = require('./lib/native-advisories').matchNativeNpmCves(resolved, cveStore);
|
|
1784
|
+
cveMatches = require('./lib/merge-sources').mergeBySource(cveMatches, npmCves.matches);
|
|
1785
|
+
if (npmCves.unknown.length) scanWarnings.push({type:'source-unavailable',message:`CVEProject: ${npmCves.unknown.length} npm package/version comparison(s) are undecidable; advisory coverage is incomplete.`});
|
|
1786
|
+
const npmNames=require('./lib/cve-npm-proxy').packageNames(resolved);
|
|
1787
|
+
if (!cveStore.getSourceCoverage('cveproject','*')?.complete && npmNames.some(name=>!cveStore.getQuery({source:'cveproject',ecosystem:'npm',name,version:'*'},{ttlMs:options.advisoryQueryTtlMs})?.fresh)) scanWarnings.push({type:'source-unavailable',message:'CVEProject: native npm advisory coverage is incomplete; records absent from OSV may be missing.'});
|
|
1788
|
+
} catch (err) { scanWarnings.push({type:'source-unavailable',message:`CVEProject npm: ${err.message}; advisory coverage is incomplete.`}); }
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1601
1791
|
// 1c. Identify committed native binaries by checksum (deps.dev → CIRCL).
|
|
1602
1792
|
if (willBinaryId) {
|
|
1603
1793
|
const st = progress.start("Binary identification (deps.dev + CIRCL)");
|
|
@@ -1705,23 +1895,32 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1705
1895
|
// query transitives for the authoritative deprecation signal.
|
|
1706
1896
|
outdatedResults = outdatedResults.filter(r => r.dep.scope !== "transitive");
|
|
1707
1897
|
|
|
1898
|
+
// Consult our published records by package even when the operator already
|
|
1899
|
+
// has a complete OSV seed. The saved consultation makes removals effective
|
|
1900
|
+
// offline too, without downloading the global cache again.
|
|
1901
|
+
if (!offline && require('./lib/providers').hasProxyRoute() && (options.sourceProfile === 'proxy' || require('./lib/providers').hasHostedProxy())) {
|
|
1902
|
+
try { await require('./lib/vigievuln-advisories').refreshReviewed(resolved,cveStore,{ttlMs:options.advisoryQueryTtlMs}); }
|
|
1903
|
+
catch (err) { scanWarnings.push({type:'source-unavailable',message:`VigieVuln: reviewed advisory refresh failed (${err.message}); cached records are used with incomplete coverage.`}); }
|
|
1904
|
+
}
|
|
1708
1905
|
// 4b. OSV.dev — Maven-native CVE+GHSA feed (huge recall win over raw CVEProject)
|
|
1709
1906
|
if (willOsv) {
|
|
1710
1907
|
const st = progress.start("OSV.dev");
|
|
1711
1908
|
try {
|
|
1712
1909
|
const { queryOsvForDeps } = require("./lib/osv");
|
|
1713
|
-
const osvMatches = await queryOsvForDeps(resolved, { verbose, offline,
|
|
1910
|
+
const osvMatches = await queryOsvForDeps(resolved, { verbose, offline, allowStaleFallback:true, queryTtlMs:options.osvDbRefresh ? 0 : options.advisoryQueryTtlMs, useStoredRanges:options.osvDb !== false,
|
|
1714
1911
|
onProgress: (p, t) => st.tick(p, t), onWarning: w => scanWarnings.push(w) });
|
|
1715
1912
|
const before = cveMatches.length;
|
|
1716
1913
|
cveMatches = mergeBySource(cveMatches, osvMatches);
|
|
1717
1914
|
st.done(`${osvMatches.length} vulns · +${cveMatches.length - before} after merge`);
|
|
1718
1915
|
} catch (err) {
|
|
1719
1916
|
st.fail(err.message);
|
|
1720
|
-
|
|
1721
|
-
scanWarnings.push({type:"source-unavailable",message:`OSV: ${err.message}; advisory coverage is incomplete. Existing package caches were preserved.`});
|
|
1722
|
-
}
|
|
1917
|
+
scanWarnings.push({type:"source-unavailable",message:`OSV: ${err.message}; advisory coverage is incomplete. Existing advisory data was preserved.`});
|
|
1723
1918
|
}
|
|
1724
1919
|
}
|
|
1920
|
+
else {
|
|
1921
|
+
try { cveMatches=mergeBySource(cveMatches,require('./lib/osv').queryReviewedForDeps(resolved,{store:cveStore,queryTtlMs:options.advisoryQueryTtlMs,onWarning:w=>scanWarnings.push(w)})); }
|
|
1922
|
+
catch(err) { scanWarnings.push({type:'source-unavailable',message:`VigieVuln: reviewed advisory matching failed (${err.message}); coverage is incomplete.`}); }
|
|
1923
|
+
}
|
|
1725
1924
|
|
|
1726
1925
|
// 4b-bis. Packagist security advisories (Composer) — the database `composer audit`
|
|
1727
1926
|
// queries. Default-on like OSV: silently missing it shrinks the report; `-d
|
|
@@ -1750,24 +1949,51 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1750
1949
|
}
|
|
1751
1950
|
}
|
|
1752
1951
|
|
|
1753
|
-
//
|
|
1754
|
-
//
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
const st = progress.start("OSV database (local, Maven)");
|
|
1952
|
+
// GCVE records are matched locally, including when imported in a cache seed.
|
|
1953
|
+
// Online scans refresh the index through the configured proxy when one is active.
|
|
1954
|
+
if (willGcve) {
|
|
1955
|
+
const st = progress.start("GCVE (local index)");
|
|
1758
1956
|
try {
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1957
|
+
const path = require('node:path');
|
|
1958
|
+
const { readGcveIndex } = require('./lib/gcve-index');
|
|
1959
|
+
const store = require('./lib/advisory-store').openAdvisoryStore();
|
|
1960
|
+
const file = path.join(require('./lib/cache-directory').getCacheDir(), 'gcve-data', 'index.json');
|
|
1961
|
+
let index = null;
|
|
1962
|
+
try { index = readGcveIndex(file); } catch {}
|
|
1963
|
+
const nativeCoverage = store.getSourceCoverage('gcve','*');
|
|
1964
|
+
const oldest = index?.coverage?.map(c => Date.parse(c.collectedAt)).filter(Number.isFinite) || (nativeCoverage?.fetchedAt ? [nativeCoverage.fetchedAt] : []);
|
|
1965
|
+
let stale = !oldest.length || Date.now() - Math.min(...oldest) >= options.advisoryQueryTtlMs;
|
|
1966
|
+
if ((!index && !nativeCoverage || stale || options.forceUpdate) && !offline && !options.gcveOffline) {
|
|
1967
|
+
try {
|
|
1968
|
+
const feed=require('./lib/gcve-feed');
|
|
1969
|
+
index = (await feed.updateGcveIndex({cacheFile:file,
|
|
1970
|
+
...(options.proxyCache?{fetcher:feed.proxyGcveFetcher}:{})})).index;
|
|
1971
|
+
stale = false;
|
|
1972
|
+
}
|
|
1973
|
+
catch (err) {
|
|
1974
|
+
if (!index && !nativeCoverage) throw err;
|
|
1975
|
+
scanWarnings.push({type:'source-unavailable',message:`GCVE refresh failed: ${err.message}; previous index retained.`});
|
|
1976
|
+
}
|
|
1769
1977
|
}
|
|
1770
|
-
|
|
1978
|
+
if (!index && !nativeCoverage) throw new Error(offline || options.gcveOffline
|
|
1979
|
+
? 'GCVE has no local data for an offline scan; run an online scan first or import a GCVE cache seed'
|
|
1980
|
+
: 'GCVE source returned no advisory data');
|
|
1981
|
+
const asOf = oldest.length ? Math.min(...oldest) : 0;
|
|
1982
|
+
if (index && (!nativeCoverage || nativeCoverage.fetchedAt < asOf)) await require('./lib/native-advisories').importGcveIndex(store,index,{provenance:{transport:'cache'}});
|
|
1983
|
+
const result = require('./lib/native-advisories').matchGcveStore(resolved,store,index);
|
|
1984
|
+
const before = cveMatches.length;
|
|
1985
|
+
cveMatches = mergeBySource(cveMatches,result.matches);
|
|
1986
|
+
if (stale) scanWarnings.push({type:'source-stale',message:'GCVE index is older than the advisory query TTL or lacks a source timestamp; advisory coverage may be outdated.'});
|
|
1987
|
+
const skipped = index?.directory?.notCollected;
|
|
1988
|
+
const unindexed = result.coverage.reduce((n,c)=>n+(c.unindexed || 0),0);
|
|
1989
|
+
if (!result.sourceCoverage?.complete || (index && (!index.directory?.verified || !result.coverage.length || result.coverage.some(c=>!c.complete) || skipped || unindexed)))
|
|
1990
|
+
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.`);
|
|
1991
|
+
if (result.unknown.length) scanWarnings.push({type:'source-unavailable',message:`GCVE: ${result.unknown.length} package/version comparison(s) are undecidable; advisory coverage is incomplete.`});
|
|
1992
|
+
st.done(`${result.matches.length} matched · +${cveMatches.length-before} new`);
|
|
1993
|
+
} catch (err) {
|
|
1994
|
+
st.fail(err.message);
|
|
1995
|
+
scanWarnings.push({type:'source-unavailable',message:`GCVE: ${err.message}; advisory coverage is incomplete.`});
|
|
1996
|
+
}
|
|
1771
1997
|
}
|
|
1772
1998
|
|
|
1773
1999
|
// Application-provider findings enter the shared enrichment, priority and gate
|
|
@@ -1782,22 +2008,41 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1782
2008
|
// 4c. NVD enrichment — canonical description + full CVSS for matched CVEs.
|
|
1783
2009
|
if (willNvd) {
|
|
1784
2010
|
const st = progress.start("NVD enrichment");
|
|
1785
|
-
|
|
2011
|
+
let nvdBindings = [];
|
|
2012
|
+
if (willOsv && options.osvDb !== false) try {
|
|
2013
|
+
nvdBindings = require('./lib/nvd-package-ranges').collectPackageNvdBindings(resolved, require('./lib/advisory-store').openAdvisoryStore());
|
|
2014
|
+
} catch (err) {
|
|
2015
|
+
scanWarnings.push({type:'source-unavailable',message:`NVD package candidates: ${err.message}; additional range coverage is incomplete.`});
|
|
2016
|
+
}
|
|
2017
|
+
if (!cveMatches.length && !nvdBindings.length) {
|
|
1786
2018
|
st.skip("no CVE to enrich");
|
|
1787
2019
|
} else {
|
|
1788
2020
|
try {
|
|
1789
|
-
const { enrichMatches } = require("./lib/nvd");
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
//
|
|
1798
|
-
//
|
|
1799
|
-
//
|
|
2021
|
+
const { enrichMatches, hasCachedAbsence } = require("./lib/nvd");
|
|
2022
|
+
const nvdCandidates = [...cveMatches, ...nvdBindings];
|
|
2023
|
+
await enrichMatches(nvdCandidates, { verbose, offline, mirror: options.nvdMirror !== false, onProgress: (p, t) => st.tick(p, t) });
|
|
2024
|
+
const unavailableBindings = new Set(nvdBindings.filter(m => !m.source.split('+').includes('nvd') && !hasCachedAbsence(m.cve.id)).map(m => m.cve.id));
|
|
2025
|
+
const absentBindings = new Set(nvdBindings.filter(m => !m.source.split('+').includes('nvd') && hasCachedAbsence(m.cve.id)).map(m => m.cve.id));
|
|
2026
|
+
if (unavailableBindings.size) scanWarnings.push({type:'source-unavailable',message:`NVD: ${unavailableBindings.size} package-bound CVE record(s) unavailable; additional version-range coverage is incomplete.`});
|
|
2027
|
+
if (absentBindings.size) noteSourceLimitation('NVD',`NVD returned no record for ${absentBindings.size} package-linked CVE(s) at the last consultation.`);
|
|
2028
|
+
|
|
2029
|
+
// 4c-bis. Complement OSV's ranges with NVD only when both sources
|
|
2030
|
+
// identify the same artifact. Stored OSV package bindings can supply
|
|
2031
|
+
// candidates even when this scan has no OSV hit for that CVE. Those
|
|
2032
|
+
// candidates become findings only after an artifact-level CPE/range
|
|
2033
|
+
// match; neither generic framework CPEs nor guessed names qualify.
|
|
1800
2034
|
let nvdAdded = 0;
|
|
2035
|
+
const {matchBoundNvdRanges,matchNvdAffected} = require('./lib/nvd-package-ranges');
|
|
2036
|
+
let nativeNvdUncertain = false, nativeNvdCandidates = false;
|
|
2037
|
+
const needsReview=require('./lib/coverage-diagnostics').needsMavenReview;
|
|
2038
|
+
const boundNvd = [...matchNvdAffected(resolved, nvdCandidates, {onUncertain:candidate=>{nativeNvdCandidates=true;if(needsReview(candidate,cveStore,{ttlMs:options.advisoryQueryTtlMs}))nativeNvdUncertain=true;}}), ...matchBoundNvdRanges(resolved, nvdCandidates)];
|
|
2039
|
+
if (nativeNvdUncertain) scanWarnings.push({type:'source-unavailable',message:'NVD: some native affected entries have unverified package identities or version applicability; those candidates were not reported and coverage is incomplete.'});
|
|
2040
|
+
else if (nativeNvdCandidates) noteSourceLimitation('NVD','Some product-only candidates lack a reliable Maven package identity; independent OSV evidence is used when available.');
|
|
2041
|
+
if (boundNvd.length) {
|
|
2042
|
+
const before = cveMatches.length;
|
|
2043
|
+
cveMatches = mergeBySource(cveMatches, boundNvd);
|
|
2044
|
+
nvdAdded += cveMatches.length - before;
|
|
2045
|
+
}
|
|
1801
2046
|
if (options.nvdCpeMatch) try {
|
|
1802
2047
|
const { matchDepsAgainstNvdCpe } = require("./lib/cpe");
|
|
1803
2048
|
const records = {};
|
|
@@ -1809,7 +2054,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1809
2054
|
if (extra.length) {
|
|
1810
2055
|
const before = cveMatches.length;
|
|
1811
2056
|
cveMatches = mergeBySource(cveMatches, extra);
|
|
1812
|
-
nvdAdded
|
|
2057
|
+
nvdAdded += cveMatches.length - before;
|
|
1813
2058
|
}
|
|
1814
2059
|
} catch (err) { ui.warn(`NVD CPE matching skipped: ${err.message}`); }
|
|
1815
2060
|
// 4d. CPE refinement — use NVD's CPE configurations to upgrade match
|
|
@@ -1821,8 +2066,11 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1821
2066
|
filtered = cveMatches.filter(m => m.cpeFiltered).length;
|
|
1822
2067
|
} catch (err) { ui.warn(`CPE refinement skipped: ${err.message}`); }
|
|
1823
2068
|
const uniqueCves = new Set(cveMatches.map(m => m.cve?.id)).size;
|
|
1824
|
-
st.done(`${uniqueCves} CVE${nvdAdded ? ` · +${nvdAdded} via
|
|
1825
|
-
} catch (err) {
|
|
2069
|
+
st.done(`${uniqueCves} CVE${nvdAdded ? ` · +${nvdAdded} via NVD ranges` : ""}${filtered ? ` · ${filtered} false-positive(s) filtered` : ""}${hasNvdKey || options.vigievulnProxy ? "" : " · no key (slow)"}`);
|
|
2070
|
+
} catch (err) {
|
|
2071
|
+
st.fail(err.message);
|
|
2072
|
+
scanWarnings.push({type:'source-unavailable',message:`NVD: ${err.message}; enrichment and additional version-range coverage are incomplete.`});
|
|
2073
|
+
}
|
|
1826
2074
|
}
|
|
1827
2075
|
}
|
|
1828
2076
|
|
|
@@ -1867,7 +2115,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1867
2115
|
else {
|
|
1868
2116
|
try {
|
|
1869
2117
|
const { enrichEuvd } = require("./lib/euvd");
|
|
1870
|
-
await enrichEuvd(cveMatches, { verbose, offline, hostedProxy: !!options.vigievulnProxy });
|
|
2118
|
+
await enrichEuvd(cveMatches, { verbose, offline, hostedProxy: !!options.vigievulnProxy, onStale: date => sourceHealth.markStale('euvd', date) });
|
|
1871
2119
|
const ids = new Set(cveMatches.filter(m => m.cve?.euvd?.id).map(m => m.cve.id)).size;
|
|
1872
2120
|
const exploited = new Set(cveMatches.filter(m => m.cve?.euvd?.exploitedSince != null).map(m => m.cve.id)).size;
|
|
1873
2121
|
st.done(`${ids} EUVD id(s) · ${exploited} exploited per ENISA`);
|
|
@@ -1909,7 +2157,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1909
2157
|
else if (!options.src) { st.skip("no source tree (descriptor import)"); }
|
|
1910
2158
|
else {
|
|
1911
2159
|
try {
|
|
1912
|
-
const r = await sc.scan(resolved, { src: options.src, verbose, retireRefresh: !!options.retireRefresh, offline, excludePath, defaultExcludes });
|
|
2160
|
+
const r = await sc.scan(resolved, { src: options.src, verbose, retireRefresh: !!(options.retireRefresh || options.forceUpdate), offline, excludePath, defaultExcludes });
|
|
1913
2161
|
retireMatches = r.matches || [];
|
|
1914
2162
|
if (options.vendoredJsInventory !== false) vendoredJsInventory = r.meta?.inventory || [];
|
|
1915
2163
|
const invN = vendoredJsInventory.length;
|
|
@@ -1955,16 +2203,23 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
1955
2203
|
let snykMatches = [];
|
|
1956
2204
|
if (options.snyk) {
|
|
1957
2205
|
if (!options.target) {
|
|
1958
|
-
|
|
2206
|
+
const message="--snyk requires --target (snyk runs on cleaned POMs)";
|
|
2207
|
+
ui.warn(message);scanWarnings.push({type:'source-unavailable',message});
|
|
1959
2208
|
} else {
|
|
1960
2209
|
const snyk = require("./lib/snyk");
|
|
1961
2210
|
try {
|
|
1962
2211
|
const raw = await snyk.runSnykTest(options.target, { verbose });
|
|
2212
|
+
const errors = raw.filter(project => project?.ok === false && project.error).map(project => String(project.error));
|
|
2213
|
+
if (errors.length) {
|
|
2214
|
+
const message = `Snyk could not scan ${errors.length} project(s): ${[...new Set(errors)].join('; ')}`;
|
|
2215
|
+
ui.warn(message);scanWarnings.push({ type: 'source-unavailable', message });
|
|
2216
|
+
}
|
|
1963
2217
|
snykMatches = snyk.parseSnykResults(raw);
|
|
1964
|
-
cveMatches = snyk.mergeWithFadResults(cveMatches, snykMatches);
|
|
2218
|
+
cveMatches = snyk.mergeWithFadResults(cveMatches, snykMatches, resolved);
|
|
1965
2219
|
ui.ok(`Snyk: ${snykMatches.length} findings merged`);
|
|
1966
2220
|
} catch (err) {
|
|
1967
|
-
|
|
2221
|
+
const message=`Snyk run failed: ${err.message}`;
|
|
2222
|
+
ui.warn(message);scanWarnings.push({ type: 'source-unavailable', message });
|
|
1968
2223
|
}
|
|
1969
2224
|
}
|
|
1970
2225
|
}
|
|
@@ -2146,6 +2401,8 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2146
2401
|
if (retireMatches.length > 8) console.log(chalk.dim(` …and ${retireMatches.length - 8} more`));
|
|
2147
2402
|
}
|
|
2148
2403
|
|
|
2404
|
+
const durableIssues = require('./lib/package-versions').drainIssues();
|
|
2405
|
+
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});
|
|
2149
2406
|
if (scanWarnings.length) {
|
|
2150
2407
|
console.log();
|
|
2151
2408
|
ui.warn(`${scanWarnings.length} scan-completeness note(s) — a real Maven/Snyk run may surface more:`);
|
|
@@ -2197,7 +2454,10 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2197
2454
|
// the JSON export's `provenance` block.
|
|
2198
2455
|
try {
|
|
2199
2456
|
const { buildScanProvenance } = require("./lib/provenance");
|
|
2200
|
-
projectInfo.provenance = buildScanProvenance({ toolVersion: pkg.version, generatedAt: projectInfo.generatedAt, options
|
|
2457
|
+
projectInfo.provenance = buildScanProvenance({ toolVersion: pkg.version, generatedAt: projectInfo.generatedAt, options,
|
|
2458
|
+
ecosystems:new Set([...resolved.values()].filter(d=>d.provenance!=='binary').map(d=>d.ecosystem)) });
|
|
2459
|
+
if (sourceLimitations.length) projectInfo.provenance.sourceLimitations=sourceLimitations;
|
|
2460
|
+
if (mavenDepthLimited) projectInfo.provenance.mavenDepthLimitReached=true;
|
|
2201
2461
|
} catch (err) { if (verbose) ui.warn(`provenance manifest skipped: ${err.message}`); }
|
|
2202
2462
|
|
|
2203
2463
|
// --- Output target resolution -------------------------------------------------
|
|
@@ -2237,7 +2497,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2237
2497
|
...sourceHealth.degraded().map(s => ({type:"source-unavailable",count:1,
|
|
2238
2498
|
message:`${s.id}: source unavailable (${s.codes.join(", ") || "no response"}); coverage may be incomplete.`})),
|
|
2239
2499
|
...sourceHealth.stale().map(s => ({ type:"source-stale", count:1,
|
|
2240
|
-
message:`${s.id}:
|
|
2500
|
+
message:`${s.id}: cached data${s.at ? ` from ${new Date(s.at).toISOString()}` : " of unknown age"} was used and may be outdated. Coverage may be incomplete.` })),
|
|
2241
2501
|
// A project already on a vendor build of an open-source-EOL cycle: covered by the paid
|
|
2242
2502
|
// support that build comes from, so it is a note, not an EOL finding.
|
|
2243
2503
|
...commercialBuildNotes.map(e => ({ type: "commercial-build",
|
|
@@ -2293,10 +2553,10 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2293
2553
|
const { buildPrivateItems } = require("./lib/private-deps");
|
|
2294
2554
|
const mavenItems = privateLibIds.map(id => {
|
|
2295
2555
|
const dep = resolved.get(id);
|
|
2296
|
-
const paths = (dep?.pomPaths || []).map(p => path.relative(options.src, p));
|
|
2556
|
+
const paths = options.src ? (dep?.pomPaths || []).map(p => path.relative(options.src, p)) : [];
|
|
2297
2557
|
return { id, ecosystem: "maven", manifestPaths: paths };
|
|
2298
2558
|
});
|
|
2299
|
-
const otherItems = buildPrivateItems(registryPrivateHits, { relativise: p => path.relative(options.src, p) });
|
|
2559
|
+
const otherItems = buildPrivateItems(registryPrivateHits, { relativise: p => options.src ? path.relative(options.src, p) : '' });
|
|
2300
2560
|
const items = [...mavenItems, ...otherItems];
|
|
2301
2561
|
if (!items.length) return [];
|
|
2302
2562
|
const ecos = [...new Set(items.map(i => i.ecosystem))].sort().join(", ");
|
|
@@ -2308,6 +2568,18 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2308
2568
|
}];
|
|
2309
2569
|
})(),
|
|
2310
2570
|
];
|
|
2571
|
+
// Freshness is provenance, not a source outage. Keep the evidence in JSON
|
|
2572
|
+
// and chapter 0, while preserving it for the explicit strict-coverage gate.
|
|
2573
|
+
const freshnessNotices = [];
|
|
2574
|
+
const { freshnessNotice } = require('./lib/cve-report');
|
|
2575
|
+
for (let i = reportWarnings.length - 1; i >= 0; i--) {
|
|
2576
|
+
const info = freshnessNotice(reportWarnings[i], !offline);
|
|
2577
|
+
if (info) { freshnessNotices.unshift(info); reportWarnings.splice(i, 1); }
|
|
2578
|
+
}
|
|
2579
|
+
if (freshnessNotices.length) {
|
|
2580
|
+
projectInfo.provenance ||= { mode: offline ? 'offline' : 'online' };
|
|
2581
|
+
projectInfo.provenance.freshnessNotices = freshnessNotices;
|
|
2582
|
+
}
|
|
2311
2583
|
|
|
2312
2584
|
// Differential audit vs --baseline: build the current findings doc once, diff it
|
|
2313
2585
|
// against the prior export → a `diff` block for the report + JSON export, and a
|
|
@@ -2414,7 +2686,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2414
2686
|
for (const [label, p] of wrote) ui.ok(`${label} → ${chalk.white(p)}`);
|
|
2415
2687
|
} else if (options.report === false) {
|
|
2416
2688
|
ui.info(chalk.dim(options.importAnonymized
|
|
2417
|
-
? "import-anonymized: caches warmed, no report written (pair with --export-cache, then report offline from the real source tree)"
|
|
2689
|
+
? (options.prepareOffline ? "descriptor prepared; building the offline archive" : "import-anonymized: caches warmed, no report written (pair with --export-cache, then report offline from the real source tree)")
|
|
2418
2690
|
: "--no-report: no files written (scan + gate only)"));
|
|
2419
2691
|
}
|
|
2420
2692
|
console.log();
|
|
@@ -2459,13 +2731,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
|
|
|
2459
2731
|
if (!required.length || required.some(x => !known.has(x))) {
|
|
2460
2732
|
console.error(chalk.red(`❌ invalid --fail-on-incomplete capabilities: ${raw}`));
|
|
2461
2733
|
process.exitCode = 2;
|
|
2462
|
-
} else if ((required.includes("sources") && (sourceHealth.degraded().length || sourceHealth.stale().length || reportWarnings.some(w => w.type === "source-unavailable" || w.type === "source-stale"))) || !requiredCoverageComplete(appState.coverage, required.filter(x => x !== "sources"))) {
|
|
2734
|
+
} else if (((required.includes("inventory") || required.includes("sources")) && (mavenDepthLimited || reportWarnings.some(w => w.type === "dependency-coverage" || w.type === "go-coverage"))) || (required.includes("sources") && (sourceLimitations.length || freshnessNotices.length || sourceHealth.degraded().length || sourceHealth.stale().length || reportWarnings.some(w => w.type === "source-unavailable" || w.type === "source-stale" || w.type === "osv-coverage"))) || !requiredCoverageComplete(appState.coverage, required.filter(x => x !== "sources"))) {
|
|
2463
2735
|
ui.section("Coverage gate");
|
|
2464
2736
|
console.log(chalk.red(`✗ required application checks incomplete: ${required.join(", ")}`));
|
|
2465
2737
|
process.exitCode = 2;
|
|
2466
2738
|
}
|
|
2467
2739
|
}
|
|
2468
2740
|
if (xlsxFailed) process.exitCode = 2;
|
|
2741
|
+
return {cveIds:[...new Set(cveMatches.map(m=>m.cve?.id).filter(id=>/^CVE-\d{4}-\d{4,7}$/.test(id||'')))]};
|
|
2469
2742
|
}
|
|
2470
2743
|
|
|
2471
2744
|
// mergeBySource now lives in lib/merge-sources.js (extracted to be unit-testable,
|