vigievuln 1.3.2 → 1.4.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.
Files changed (375) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +34 -19
  3. package/completions/vigievuln.bash +14 -3
  4. package/completions/vigievuln.zsh +11 -8
  5. package/data/fingerprints/index.js +80 -0
  6. package/data/fingerprints/interpreters/javascript/bun.json +23 -0
  7. package/data/fingerprints/interpreters/javascript/deno.json +10 -0
  8. package/data/fingerprints/interpreters/javascript/electron.json +20 -0
  9. package/data/fingerprints/interpreters/javascript/gjs.json +8 -0
  10. package/data/fingerprints/interpreters/javascript/javascriptcore.json +14 -0
  11. package/data/fingerprints/interpreters/javascript/jscgtk.json +10 -0
  12. package/data/fingerprints/interpreters/javascript/node.json +26 -0
  13. package/data/fingerprints/interpreters/javascript/nwjs.json +8 -0
  14. package/data/fingerprints/interpreters/javascript/webkitgtk.json +10 -0
  15. package/data/fingerprints/interpreters/javascript/wpewebkit.json +10 -0
  16. package/data/fingerprints/interpreters/languages/dotnet.json +8 -0
  17. package/data/fingerprints/interpreters/languages/erlang.json +9 -0
  18. package/data/fingerprints/interpreters/languages/gawk.json +10 -0
  19. package/data/fingerprints/interpreters/languages/guile.json +9 -0
  20. package/data/fingerprints/interpreters/languages/java.json +8 -0
  21. package/data/fingerprints/interpreters/languages/julia.json +9 -0
  22. package/data/fingerprints/interpreters/languages/lua.json +11 -0
  23. package/data/fingerprints/interpreters/languages/luajit.json +10 -0
  24. package/data/fingerprints/interpreters/languages/perl.json +11 -0
  25. package/data/fingerprints/interpreters/languages/php.json +22 -0
  26. package/data/fingerprints/interpreters/languages/powershell.json +17 -0
  27. package/data/fingerprints/interpreters/languages/pypy.json +8 -0
  28. package/data/fingerprints/interpreters/languages/python.json +24 -0
  29. package/data/fingerprints/interpreters/languages/r.json +9 -0
  30. package/data/fingerprints/interpreters/languages/racket.json +9 -0
  31. package/data/fingerprints/interpreters/languages/raku.json +8 -0
  32. package/data/fingerprints/interpreters/languages/ruby.json +21 -0
  33. package/data/fingerprints/interpreters/languages/tcl.json +9 -0
  34. package/data/fingerprints/interpreters/shells/bash.json +10 -0
  35. package/data/fingerprints/interpreters/shells/dash.json +8 -0
  36. package/data/fingerprints/interpreters/shells/fish.json +9 -0
  37. package/data/fingerprints/interpreters/shells/ksh.json +8 -0
  38. package/data/fingerprints/interpreters/shells/zsh.json +9 -0
  39. package/data/fingerprints/services/databases/clickhouse.json +8 -0
  40. package/data/fingerprints/services/databases/elasticsearch.json +8 -0
  41. package/data/fingerprints/services/databases/etcd.json +9 -0
  42. package/data/fingerprints/services/databases/mariadb.json +9 -0
  43. package/data/fingerprints/services/databases/memcached.json +9 -0
  44. package/data/fingerprints/services/databases/mongo.json +8 -0
  45. package/data/fingerprints/services/databases/mysql.json +9 -0
  46. package/data/fingerprints/services/databases/opensearch.json +8 -0
  47. package/data/fingerprints/services/databases/postgres.json +18 -0
  48. package/data/fingerprints/services/databases/redis.json +9 -0
  49. package/data/fingerprints/services/databases/valkey.json +8 -0
  50. package/data/fingerprints/services/dns-directory/bind.json +8 -0
  51. package/data/fingerprints/services/dns-directory/dnsmasq.json +8 -0
  52. package/data/fingerprints/services/dns-directory/slapd.json +8 -0
  53. package/data/fingerprints/services/dns-directory/unbound.json +8 -0
  54. package/data/fingerprints/services/mail/cyrus.json +8 -0
  55. package/data/fingerprints/services/mail/dovecot.json +8 -0
  56. package/data/fingerprints/services/mail/exim.json +9 -0
  57. package/data/fingerprints/services/mail/opendkim.json +8 -0
  58. package/data/fingerprints/services/mail/opensmtpd.json +8 -0
  59. package/data/fingerprints/services/mail/postfix.json +8 -0
  60. package/data/fingerprints/services/mail/rspamd.json +8 -0
  61. package/data/fingerprints/services/mail/sendmail.json +8 -0
  62. package/data/fingerprints/services/messaging/kafka.json +8 -0
  63. package/data/fingerprints/services/messaging/mosquitto.json +8 -0
  64. package/data/fingerprints/services/messaging/nats.json +9 -0
  65. package/data/fingerprints/services/messaging/rabbitmq.json +8 -0
  66. package/data/fingerprints/services/remote-access/dropbear.json +8 -0
  67. package/data/fingerprints/services/remote-access/openssh.json +10 -0
  68. package/data/fingerprints/services/remote-access/proftpd.json +8 -0
  69. package/data/fingerprints/services/remote-access/samba.json +8 -0
  70. package/data/fingerprints/services/remote-access/vsftpd.json +8 -0
  71. package/data/fingerprints/services/web-proxies/apache.json +18 -0
  72. package/data/fingerprints/services/web-proxies/caddy.json +9 -0
  73. package/data/fingerprints/services/web-proxies/envoy.json +8 -0
  74. package/data/fingerprints/services/web-proxies/haproxy.json +10 -0
  75. package/data/fingerprints/services/web-proxies/lighttpd.json +8 -0
  76. package/data/fingerprints/services/web-proxies/nginx.json +14 -0
  77. package/data/fingerprints/services/web-proxies/squid.json +8 -0
  78. package/data/fingerprints/services/web-proxies/tomcat.json +8 -0
  79. package/data/fingerprints/services/web-proxies/traefik.json +9 -0
  80. package/data/fingerprints/services/web-proxies/varnish.json +8 -0
  81. package/lib/README.md +51 -0
  82. package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
  83. package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
  84. package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
  85. package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
  86. package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
  87. package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
  88. package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
  89. package/lib/{native-advisories.js → advisories/native.js} +15 -13
  90. package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
  91. package/lib/{advisory-store.js → advisories/store.js} +2 -2
  92. package/lib/{application-exports.js → applications/exports.js} +1 -1
  93. package/lib/{application-inventory.js → applications/inventory.js} +3 -1
  94. package/lib/applications/layout.js +199 -0
  95. package/lib/{application-providers → applications}/live-snapshot.js +10 -10
  96. package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
  97. package/lib/applications/plugins/ghost.js +36 -0
  98. package/lib/{application-plugins → applications/plugins}/index.js +1 -1
  99. package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
  100. package/lib/applications/plugins/redmine.js +24 -0
  101. package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
  102. package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
  103. package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
  104. package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
  105. package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
  106. package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
  107. package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
  108. package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
  109. package/lib/artifacts/access-warnings.js +24 -0
  110. package/lib/artifacts/applications.js +39 -8
  111. package/lib/artifacts/component-scope.js +12 -3
  112. package/lib/artifacts/cve-view.js +8 -5
  113. package/lib/artifacts/disk-wasm.mjs +3 -0
  114. package/lib/artifacts/disk.js +188 -0
  115. package/lib/artifacts/elf-product.js +215 -0
  116. package/lib/artifacts/enrichment.js +31 -17
  117. package/lib/artifacts/go-main-identity.js +135 -36
  118. package/lib/artifacts/go-publisher-advisories.js +4 -3
  119. package/lib/artifacts/image-products.js +181 -0
  120. package/lib/artifacts/index.js +36 -13
  121. package/lib/artifacts/install-version.js +44 -0
  122. package/lib/artifacts/inventory-scope.js +53 -3
  123. package/lib/artifacts/pe-product.js +28 -0
  124. package/lib/artifacts/product-advisories.js +212 -0
  125. package/lib/artifacts/product-catalog.js +67 -0
  126. package/lib/artifacts/release-catalogues.js +149 -0
  127. package/lib/artifacts/release-versions.js +101 -0
  128. package/lib/artifacts/remediation-report.js +1 -1
  129. package/lib/artifacts/report-inventory.js +17 -2
  130. package/lib/artifacts/report-path.js +29 -0
  131. package/lib/artifacts/report.js +85 -32
  132. package/lib/artifacts/retire.js +3 -3
  133. package/lib/artifacts/risk-report.js +12 -8
  134. package/lib/artifacts/sbom.js +33 -4
  135. package/lib/artifacts/scan.js +316 -69
  136. package/lib/artifacts/system-apps.js +98 -0
  137. package/lib/artifacts/system-maintenance.js +101 -0
  138. package/lib/artifacts/system-module-updates.js +104 -0
  139. package/lib/artifacts/system-report.js +232 -0
  140. package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
  141. package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
  142. package/lib/{cache-db.js → cache/db.js} +1 -1
  143. package/lib/{dump-format.js → cache/dump-format.js} +2 -2
  144. package/lib/{json-cache.js → cache/json.js} +1 -1
  145. package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
  146. package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
  147. package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
  148. package/lib/{cache-repository.js → cache/repository.js} +1 -1
  149. package/lib/{resource-cache → cache/resource}/engine.js +23 -16
  150. package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
  151. package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
  152. package/lib/{resource-cache → cache/resource}/validate.js +20 -5
  153. package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
  154. package/lib/certs/scan.js +17 -11
  155. package/lib/cli-collect.js +262 -0
  156. package/lib/cli-command-routing.js +30 -13
  157. package/lib/cli-groups.js +1 -1
  158. package/lib/cli-image.js +158 -47
  159. package/lib/cli-project-commands.js +10 -10
  160. package/lib/cli-setup.js +8 -8
  161. package/lib/cli-watch.js +3 -3
  162. package/lib/codecs/binary/elf-metadata.js +6 -0
  163. package/lib/codecs/binary/metadata.js +1 -1
  164. package/lib/codecs/binary/pe-metadata.js +47 -11
  165. package/lib/codecs/binary/scan.js +12 -4
  166. package/lib/codecs/binary.codec.js +1 -1
  167. package/lib/codecs/composer/platform.js +2 -2
  168. package/lib/codecs/composer/registry.js +12 -18
  169. package/lib/codecs/composer.codec.js +6 -5
  170. package/lib/codecs/go/parse.js +1 -1
  171. package/lib/codecs/go/registry.js +7 -7
  172. package/lib/codecs/go.codec.js +2 -2
  173. package/lib/codecs/gradle/parse.js +1 -1
  174. package/lib/codecs/gradle/versionless.js +2 -2
  175. package/lib/codecs/gradle.codec.js +7 -7
  176. package/lib/codecs/index.js +1 -1
  177. package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
  178. package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
  179. package/lib/codecs/maven/jar-scan.js +4 -4
  180. package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
  181. package/lib/{core.js → codecs/maven/pom.js} +22 -11
  182. package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
  183. package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
  184. package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
  185. package/lib/codecs/maven.codec.js +18 -14
  186. package/lib/codecs/npm/collect.js +55 -8
  187. package/lib/codecs/npm/manifest-kind.js +16 -0
  188. package/lib/codecs/npm/parse.js +23 -7
  189. package/lib/codecs/npm/registry.js +28 -14
  190. package/lib/codecs/npm.codec.js +5 -5
  191. package/lib/codecs/nuget/registry.js +7 -7
  192. package/lib/codecs/nuget.codec.js +4 -4
  193. package/lib/codecs/pypi/registry.js +7 -7
  194. package/lib/codecs/pypi.codec.js +4 -4
  195. package/lib/codecs/recipes.js +2 -2
  196. package/lib/codecs/ruby/registry.js +7 -7
  197. package/lib/codecs/ruby.codec.js +2 -2
  198. package/lib/config.js +1 -1
  199. package/lib/{attribution.js → findings/attribution.js} +3 -3
  200. package/lib/findings/cve-descriptions.js +144 -0
  201. package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
  202. package/lib/{diff.js → findings/diff.js} +0 -0
  203. package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
  204. package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
  205. package/lib/{gate.js → findings/gate.js} +1 -1
  206. package/lib/{malware.js → findings/malware.js} +30 -7
  207. package/lib/{merge-sources.js → findings/merge.js} +57 -9
  208. package/lib/{priority.js → findings/priority.js} +3 -3
  209. package/lib/findings/risk-evidence.js +24 -0
  210. package/lib/findings/severity.js +16 -0
  211. package/lib/{finding-summary.js → findings/summary.js} +5 -2
  212. package/lib/{suppress.js → findings/suppress.js} +2 -2
  213. package/lib/images/local-docker.js +72 -0
  214. package/lib/{image-network.js → images/network.js} +26 -16
  215. package/lib/{image-references.js → images/references.js} +29 -11
  216. package/lib/{image-registry.js → images/registry.js} +18 -9
  217. package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
  218. package/lib/images/temp-roots.js +23 -0
  219. package/lib/{image-update.js → images/update.js} +3 -3
  220. package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
  221. package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
  222. package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
  223. package/lib/{embedded.js → inventory/embedded.js} +4 -3
  224. package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
  225. package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
  226. package/lib/{module-names.js → inventory/module-names.js} +1 -1
  227. package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
  228. package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
  229. package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
  230. package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
  231. package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
  232. package/lib/{purl.js → inventory/purl.js} +2 -2
  233. package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
  234. package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
  235. package/lib/{outdated.js → maintenance/outdated.js} +20 -20
  236. package/lib/options-env.js +1 -1
  237. package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
  238. package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
  239. package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
  240. package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
  241. package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
  242. package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
  243. package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
  244. package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
  245. package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
  246. package/lib/providers/{debian.js → debian/index.js} +1 -0
  247. package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
  248. package/lib/providers/{drupal.js → drupal/index.js} +4 -0
  249. package/lib/providers/{eol.js → eol/index.js} +1 -1
  250. package/lib/{epss.js → providers/epss/enrich.js} +16 -13
  251. package/lib/providers/{epss.js → epss/index.js} +2 -2
  252. package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
  253. package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
  254. package/lib/providers/{freexian.js → freexian/index.js} +3 -3
  255. package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
  256. package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
  257. package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
  258. package/lib/{gcve.js → providers/gcve/id.js} +1 -1
  259. package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
  260. package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
  261. package/lib/providers/{github.js → github/index.js} +3 -1
  262. package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
  263. package/lib/providers/{go.js → go/index.js} +1 -1
  264. package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
  265. package/lib/providers/{hashid.js → hashid/index.js} +1 -1
  266. package/lib/providers/index.js +18 -13
  267. package/lib/{kev.js → providers/kev/enrich.js} +12 -9
  268. package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
  269. package/lib/providers/{maven.js → maven/index.js} +5 -3
  270. package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
  271. package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
  272. package/lib/providers/mit-kerberos/index.js +6 -0
  273. package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
  274. package/lib/providers/{npm.js → npm/index.js} +1 -1
  275. package/lib/providers/{nuget.js → nuget/index.js} +1 -1
  276. package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
  277. package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
  278. package/lib/providers/{nvd.js → nvd/index.js} +18 -4
  279. package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
  280. package/lib/{osv-db.js → providers/osv/db.js} +18 -16
  281. package/lib/providers/{osv.js → osv/index.js} +1 -1
  282. package/lib/{osv.js → providers/osv/query.js} +150 -80
  283. package/lib/providers/package-releases/index.js +26 -0
  284. package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
  285. package/lib/providers/{packagist.js → packagist/index.js} +1 -1
  286. package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
  287. package/lib/providers/{pypi.js → pypi/index.js} +1 -1
  288. package/lib/providers/redhat/bzip2.js +167 -0
  289. package/lib/providers/redhat/errata.js +75 -0
  290. package/lib/providers/redhat/index.js +10 -0
  291. package/lib/providers/redhat/oval.js +70 -0
  292. package/lib/providers/redhat/unfixed.js +127 -0
  293. package/lib/{registries.js → providers/registries.js} +4 -4
  294. package/lib/{retire.js → providers/retire/scan.js} +18 -18
  295. package/lib/providers/{ruby.js → ruby/index.js} +1 -1
  296. package/lib/providers/rubysec/advisories.js +177 -0
  297. package/lib/providers/rubysec/index.js +9 -0
  298. package/lib/{snyk.js → providers/snyk/client.js} +2 -2
  299. package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
  300. package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
  301. package/lib/providers/wolfi/index.js +10 -0
  302. package/lib/providers/wolfi/secdb.js +47 -0
  303. package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
  304. package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
  305. package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
  306. package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
  307. package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
  308. package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
  309. package/lib/providers/wpvulnerability/assess.js +181 -0
  310. package/lib/providers/wpvulnerability/index.js +12 -0
  311. package/lib/{charts.js → reports/charts.js} +25 -18
  312. package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
  313. package/lib/{cve-report.js → reports/cve-report.js} +453 -228
  314. package/lib/reports/detail.js +55 -0
  315. package/lib/{i18n.js → reports/i18n.js} +38 -2
  316. package/lib/{report-integrity.js → reports/integrity.js} +1 -1
  317. package/lib/{json-export.js → reports/json-export.js} +95 -24
  318. package/lib/{report-notices.js → reports/notices.js} +11 -6
  319. package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
  320. package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
  321. package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
  322. package/lib/scan/coverage.js +114 -0
  323. package/lib/{provenance.js → scan/provenance.js} +12 -5
  324. package/lib/scan/reliability.js +157 -0
  325. package/lib/{source-health.js → scan/source-health.js} +52 -20
  326. package/lib/{source-profile.js → scan/source-profile.js} +3 -3
  327. package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
  328. package/lib/{project-client.js → service/project-client.js} +20 -2
  329. package/lib/source-input.js +58 -0
  330. package/lib/system-inventory/advisories.js +89 -16
  331. package/lib/system-inventory/collect.js +33 -10
  332. package/lib/system-inventory/distribution-sources.js +32 -15
  333. package/lib/system-inventory/package-applicability.js +51 -0
  334. package/lib/system-inventory/targeted.js +8 -5
  335. package/lib/ui.js +11 -0
  336. package/package.json +49 -2
  337. package/vigievuln.js +483 -352
  338. package/lib/cache-archive.js +0 -676
  339. package/lib/osv-legacy.js +0 -57
  340. package/lib/risk-evidence.js +0 -18
  341. package/lib/scan-coverage.js +0 -61
  342. /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
  343. /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
  344. /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
  345. /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
  346. /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
  347. /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
  348. /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
  349. /package/lib/{cache-directory.js → cache/directory.js} +0 -0
  350. /package/lib/{cache-policy.js → cache/policy.js} +0 -0
  351. /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
  352. /package/lib/{cache-startup.js → cache/startup.js} +0 -0
  353. /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
  354. /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
  355. /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
  356. /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
  357. /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
  358. /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
  359. /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
  360. /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
  361. /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
  362. /package/lib/providers/{kev.js → kev/index.js} +0 -0
  363. /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
  364. /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
  365. /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
  366. /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
  367. /package/lib/providers/{retire.js → retire/index.js} +0 -0
  368. /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
  369. /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
  370. /package/lib/{report-time.js → reports/time.js} +0 -0
  371. /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
  372. /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
  373. /package/lib/{account-client.js → service/account-client.js} +0 -0
  374. /package/lib/{account-session.js → service/account-session.js} +0 -0
  375. /package/lib/{account-terms.js → service/account-terms.js} +0 -0
package/vigievuln.js CHANGED
@@ -3,24 +3,39 @@
3
3
  * VigieVuln — autonomous dependency auditor — CLI entry point.
4
4
  *
5
5
  * Thin wrapper around lib/* modules. The heavy lifting lives in:
6
- * lib/core.js POM parsing & rewriting
7
- * lib/cve-download.js CVE bulk download + index build
8
- * lib/cve-match.js dependency collection + CVE matching
9
- * lib/cve-report.js HTML / Word report generation
10
- * lib/outdated.js EOL + obsolete + outdated checks
11
- * lib/snyk.js optional Snyk integration
6
+ * lib/codecs/maven/pom.js POM parsing & rewriting
7
+ * lib/providers/cveproject/download.js CVE bulk download + index build
8
+ * lib/advisories/cve-match.js dependency collection + CVE matching
9
+ * lib/reports/cve-report.js HTML / Word report generation
10
+ * lib/maintenance/outdated.js EOL + obsolete + outdated checks
11
+ * lib/providers/snyk/client.js optional Snyk integration
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
+ const originalArgv=process.argv.slice();
16
+ let routedCommand;
17
+ if (process.argv[2] === '__read-system-disk') {
18
+ require('./lib/artifacts/disk').readDisk(process.argv[3], process.argv[4]).catch(error => {
19
+ console.error(error.message); process.exitCode = 2;
20
+ });
21
+ return;
22
+ }
23
+ // Production collection must dispatch before cache migration or configuration loading.
24
+ if (process.argv[2] === "system" && process.argv[3] === "collect" && !process.env.__FAD_RETIRE__) {
25
+ require("./lib/cli-collect").run(process.argv.slice(4)).catch(error => {
26
+ console.error(error.message); process.exitCode = 2;
27
+ });
28
+ return;
29
+ }
30
+ if (!process.env.__FAD_RETIRE__) require('./lib/cache/startup').prepareDirectCache();
16
31
  const { rimraf } = require("rimraf");
17
32
  const chalk = require("chalk");
18
33
  const pLimit = require("p-limit");
19
34
  const { program } = require("commander");
20
35
  const ui = require("./lib/ui");
21
- const { createSourceHealth, guardedFetch, setActiveLedger, setRetryAttempts } = require("./lib/source-health");
36
+ const { createSourceHealth, guardedFetch, setActiveLedger, setRetryAttempts } = require("./lib/scan/source-health");
22
37
 
23
- const core = require("./lib/core");
38
+ const core = require("./lib/codecs/maven/pom");
24
39
 
25
40
  // require() (not fs.readFileSync) so bun --compile statically bundles package.json
26
41
  // into the binary — otherwise the compiled exe tries to read it off disk at runtime
@@ -29,7 +44,7 @@ const pkg = require("./package.json");
29
44
 
30
45
  // -------- compiled-binary retire mode --------
31
46
  // The bun-compiled single binary has no node_modules to spawn the retire CLI from,
32
- // and an air-gapped box has no `retire` on PATH. So lib/retire.js re-execs THIS
47
+ // and an air-gapped box has no `retire` on PATH. So lib/providers/retire/scan.js re-execs THIS
33
48
  // binary with __FAD_RETIRE__ set; here we hand off to the statically-bundled retire
34
49
  // CLI (it self-runs, reading process.argv — bun's argv mirrors node's). The entire
35
50
  // normal CLI body is gated behind `else` so fad's own commander setup never runs in
@@ -41,13 +56,15 @@ if (process.env.__FAD_RETIRE__) {
41
56
 
42
57
  try {
43
58
  const routed = require("./lib/cli-command-routing").routeArguments(process.argv.slice(2));
59
+ routedCommand=routed;
44
60
  if (routed.help) { console.log(routed.help); process.exit(0); }
45
61
  process.argv = [...process.argv.slice(0, 2), ...routed.args];
46
62
  } catch (error) { console.error(`❌ ${error.message}`); process.exit(2); }
47
63
 
48
- if (process.argv[2] === "image") {
64
+ const artifactCommand = "system scan";
65
+ if (process.argv[2] === "system" && process.argv[3] === "scan") {
49
66
  if (!process.env.__FAD_PROXY_REEXEC__) {
50
- const { parseProxyFlag, runtimeSupportsEnvProxy, reexecWithProxy } = require('./lib/proxy-cache');
67
+ const { parseProxyFlag, runtimeSupportsEnvProxy, reexecWithProxy } = require('./lib/cache/proxy-cache');
51
68
  const corpProxy = parseProxyFlag();
52
69
  if (corpProxy) {
53
70
  if (!/^https?:\/\//i.test(corpProxy)) { console.error('❌ --proxy expects an http(s) URL'); process.exit(2); }
@@ -55,16 +72,16 @@ if (process.argv[2] === "image") {
55
72
  const i=process.argv.indexOf('--proxy-cache');
56
73
  let proxyCache=i>=0?process.argv[i+1]:null;
57
74
  if(!proxyCache) {
58
- const command=require('./lib/cli-image').makeCommand();command.exitOverride().configureOutput({writeErr(){},writeOut(){}});
59
- try{command.parse(process.argv.slice(3),{from:'user'});const layers=require('./lib/options-env').loadLayers({configPath:command.opts().config,program:command});proxyCache=require('./lib/options-env').applyLayers(command,layers,require('./lib/config').load()).proxyCache;}catch{}
75
+ const command=require('./lib/cli-image').makeCommand(artifactCommand);command.exitOverride().configureOutput({writeErr(){},writeOut(){}});
76
+ try{command.parse(process.argv.slice(4),{from:'user'});const layers=require('./lib/options-env').loadLayers({configPath:command.opts().config,program:command});proxyCache=require('./lib/options-env').applyLayers(command,layers,require('./lib/config').load()).proxyCache;}catch{}
60
77
  }
61
78
  let noProxyHost=null;try{noProxyHost=new URL(proxyCache).hostname}catch{}
62
- reexecWithProxy({proxyUrl:corpProxy,noProxy:noProxyHost});return;
79
+ reexecWithProxy({proxyUrl:corpProxy,noProxy:noProxyHost,argv:originalArgv});return;
63
80
  }
64
81
  }
65
- require("./lib/cli-image").run(process.argv.slice(3)).catch(err => {
82
+ require("./lib/cli-image").run(process.argv.slice(4), {}, artifactCommand).catch(err => {
66
83
  console.error(`❌ ${err.message}`); process.exitCode = 2;
67
- }).finally(() => { require('./lib/cache-db').closeCacheDbs(); });
84
+ }).finally(() => { require('./lib/cache/db').closeCacheDbs(); });
68
85
  } else if (process.argv[2] === "setup") {
69
86
  require("./lib/cli-setup").run(process.argv.slice(3)).catch(err => {
70
87
  console.error(`❌ ${err.message}`); process.exitCode = 2;
@@ -154,7 +171,7 @@ if (process.argv.includes("--show-config")) {
154
171
  }
155
172
 
156
173
  if (process.argv.includes("--list-app-plugins")) {
157
- const { allApplicationPlugins } = require("./lib/application-plugins");
174
+ const { allApplicationPlugins } = require("./lib/applications/plugins");
158
175
  for (const plugin of allApplicationPlugins()) {
159
176
  console.log(`${plugin.id}\t${plugin.version}\tinventory: ${plugin.capabilities.inventory}\tadvisories: ${plugin.capabilities.advisories || "unavailable"}`);
160
177
  }
@@ -169,7 +186,7 @@ if (process.argv.includes("--list-app-plugins")) {
169
186
  // prevents recursion. A --proxy-cache URL given in the same command is added to
170
187
  // NO_PROXY: traffic to the shared cache is local and must not enter the tunnel.
171
188
  if (!process.env.__FAD_PROXY_REEXEC__) {
172
- const { parseProxyFlag, runtimeSupportsEnvProxy, reexecWithProxy } = require("./lib/proxy-cache");
189
+ const { parseProxyFlag, runtimeSupportsEnvProxy, reexecWithProxy } = require("./lib/cache/proxy-cache");
173
190
  const corpProxy = parseProxyFlag();
174
191
  if (corpProxy) {
175
192
  if (!/^https?:\/\//i.test(corpProxy)) {
@@ -183,7 +200,7 @@ if (!process.env.__FAD_PROXY_REEXEC__) {
183
200
  const pcIdx = process.argv.indexOf("--proxy-cache");
184
201
  const pcUrl = pcIdx > -1 && process.argv[pcIdx + 1] && !process.argv[pcIdx + 1].startsWith("-") ? process.argv[pcIdx + 1] : null;
185
202
  if (pcUrl) { try { noProxyHost = new URL(pcUrl).hostname; } catch { /* ignore */ } }
186
- reexecWithProxy({ proxyUrl: corpProxy, noProxy: noProxyHost });
203
+ reexecWithProxy({ proxyUrl: corpProxy, noProxy: noProxyHost, argv:originalArgv });
187
204
  return; // the child owns the run; this process just relays its exit code
188
205
  }
189
206
  }
@@ -191,7 +208,7 @@ if (!process.env.__FAD_PROXY_REEXEC__) {
191
208
  // -------- --add-repo / --remove-repo / --list-repos (run before program.parse) --------
192
209
  if (process.argv.includes("--add-repo") || process.argv.includes("--remove-repo") || process.argv.includes("--list-repos")) {
193
210
  const config = require("./lib/config");
194
- const { SUPPORTED } = require("./lib/registries");
211
+ const { SUPPORTED } = require("./lib/providers/registries");
195
212
  const ecoErr = eco => {
196
213
  if (!SUPPORTED.includes(eco)) {
197
214
  console.error(chalk.red(`❌ unknown ecosystem "${eco}". Supported: ${SUPPORTED.join(", ")}`));
@@ -264,13 +281,13 @@ if (process.argv.includes("--export-cache") || process.argv.includes("--import-c
264
281
  const layersApi = require("./lib/options-env");
265
282
  const layers = layersApi.loadLayers({ configPath: archiveProgram.opts().config, program: archiveProgram });
266
283
  let archiveOptions = layersApi.applyLayers(archiveProgram, layers, require("./lib/config").load());
267
- archiveOptions = { ...archiveOptions, ...require("./lib/hosted-proxy").resolveHostedProxy({ ...archiveOptions, offline: true }) };
268
- archiveOptions = require("./lib/source-profile").applySourceProfile(archiveOptions).options;
269
- const proxyOrigin = archiveOptions.sourceProfile === "proxy" || (archiveOptions.cacheDir && archiveOptions.proxyCache) ? require("./lib/proxy-scope").proxyOrigin(archiveOptions.proxyCache) : null;
284
+ archiveOptions = { ...archiveOptions, ...require("./lib/service/hosted-proxy").resolveHostedProxy({ ...archiveOptions, offline: true }) };
285
+ archiveOptions = require("./lib/scan/source-profile").applySourceProfile(archiveOptions).options;
286
+ const proxyOrigin = archiveOptions.sourceProfile === "proxy" || (archiveOptions.cacheDir && archiveOptions.proxyCache) ? require("./lib/cache/proxy-scope").proxyOrigin(archiveOptions.proxyCache) : null;
270
287
  const customRoot = archiveOptions.cacheDir ? path.resolve(archiveOptions.cacheDir) : null;
271
288
  if (proxyOrigin && customRoot) fs.mkdirSync(customRoot, {recursive:true,mode:0o700});
272
- const cacheDir = proxyOrigin ? require("./lib/proxy-scope").proxyScope(proxyOrigin, customRoot ? {homeDir:customRoot} : {}) : customRoot || require("./lib/cache-directory").getCacheDir();
273
- const { exportCache, importCache } = require("./lib/cache-archive-sqlite");
289
+ const cacheDir = proxyOrigin ? require("./lib/cache/proxy-scope").proxyScope(proxyOrigin, customRoot ? {homeDir:customRoot} : {}) : customRoot || require("./lib/cache/directory").getCacheDir();
290
+ const { exportCache, importCache } = require("./lib/cache/archive");
274
291
  const verbose = process.argv.includes("--verbose");
275
292
  const exportIdx = process.argv.indexOf("--export-cache");
276
293
  const importIdx = process.argv.indexOf("--import-cache");
@@ -280,6 +297,7 @@ if (process.argv.includes("--export-cache") || process.argv.includes("--import-c
280
297
  console.error(chalk.red("❌ --export-cache requires a destination path (e.g. vigievuln-cache.tar.gz)"));
281
298
  process.exit(1);
282
299
  }
300
+ if (process.argv.includes("--include-config")) console.warn(chalk.yellow("⚠ --include-config is ignored: the cache bundle never contains config.json (it holds API keys)."));
283
301
  const { path: out, size, excluded, scope } = await exportCache(dest, { sourceDir: cacheDir, proxyOrigin });
284
302
  const mb = (size / 1024 / 1024).toFixed(2);
285
303
  console.log(chalk.green(`✅ Cache exported (${mb} MB) → ${out}`));
@@ -320,7 +338,7 @@ if (process.argv.includes("--export-cache") || process.argv.includes("--import-c
320
338
  // Standalone differential audit between two findings JSON exports. Mirrors the other
321
339
  // pre-parse intercepts so it never collides with the main option set (which requires -s).
322
340
  if (process.argv[2] === "diff") {
323
- const { diffFindings, summarizeDiff, newProductionCveCount, isProductionCve, validateFindingsDocument, baselineProjectWarning } = require("./lib/diff");
341
+ const { diffFindings, summarizeDiff, newProductionCveCount, isProductionCve, validateFindingsDocument, baselineProjectWarning } = require("./lib/findings/diff");
324
342
  const rest = process.argv.slice(3);
325
343
  const positionals = rest.filter(a => !a.startsWith("-"));
326
344
  const [basePath, curPath] = positionals;
@@ -363,6 +381,10 @@ if (process.argv[2] === "diff") {
363
381
  console.log(chalk.green(`\n✅ diff written → ${jsonOut}`));
364
382
  }
365
383
  console.log();
384
+ if (failOnNew && s.cve.unassessedAddedProduction) {
385
+ console.error("Cannot determine whether all current production findings are new against this baseline.");
386
+ process.exit(2);
387
+ }
366
388
  process.exit(failOnNew && newProd > 0 ? 1 : 0);
367
389
  }
368
390
 
@@ -389,14 +411,14 @@ if (process.argv[2] === "serve-cache") {
389
411
  const upstreamProxy = arg("--upstream-proxy", null);
390
412
  // API keys the SERVER injects upstream, so the instances behind it need none:
391
413
  // flags > env > persisted config. Same wire formats as the scan-side lanes
392
- // (lib/nvd.js `apiKey` header, Wordfence/GitHub `Authorization: Bearer`).
414
+ // (lib/providers/nvd/enrich.js `apiKey` header, Wordfence/GitHub `Authorization: Bearer`).
393
415
  const { getNvdApiKey } = require("./lib/config");
394
416
  const keys = {
395
417
  nvd: arg("--nvd-key", null) || process.env.NVD_API_KEY || getNvdApiKey() || null,
396
418
  wordfence: arg("--wordfence-key", null) || process.env.WORDFENCE_API_KEY || null,
397
419
  github: arg("--github-token", null) || process.env.GITHUB_TOKEN || null,
398
420
  };
399
- const { startProxyCacheServer, DEFAULT_CACHE_DIR, CLIENT_CACHE_DIR, createCacheStore } = require("./lib/proxy-cache");
421
+ const { startProxyCacheServer, DEFAULT_CACHE_DIR, CLIENT_CACHE_DIR, createCacheStore } = require("./lib/cache/proxy-cache");
400
422
  const storeDir = path.resolve(cacheDir || DEFAULT_CACHE_DIR());
401
423
  // The scan's per-pass caches and the shared server base are two different roles:
402
424
  // a store inside ~/.vigie-vuln/ would be bundled/swapped by --export-cache /
@@ -411,7 +433,7 @@ if (process.argv[2] === "serve-cache") {
411
433
  const seedManifest = arg("--seed", null);
412
434
  const trustKey = arg("--trust-key", null);
413
435
  const seeding = !seedManifest ? Promise.resolve() : (async () => {
414
- const { openDump, seedResourceStore, keyFingerprint } = require("./lib/dump-format");
436
+ const { openDump, seedResourceStore, keyFingerprint } = require("./lib/cache/dump-format");
415
437
  const publicKeyPem = trustKey ? fs.readFileSync(trustKey, "utf8") : null;
416
438
  const { manifest, payloadPath } = await openDump(seedManifest, { publicKeyPem });
417
439
  if (!publicKeyPem) console.warn(chalk.yellow("⚠️ --seed without --trust-key: integrity checked (sha256), origin NOT verified"));
@@ -450,7 +472,7 @@ if (process.argv[2] === "serve-cache") {
450
472
  return;
451
473
  }
452
474
 
453
- const USAGE = `scan <dir> [options]
475
+ const USAGE = `scan <path|zip|descriptor.json> [options]
454
476
  vigievuln watch <dir> (--name <name> | --id <id> | --export <file>) [options]
455
477
  vigievuln login | logout | whoami`;
456
478
 
@@ -467,8 +489,7 @@ program
467
489
  .description(require("./lib/cli-command-routing").COMMAND_HELP.trim())
468
490
  .option("-t, --target <target>", "EXTRACTION mode: write the cleaned tree to <dir>; non-empty dir requires --force")
469
491
  // Not a requiredOption: --import-anonymized scans a descriptor with no source tree.
470
- .option("-s, --src <src>", "source directory (legacy alternative to scan <dir>)")
471
- .option("--source <src>", "alias of --src")
492
+ .addOption(new (require("commander").Option)("--src <src>", "internal source argument").hideHelp())
472
493
  .option("--config <file>", "load default options from a trusted JSON file")
473
494
  .option("--source-profile <profile>", "vulnerability service operators: all (default), us, eu or proxy")
474
495
  .option("-d, --disable <list>", "turn features OFF (comma-separated) — see the token list below")
@@ -489,6 +510,7 @@ program
489
510
  .option("--no-all-libs", "skip Maven Central queries (outdated check + missing-on-central check)")
490
511
  .option("--no-osv", "skip OSV.dev (Google/GitHub aggregated Maven CVE feed)")
491
512
  .option("--advisory-query-ttl <hours>", "hours before refreshing advisory consultations (0–8760; default 4; 0 always refreshes)")
513
+ .option("--no-ruby-advisories", "skip the Ruby advisory database lane for RubyGems deps (rubysec/ruby-advisory-db, the data `bundler-audit` reads — advisories OSV does not carry)")
492
514
  .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)")
493
515
  .option("--no-nvd", "skip NIST NVD enrichment of matched CVEs")
494
516
  .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)")
@@ -535,7 +557,7 @@ program
535
557
  .option("--export-cache <file>", "export the SQLite cache as a tar.gz bundle (excludes local configuration)")
536
558
  .option("--import-cache <file>", "merge a previously exported archive into ~/.vigie-vuln/ (keeps the local cache + config.json; newest entry wins)")
537
559
  .option("--replace", "with --import-cache: replace ~/.vigie-vuln/ wholesale instead of merging (previous dir kept as .bak unless --force)")
538
- .option("--include-config", "with --export-cache: also bundle config.json (contains the NVD API key)")
560
+ .option("--include-config", "deprecated, ignored: the cache bundle never contains config.json (it holds API keys)")
539
561
  .option("--export-anonymized <file>", "offline: write a path-free dependency descriptor and exit")
540
562
  .option("--prepare-project <file>", "offline: prepare a path-free project descriptor for review")
541
563
  .option("--import-anonymized <file>", "online, no --src: scan a descriptor to warm the caches")
@@ -591,6 +613,7 @@ program
591
613
  .option("--image-retire", "scan bundled JavaScript in image contents with RetireJS (excludes package stores)", false)
592
614
  .option("--images", "enable image analysis in source-tree scans (off by default)", false)
593
615
  .option("--no-images", "skip image declaration discovery and image analysis in source-tree scans")
616
+ .option("--images-only", "scan only the container images the project declares (Dockerfile, Compose, Kubernetes…), into ./vigievuln-report-images: dependencies, CMS instances, binaries and certificates are left to a scan without this option")
594
617
  .option("--image-platform <os/arch[/variant]>", "image platform when no platform is declared", "linux/amd64")
595
618
  .option("--no-jars", "skip scanning embedded .jar/.war/.ear binaries for Maven coordinates")
596
619
  .option("--no-certs", "skip scanning committed certificates, private/public keys (PEM/SSH/PuTTY/PGP) and keystores")
@@ -609,7 +632,7 @@ program
609
632
  // The -d / -a vocabularies, laid out once under the options instead of wrapped inside two
610
633
  // option descriptions where they cost fifteen lines.
611
634
  program.addHelpText("after", `
612
- -d eol nvd nvd-mirror osv packagist-audit epss kev euvd gcve certfr retire transitive all-libs checksums
635
+ -d eol nvd nvd-mirror osv packagist-audit ruby-advisories epss kev euvd gcve certfr retire transitive all-libs checksums
613
636
  osv-db report vendored-js-inventory default-excludes
614
637
  maven gradle npm yarn nuget composer pypi go ruby js jars binaries certs images
615
638
  -a images licenses eol-support typosquat snyk osv-db nvd-cpe-match cve-refresh
@@ -643,7 +666,7 @@ if (process.argv.includes("--no-licenses")) process.argv = process.argv.filter(a
643
666
  // was scanned, so this must not read as a clean run to a CI job that mis-invoked it.
644
667
  // A lone --verbose is included: verbose modifies a scan, and there is no scan here, so it
645
668
  // would otherwise die on "required option --src" without answering what the user asked.
646
- const BARE_ARGV = process.argv.length <= 2
669
+ const BARE_ARGV = (!routedCommand?.sourceInput && process.argv.length <= 2)
647
670
  || (process.argv.length === 3 && process.argv[2] === "--verbose");
648
671
  if (BARE_ARGV) {
649
672
  ui.banner(pkg.version);
@@ -652,8 +675,8 @@ if (BARE_ARGV) {
652
675
  Maven · Gradle · npm · Yarn · pnpm · Composer · PyPI · NuGet · Go · Ruby — no build tool needed.
653
676
 
654
677
  ${chalk.cyan("vigievuln scan <dir>")} full report: CVE + EOL + obsolete + outdated + licenses
655
- ${chalk.cyan("vigievuln -s <dir> --offline")} air-gapped: warmed cache only, zero network
656
- ${chalk.cyan("vigievuln -s <dir> --fail-on high")} CI gate: exit 1 on a high+ production CVE
678
+ ${chalk.cyan("vigievuln scan <input> --offline")} air-gapped: warmed cache only, zero network
679
+ ${chalk.cyan("vigievuln scan <input> --fail-on high")} CI gate: exit 1 on a high+ production CVE
657
680
  ${chalk.cyan("vigievuln watch <dir> --name <name>")} upload local dependencies for project monitoring
658
681
  ${chalk.cyan("vigievuln watch <dir> --export <file>")} local descriptor only, no login or upload
659
682
  ${chalk.cyan("vigievuln login | logout | whoami")} account session (legacy auth commands still work)
@@ -682,7 +705,7 @@ try {
682
705
  Object.assign(options, applyLayers(program, _layers, require("./lib/config").load()));
683
706
  if (options.prepareOffline) {
684
707
  if (options.importAnonymized || !options.output || options.offline || options.src || options.source) {
685
- console.error(chalk.red('❌ cache prepare requires a descriptor and --output, runs online, and cannot be combined with --src or --import-anonymized.'));
708
+ console.error(chalk.red('❌ cache prepare requires a descriptor and --output, runs online, and cannot be combined with a source path or --import-anonymized.'));
686
709
  process.exit(2);
687
710
  }
688
711
  if (path.resolve(options.prepareOffline) === path.resolve(options.output)) {
@@ -698,7 +721,7 @@ if (options.prepareOffline) {
698
721
  if (options.exportAnonymized || options.prepareProject) options.offline = true;
699
722
  if (!options.offline && /^http:\/\//i.test(String(options.proxyCache || ''))) {
700
723
  try {
701
- const {proxyOrigin,requireHttpConsent,HTTP_WARNING}=require('./lib/proxy-scope');
724
+ const {proxyOrigin,requireHttpConsent,HTTP_WARNING}=require('./lib/cache/proxy-scope');
702
725
  const config=require('./lib/config'), origin=proxyOrigin(options.proxyCache);
703
726
  const allowed=program.getOptionValueSource('allowInsecureHttp') === 'cli' && !!options.allowInsecureHttp;
704
727
  ui.warn(HTTP_WARNING);
@@ -714,10 +737,10 @@ if (!options.offline && /^http:\/\//i.test(String(options.proxyCache || ''))) {
714
737
  let hostedAccountSession = null;
715
738
  if (!options.offline && !options.proxyCacheToken && !process.env.VIGIEVULN_PROXY_CACHE_TOKEN && !process.env.FAD_PROXY_CACHE_TOKEN &&
716
739
  (options.vigievulnProxy || /^(default|vigievuln|https:\/\/api\.vigievuln\.(fr|com)\/?$)$/i.test(String(options.proxyCache || "")))) {
717
- try { hostedAccountSession = require("./lib/account-session").createAccountSessionStore().read(); }
740
+ try { hostedAccountSession = require("./lib/service/account-session").createAccountSessionStore().read(); }
718
741
  catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
719
742
  }
720
- try { Object.assign(options, require("./lib/hosted-proxy").resolveHostedProxy({ ...options, allowProxyLogin: !!hostedAccountSession || !!(process.stdin.isTTY && process.stderr.isTTY) })); }
743
+ try { Object.assign(options, require("./lib/service/hosted-proxy").resolveHostedProxy({ ...options, allowProxyLogin: !!hostedAccountSession || !!(process.stdin.isTTY && process.stderr.isTTY) })); }
721
744
  catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
722
745
  // An explicitly anonymous server must not receive an inherited key from a
723
746
  // different setup. An explicit CLI/environment/file token still takes priority.
@@ -771,14 +794,23 @@ if (options.imagePlatform && (typeof options.imagePlatform !== 'string' || !/^[a
771
794
  console.error(chalk.red('❌ --image-platform must be os/architecture[/variant].'));
772
795
  process.exit(2);
773
796
  }
797
+ // Images of a project can yield far more findings than its dependencies: --images-only keeps
798
+ // them in a report of their own, so a scan without it stays the dependency report.
799
+ if (options.imagesOnly) {
800
+ if (program.getOptionValueSource('images') === 'cli' && options.images === false) { console.error(chalk.red('❌ --images-only cannot be combined with --no-images.')); process.exit(2); }
801
+ if (options.importAnonymized || options.prepareOffline || options.exportAnonymized || options.prepareProject) { console.error(chalk.red('❌ --images-only applies to a source tree scan: vigievuln scan <path> --images-only.')); process.exit(2); }
802
+ options.images = true;
803
+ options.certs = false;
804
+ if (program.getOptionValueSource('reportOutput') !== 'cli') options.reportOutput = "./vigievuln-report-images";
805
+ }
774
806
  options.advisoryQueryTtlMs = options.advisoryQueryTtl === undefined ? 4 * 3600 * 1000 : Number(options.advisoryQueryTtl) * 3600 * 1000;
775
- try { options.maxAdvisoryAgeMs = options.maxAdvisoryAge ? require('./lib/advisory-freshness').parseMaxAge(options.maxAdvisoryAge) : 0; }
807
+ try { options.maxAdvisoryAgeMs = options.maxAdvisoryAge ? require('./lib/advisories/freshness').parseMaxAge(options.maxAdvisoryAge) : 0; }
776
808
  catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
777
809
  if (options.forceUpdate && (options.offline || options.exportAnonymized || options.prepareProject)) {
778
810
  console.error(chalk.red('❌ --force-update requires an online scan or cache preparation.'));
779
811
  process.exit(2);
780
812
  }
781
- require('./lib/cache-policy').setForceUpdate(!!options.forceUpdate);
813
+ require('./lib/cache/policy').setForceUpdate(!!options.forceUpdate);
782
814
  if (options.stableAdvisoryAgeDays !== undefined && (!Number.isSafeInteger(options.stableAdvisoryAgeDays) || options.stableAdvisoryAgeDays < 1 || options.stableAdvisoryAgeDays > 36500)) {
783
815
  console.error(chalk.red('❌ --stable-advisory-age-days must be an integer from 1 to 36500.'));
784
816
  process.exit(2);
@@ -786,14 +818,14 @@ if (options.stableAdvisoryAgeDays !== undefined && (!Number.isSafeInteger(option
786
818
  let profileWarnings = [], profileNotices = [];
787
819
  try {
788
820
  const explicit = name => program.getOptionValueSource(name) === 'cli' || (name === 'osvDb' && String(options.activate || '').split(',').includes('osv-db'));
789
- const result = require('./lib/source-profile').applySourceProfile(options, {explicit});
821
+ const result = require('./lib/scan/source-profile').applySourceProfile(options, {explicit});
790
822
  Object.assign(options, result.options); profileWarnings = result.warnings; profileNotices = result.notices || [];
791
823
  for (const warning of profileWarnings) ui.warn(warning);
792
824
  } catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
793
825
  if (options.sourceProfile === 'proxy') {
794
826
  try {
795
- const scoped = require('./lib/proxy-scope').proxyScope(options.proxyCache);
796
- require('./lib/cache-directory').setActiveCacheDir(scoped);
827
+ const scoped = require('./lib/cache/proxy-scope').proxyScope(options.proxyCache);
828
+ require('./lib/cache/directory').setActiveCacheDir(scoped);
797
829
  } catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
798
830
  }
799
831
  const deps2Exclude = options.exclude ? new RegExp(options.exclude) : null;
@@ -809,27 +841,28 @@ const sourceHealth = createSourceHealth();
809
841
  // their configured proxy route. Never send a VigieVuln proxy token to a registry.
810
842
  const registryFetch = globalThis.fetch;
811
843
  const officialAccountFetch = options.sourceProfile === 'proxy' && options.vigievulnProxy && !options.offline
812
- ? require('./lib/source-profile').officialAccountFetch(globalThis.fetch) : null;
844
+ ? require('./lib/scan/source-profile').officialAccountFetch(globalThis.fetch) : null;
813
845
  try { setRetryAttempts(options.retries == null ? 5 : options.retries); }
814
846
  catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exit(2); }
815
847
  if (!options.offline) {
816
848
  // The mirror/registry rotations report their own exhaustion (their requests bypass the
817
849
  // guard: they carry their own AbortSignal and failover).
818
850
  setActiveLedger(sourceHealth);
851
+ const onRetry = require('./lib/scan/source-health').displaySourceRetry;
819
852
  const baseFetch = options.sourceProfile === 'proxy'
820
- ? require('./lib/source-profile').proxyOnlyFetch(globalThis.fetch, options.proxyCache)
853
+ ? require('./lib/scan/source-profile').proxyOnlyFetch(globalThis.fetch, options.proxyCache)
821
854
  : globalThis.fetch;
822
855
  // Public data clients call getResource(provider, type, params); configure its
823
856
  // transport once, before any lookup. Custom registry URLs stay direct.
824
857
  if (options.proxyCache) {
825
858
  const { configureResourceRoute } = require("./lib/providers");
826
- const { createCacheStore } = require("./lib/proxy-cache");
859
+ const { createCacheStore } = require("./lib/cache/proxy-cache");
827
860
  try {
828
861
  configureResourceRoute({ proxyUrl: options.proxyCache, hosted: !!options.vigievulnProxy, resetRateLimit:true, proxyRateLimitMaxWaitMs:options.proxyRateLimitWaitMs,
829
862
  token: options.proxyCacheToken || (process.env.VIGIEVULN_PROXY_CACHE_TOKEN ?? process.env.FAD_PROXY_CACHE_TOKEN) || null,
830
- health: sourceHealth, fetcher: baseFetch,
831
- store: options.vigievulnProxy ? null : createCacheStore(require("node:path").join(require("./lib/cache-directory").getCacheDir(), "resource-cache")),
832
- 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 });
863
+ health: sourceHealth, fetcher: baseFetch, onRetry,
864
+ store: options.vigievulnProxy ? null : createCacheStore(require("node:path").join(require("./lib/cache/directory").getCacheDir(), "resource-cache")),
865
+ 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 });
833
866
  } catch (err) {
834
867
  console.error(chalk.red(`❌ ${err.message}`));
835
868
  process.exit(2);
@@ -839,19 +872,18 @@ if (!options.offline) {
839
872
  globalThis.fetch = guardedFetch({
840
873
  health: sourceHealth,
841
874
  fetch: baseFetch,
842
- onRetry: r => ui.interject(` ${chalk.yellow("⚠")} ${r.label} ${chalk.dim(`— ${r.code}, attempt ${r.attempt}/${r.of}, retrying in ${Math.round(r.delayMs / 1000)}s`)}`),
875
+ onRetry,
843
876
  });
844
877
  } else if (options.proxyCache) {
845
878
  console.warn(chalk.yellow("⚠️ --proxy-cache ignored (--offline makes no requests at all)"));
846
879
  }
847
880
  /**
848
- * Provider outages are coverage warnings by default. Write the partial reports before
849
- * evaluating an explicitly requested --fail-on-incomplete gate.
881
+ * The final coverage check decides whether the scan may publish its results.
850
882
  */
851
883
  function warnIfDegraded(handledKeys = []) {
852
884
  const bad = sourceHealth.unreportedOutages(handledKeys);
853
885
  if (!bad.length) return;
854
- ui.warn(`Sources unavailable: ${bad.map(s => s.id).join(", ")}; report coverage is incomplete.`);
886
+ ui.warn(`Sources unavailable: ${bad.map(s => s.id).join(", ")}.`);
855
887
  }
856
888
 
857
889
  // Validate --fail-on early: an unrecognised value (typo like "hgih", wrong case)
@@ -872,7 +904,7 @@ if (options.failOnNew && !options.baseline) {
872
904
  }
873
905
  if (options.baseline) {
874
906
  try {
875
- baselineDoc = require("./lib/diff").validateFindingsDocument(JSON.parse(fs.readFileSync(options.baseline, "utf8")));
907
+ baselineDoc = require("./lib/findings/diff").validateFindingsDocument(JSON.parse(fs.readFileSync(options.baseline, "utf8")));
876
908
  } catch (err) {
877
909
  console.error(chalk.red(`❌ cannot read baseline ${options.baseline}: ${err.message}`));
878
910
  process.exit(2);
@@ -892,11 +924,11 @@ const extractOnly = !readOnly && !scanRequested;
892
924
  // --src is required for every mode except --import-anonymized (which scans a
893
925
  // descriptor and has no source tree).
894
926
  if (!options.src && !options.importAnonymized) {
895
- console.error(chalk.red("❌ required option '-s, --src <src>' not specified"));
927
+ console.error(chalk.red("❌ scan requires an input path, ZIP or descriptor"));
896
928
  process.exit(1);
897
929
  }
898
930
  if (options.src && options.importAnonymized) {
899
- console.warn(chalk.yellow("⚠️ --import-anonymized ignores --src (the descriptor is the source of deps)"));
931
+ console.warn(chalk.yellow("⚠️ the dependency descriptor supplies the scan input"));
900
932
  }
901
933
 
902
934
  function assertSafeExtractionTarget() {
@@ -907,7 +939,7 @@ function assertSafeExtractionTarget() {
907
939
  // and everything beside it).
908
940
  let srcAbs;
909
941
  try { srcAbs = fs.realpathSync(path.resolve(options.src)); }
910
- catch { console.error(chalk.red("❌ --src must be an existing directory")); process.exit(1); }
942
+ catch { console.error(chalk.red("❌ scan input must exist")); process.exit(1); }
911
943
  const targetInput = path.resolve(options.target);
912
944
  const targetStat = fs.lstatSync(targetInput, { throwIfNoEntry: false });
913
945
  if (targetStat && (!targetStat.isDirectory() || targetStat.isSymbolicLink())) {
@@ -926,7 +958,7 @@ function assertSafeExtractionTarget() {
926
958
  const targetInsideSrc = !relFromSrc || (!relFromSrc.startsWith("..") && !path.isAbsolute(relFromSrc));
927
959
  const srcInsideTarget = !relToSrc || (!relToSrc.startsWith("..") && !path.isAbsolute(relToSrc));
928
960
  if (targetInsideSrc || srcInsideTarget) {
929
- console.error(chalk.red("❌ --target must not overlap --src (it cannot be the same as, a subdirectory of, or a parent of --src)"));
961
+ console.error(chalk.red("❌ --target must not overlap the scan input"));
930
962
  process.exit(1);
931
963
  }
932
964
  if (targetStat) {
@@ -940,19 +972,19 @@ assertSafeExtractionTarget();
940
972
 
941
973
  // Shared by source scans and descriptor imports, so the air-gapped warm-up also
942
974
  // refreshes presence. Only per-entry, repository-scoped 404/410 evidence is trusted.
943
- const MAVEN_EXISTS_CACHE_PATH = require("path").join(require("./lib/outdated").CACHE_DIR, "maven-exists-cache.json");
975
+ const MAVEN_EXISTS_CACHE_PATH = require("path").join(require("./lib/maintenance/outdated").CACHE_DIR, "maven-exists-cache.json");
944
976
  async function classifyMavenLibs(ids, repos) {
945
- const { loadJsonCache, saveJsonCache } = require("./lib/outdated");
946
- const { MAX_AGE_MS, discardUnverifiedEntries, checkMavenLibExist } = require("./lib/maven-presence");
977
+ const { loadJsonCache, saveJsonCache } = require("./lib/maintenance/outdated");
978
+ const { MAX_AGE_MS, discardUnverifiedEntries, checkMavenLibExist } = require("./lib/providers/maven/presence");
947
979
  const cache = loadJsonCache(MAVEN_EXISTS_CACHE_PATH);
948
980
  const migrated = discardUnverifiedEntries(cache);
949
981
  let probeRepos = repos;
950
982
  if (!options.offline) {
951
- probeRepos = await require("./lib/maven-repo").reachableRepos(repos, { timeoutMs: 5000 });
983
+ probeRepos = await require("./lib/providers/maven/repo").reachableRepos(repos, { timeoutMs: 5000 });
952
984
  if (!probeRepos.length) ui.warn("no Maven repository reachable — existence check skipped, cache reused; pass --offline on an air-gapped box");
953
985
  }
954
986
  const noNetwork = options.offline || !probeRepos.length;
955
- const fresh = cache.meta?.fetchedAt && require('./lib/cache-policy').fresh(cache.meta.fetchedAt, MAX_AGE_MS);
987
+ const fresh = cache.meta?.fetchedAt && require('./lib/cache/policy').fresh(cache.meta.fetchedAt, MAX_AGE_MS);
956
988
  const previous = !fresh && !noNetwork ? {entries:cache.entries,fetchedAt:cache.meta?.fetchedAt} : null;
957
989
  if (!fresh && !noNetwork) cache.entries = {};
958
990
  const limit = pLimit(10);
@@ -961,7 +993,7 @@ async function classifyMavenLibs(ids, repos) {
961
993
  return { id, found: await checkMavenLibExist(g, a, probeRepos, cache, { offline: noNetwork, configuredRepos: repos }) };
962
994
  })));
963
995
  if (!noNetwork) cache.meta = { fetchedAt: Date.now() };
964
- if (!noNetwork) require('./lib/cache-policy').preserveEntries(cache,previous);
996
+ if (!noNetwork) require('./lib/cache/policy').preserveEntries(cache,previous);
965
997
  if (!noNetwork || migrated) saveJsonCache(MAVEN_EXISTS_CACHE_PATH, cache);
966
998
  const absent = results.filter(r => r.found === false).map(r => r.id);
967
999
  const unknown = results.filter(r => r.found === null).length;
@@ -1028,7 +1060,9 @@ async function timedPhase(label, fn) {
1028
1060
  }
1029
1061
  }
1030
1062
 
1063
+ let preparedSource;
1031
1064
  (async function main() {
1065
+ if(options.src){preparedSource=await require("./lib/source-input").prepareSource(options.src);options.src=preparedSource.root;assertSafeExtractionTarget();}
1032
1066
  if (options.vigievulnProxy && !options.offline) {
1033
1067
  if (!options.proxyCacheToken) {
1034
1068
  try {
@@ -1041,10 +1075,10 @@ async function timedPhase(label, fn) {
1041
1075
  rl.question("", answer => { rl.close(); if (secret) process.stderr.write("\n"); resolve(answer); });
1042
1076
  });
1043
1077
  if (hostedAccountSession) {
1044
- const account = require("./lib/account-client").createAccountClient(officialAccountFetch ? {fetcher:officialAccountFetch} : {});
1078
+ const account = require("./lib/service/account-client").createAccountClient(officialAccountFetch ? {fetcher:officialAccountFetch} : {});
1045
1079
  const current = await account.me();
1046
- await require("./lib/account-terms").requireTerms({account, terms:current.terms, ask});
1047
- options.proxyCacheToken = await require("./lib/hosted-proxy").createProxyKey(account);
1080
+ await require("./lib/service/account-terms").requireTerms({account, terms:current.terms, ask});
1081
+ options.proxyCacheToken = await require("./lib/service/hosted-proxy").createProxyKey(account);
1048
1082
  require("./lib/config").set("proxyCacheToken", options.proxyCacheToken);
1049
1083
  require("./lib/config").set("proxyCacheTokenOrigin", null);
1050
1084
  require("./lib/providers").configureResourceRoute({proxyUrl:options.proxyCache,token:options.proxyCacheToken});
@@ -1054,7 +1088,7 @@ async function timedPhase(label, fn) {
1054
1088
  console.error("No account? Register at https://www.vigievuln.fr/account");
1055
1089
  const email = await ask("Email: ");
1056
1090
  const password = await ask("Password: ", true);
1057
- options.proxyCacheToken = await require("./lib/hosted-proxy").loginForProxy({email,password,ask,...(officialAccountFetch ? {fetcher:officialAccountFetch} : {})});
1091
+ options.proxyCacheToken = await require("./lib/service/hosted-proxy").loginForProxy({email,password,ask,...(officialAccountFetch ? {fetcher:officialAccountFetch} : {})});
1058
1092
  require("./lib/config").set("proxyCacheToken", options.proxyCacheToken);
1059
1093
  require("./lib/config").set("proxyCacheTokenOrigin", null);
1060
1094
  require("./lib/providers").configureResourceRoute({proxyUrl:options.proxyCache,token:options.proxyCacheToken});
@@ -1062,7 +1096,7 @@ async function timedPhase(label, fn) {
1062
1096
  }
1063
1097
  } catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exitCode = 2; return; }
1064
1098
  }
1065
- try { await require("./lib/hosted-proxy").checkHostedProxy(options.proxyCache, options.proxyCacheToken); }
1099
+ try { await require("./lib/service/hosted-proxy").checkHostedProxy(options.proxyCache, options.proxyCacheToken, globalThis.fetch, {waitBudgetMs:options.proxyRateLimitWaitMs}); }
1066
1100
  catch (err) { console.error(chalk.red(`❌ ${err.message}`)); process.exitCode = 2; return; }
1067
1101
  }
1068
1102
  ui.banner(pkg.version);
@@ -1071,8 +1105,8 @@ async function timedPhase(label, fn) {
1071
1105
  // + ad-hoc --repo URLs + Maven Central as final fallback. Used by transitive
1072
1106
  // resolution, outdated-version check, and existence check.
1073
1107
  const { getRegistryMap } = require("./lib/config");
1074
- const { buildRepoList } = require("./lib/maven-repo");
1075
- const { buildRegistryList } = require("./lib/registries");
1108
+ const { buildRepoList } = require("./lib/providers/maven/repo");
1109
+ const { buildRegistryList } = require("./lib/providers/registries");
1076
1110
  // One-off --repo eco=url (from the CLI and the env layer), grouped by ecosystem.
1077
1111
  const cliRepoMap = {};
1078
1112
  for (const spec of [...(options.repo || []), ...(_layers.envRepos || [])]) {
@@ -1114,6 +1148,7 @@ async function timedPhase(label, fn) {
1114
1148
  if (excludePath.length) ui.kv("exclude-path", chalk.white(excludePath.join(chalk.dim(", "))));
1115
1149
  if (!defaultExcludes) ui.kv("default-excludes", chalk.yellow("off (walking node_modules/vendor/.git/…)"));
1116
1150
  ui.kv("mode", chalk.white(runMode));
1151
+ if (options.imagesOnly) ui.kv("scope", chalk.white("container images only") + chalk.dim(" — dependencies are scanned without --images-only"));
1117
1152
  if (options.proxyCache && !options.offline) {
1118
1153
  let proxyDisplay = 'configured';
1119
1154
  try { const url = new URL(options.proxyCache); url.username = ''; url.password = ''; url.search = ''; url.hash = ''; proxyDisplay = url.toString(); } catch { /* do not print malformed credentials */ }
@@ -1126,7 +1161,7 @@ async function timedPhase(label, fn) {
1126
1161
  // Scans the descriptor's public coordinates online to WARM the coordinate-keyed
1127
1162
  // caches (OSV/NVD/CVE/registry/EOL) + retire signatures. Pair with --export-cache.
1128
1163
  if (options.importAnonymized) {
1129
- const { deserializeDeps } = require("./lib/deps-descriptor");
1164
+ const { deserializeDeps } = require("./lib/inventory/deps-descriptor");
1130
1165
  let descriptor;
1131
1166
  try { descriptor = JSON.parse(fs.readFileSync(options.importAnonymized, "utf8")); }
1132
1167
  catch (e) { console.error(chalk.red(`❌ could not read --import-anonymized file: ${e.message}`)); process.exit(1); }
@@ -1141,13 +1176,13 @@ async function timedPhase(label, fn) {
1141
1176
  + (applications.length ? ` · ${chalk.bold(applications.length)} application(s) (${[...new Set(applications.map(a => a.type))].join(", ")})` : ""));
1142
1177
  if (options.offline) ui.warn("--offline: caches won't warm; only useful to re-render from an already-warm cache");
1143
1178
  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.");
1144
- if (!resolved.size && !applications.length && !imageReferences.length) { ui.warn("descriptor has no dependencies or applications — nothing to scan"); process.exit(0); }
1179
+ if (!routedCommand?.descriptorScan && !resolved.size && !applications.length && !imageReferences.length) { ui.warn("descriptor has no dependencies or applications — nothing to scan"); process.exit(0); }
1145
1180
  // Replay the external-parent / import-BOM backfill from the descriptor's carried hints.
1146
1181
  // Workflow B has no source tree here, so the mainline store-based backfill can't run —
1147
1182
  // without this, versionless deps (spring-boot-starter-*) stay unresolved and their CVE
1148
1183
  // caches never warm, forcing a SECOND air-gapped exchange. Online only (needs the POMs).
1149
1184
  if (runMaven && !options.offline && (externalParents.length || importBoms.length)) {
1150
- const { resolveBomManagedVersions, backfillVersions } = require("./lib/maven-bom");
1185
+ const { resolveBomManagedVersions, backfillVersions } = require("./lib/codecs/maven/bom");
1151
1186
  const base = { repos: mavenRepos, offline: options.offline, verbose, effCache: new Map() };
1152
1187
  const mgmt = await resolveBomManagedVersions(importBoms, base);
1153
1188
  const parentMgmt = await resolveBomManagedVersions(externalParents, { ...base, via: "parent", propertyOverrides });
@@ -1157,7 +1192,7 @@ async function timedPhase(label, fn) {
1157
1192
  }
1158
1193
  // Warm retire signatures (online) so --export-cache carries them for offline JS scanning.
1159
1194
  if (runNpm && !options.offline && options.retire !== false) {
1160
- const { warmRetireSignatures } = require("./lib/retire");
1195
+ const { warmRetireSignatures } = require("./lib/providers/retire/scan");
1161
1196
  await warmRetireSignatures({ verbose });
1162
1197
  }
1163
1198
  // Warm the per-publisher CMS advisory snapshots the air-gapped phase 3 consumes
@@ -1166,11 +1201,11 @@ async function timedPhase(label, fn) {
1166
1201
  // feeds, so no source tree is needed. Application identities also justify SPIP
1167
1202
  // and WordPress snapshots; --wordfence-live can use a key held by the proxy.
1168
1203
  if (!options.offline && options.appPlugins !== "none") {
1169
- const { warmCmsAdvisorySnapshots } = require("./lib/cms-snapshot-warm");
1204
+ const { warmCmsAdvisorySnapshots } = require("./lib/applications/snapshot-warm");
1170
1205
  try {
1171
1206
  const warmed = await warmCmsAdvisorySnapshots(resolved, {
1172
1207
  fetchImpl: (...args) => fetch(...args),
1173
- advisoryCacheDir: path.join(require("./lib/cache-directory").getCacheDir(), "advisory-snapshots"),
1208
+ advisoryCacheDir: path.join(require("./lib/cache/directory").getCacheDir(), "advisory-snapshots"),
1174
1209
  drupalUrl: typeof options.drupalAdvisoriesLive === "string" ? options.drupalAdvisoriesLive : undefined,
1175
1210
  prestashopUrl: typeof options.prestashopAdvisoriesLive === "string" ? options.prestashopAdvisoriesLive : undefined,
1176
1211
  typo3Url: typeof options.typo3AdvisoriesLive === "string" ? options.typo3AdvisoriesLive : undefined,
@@ -1188,6 +1223,7 @@ async function timedPhase(label, fn) {
1188
1223
  if (warmed.spip) ui.ok("SPIP advisory snapshot warmed (NVD product CVEs) → advisory-snapshots/ — carried by --export-cache, reused offline");
1189
1224
  for (const version of warmed.wpChecksums) ui.ok(`WordPress checksums reference warmed (${version}) → advisory-snapshots/ — carried by --export-cache, reused offline`);
1190
1225
  if (warmed.wordfence) ui.ok("Wordfence advisories warmed (targeted identities in proxy mode) → advisory-snapshots/ — carried by --export-cache, reused offline without a key");
1226
+ if (warmed.wpvulnerability) ui.ok(`WPVulnerability advisories warmed (${warmed.wpvulnerability} public component queries) → advisory-snapshots/ — reused offline without a key`);
1191
1227
  }
1192
1228
  catch (error) {
1193
1229
  console.error(chalk.red(`❌ CMS advisory snapshot warming failed: ${error.message}`));
@@ -1199,19 +1235,19 @@ async function timedPhase(label, fn) {
1199
1235
  // cache against the real source tree. So suppress the default HTML+JSON output here
1200
1236
  // (still honor an explicit --report-<type> if a user really wants a path-free one).
1201
1237
  const anyReportRequested = [options.reportHtml, options.reportDoc, options.reportXlsx, options.reportSbom, options.reportCsaf, options.reportJson, options.reportSarif].some(v => v !== undefined);
1202
- if (!anyReportRequested) options.report = false;
1238
+ if (!anyReportRequested && !routedCommand?.descriptorScan) options.report = false;
1203
1239
  const privateLibIds = runMaven && options.allLibs
1204
1240
  ? await classifyMavenLibs([...resolved.values()].filter(d => d.ecosystem === "maven")
1205
1241
  .map(d => `${d.namespace || d.groupId}:${d.name || d.artifactId}`), mavenRepos)
1206
1242
  : [];
1207
1243
  const warmedReport = await runReportFlow(resolved, { activeIds, runMaven, runNpm, privateLibIds, mavenRepos, regMap, collectWarnings: [], walkOpts, mavenStore: reactor?.store, mavenPropsByPom: reactor?.propsByPom, imageReferences });
1208
1244
  if (options.prepareOffline && !process.exitCode) {
1209
- const scope=require('./lib/airgap-project').buildProjectScope(resolved,{applications,cves:warmedReport?.cveIds || [],imageReferences:warmedReport?.imageReferences || [],images:options.images});
1210
- const cacheDir=require('./lib/cache-directory').getCacheDir();
1211
- const proxyOrigin=options.sourceProfile==='proxy' ? require('./lib/proxy-scope').proxyOrigin(options.proxyCache) : null;
1245
+ const scope=require('./lib/cache/airgap-project').buildProjectScope(resolved,{applications,cves:warmedReport?.cveIds || [],imageReferences:warmedReport?.imageReferences || [],images:options.images});
1246
+ const cacheDir=require('./lib/cache/directory').getCacheDir();
1247
+ const proxyOrigin=options.sourceProfile==='proxy' ? require('./lib/cache/proxy-scope').proxyOrigin(options.proxyCache) : null;
1212
1248
  if(!scope.packages.length && !scope.imageReferences?.length) ui.warn('no package scope available; exporting the complete local cache');
1213
1249
  try {
1214
- const result=await require('./lib/cache-archive-sqlite').exportCache(options.output,{sourceDir:cacheDir,proxyOrigin,project:(scope.packages.length || scope.imageReferences?.length)?scope:null});
1250
+ const result=await require('./lib/cache/archive').exportCache(options.output,{sourceDir:cacheDir,proxyOrigin,project:(scope.packages.length || scope.imageReferences?.length)?scope:null});
1215
1251
  ui.ok(`offline archive prepared: ${result.path} (${(result.size/1048576).toFixed(2)} MiB; ${scope.packages.length} packages)`);
1216
1252
  } catch(error) {console.error(chalk.red(`❌ could not prepare offline archive: ${error.message}`));process.exitCode=2;}
1217
1253
  }
@@ -1222,17 +1258,18 @@ async function timedPhase(label, fn) {
1222
1258
  const { detectCodecs, allCodecs, getCodec } = require("./lib/codecs");
1223
1259
  const { resolveActiveCodecs } = require("./lib/codecs/select");
1224
1260
  const eco = (options.ecosystem || "auto").toLowerCase();
1225
- const detected = (eco === "auto")
1261
+ const detected = options.imagesOnly ? []
1262
+ : (eco === "auto")
1226
1263
  ? (await timedPhase("detecting ecosystems", () => detectCodecs(options.src, walkOpts))).map(c => c.id)
1227
1264
  : allCodecs().map(c => c.id);
1228
1265
  // The binary scanner is a cross-cutting catch-all (committed native libs in ANY
1229
1266
  // project), and detectCodecs' manifest-glob matcher misses versioned sonames
1230
1267
  // (libz.so.1). Always make it a candidate in auto mode; --no-binaries removes it.
1231
- if (eco === "auto" && !detected.includes("binary")) detected.push("binary");
1268
+ if (eco === "auto" && !options.imagesOnly && !detected.includes("binary")) detected.push("binary");
1232
1269
  const noCodecs = ["maven", "gradle", "npm", "yarn", "nuget", "composer", "pypi", "go", "ruby"].filter(id => options[id] === false);
1233
1270
  // `--no-binaries` maps to options.binaries (plural) but the codec id is `binary`.
1234
1271
  if (options.binaries === false) noCodecs.push("binary");
1235
- const activeIds = resolveActiveCodecs(eco, detected, { noCodecs, noJs: !options.js });
1272
+ const activeIds = options.imagesOnly ? [] : resolveActiveCodecs(eco, detected, { noCodecs, noJs: !options.js });
1236
1273
  const runMaven = activeIds.includes("maven");
1237
1274
  const runGradle = activeIds.includes("gradle");
1238
1275
  const runNpm = activeIds.includes("npm") || activeIds.includes("yarn");
@@ -1252,7 +1289,7 @@ async function timedPhase(label, fn) {
1252
1289
  // no lockfile), which would otherwise be invisible.
1253
1290
  const parsedManifests = [];
1254
1291
  const imageDiscovery = options.images === false ? { references: [], warnings: [] }
1255
- : require('./lib/image-references').discoverImageReferences(options.src, walkOpts);
1292
+ : require('./lib/images/references').discoverImageReferences(options.src, walkOpts);
1256
1293
  for (const ref of imageDiscovery.references) ref.platform ||= options.imagePlatform;
1257
1294
  // Declarations and unresolved CI variables belong to image coverage details.
1258
1295
  // Only actual discovery failures enter the scan diagnostics.
@@ -1318,7 +1355,7 @@ async function timedPhase(label, fn) {
1318
1355
 
1319
1356
  // --- Anonymized phase 1: export a descriptor and exit (no network, no report) ---
1320
1357
  if (options.prepareProject) {
1321
- const descriptor = require("./lib/project-descriptor").buildProjectDescriptor(resolved, {generator:`vigievuln ${pkg.version}`,imageReferences:imageDiscovery.references,images:options.images});
1358
+ const descriptor = require("./lib/inventory/project-descriptor").buildProjectDescriptor(resolved, {generator:`vigievuln ${pkg.version}`,imageReferences:imageDiscovery.references,images:options.images});
1322
1359
  try { fs.writeFileSync(options.prepareProject, JSON.stringify(descriptor, null, 2) + "\n", {mode:0o600}); fs.chmodSync(options.prepareProject,0o600); }
1323
1360
  catch (e) { console.error(chalk.red(`❌ could not write project descriptor: ${e.message}`)); process.exitCode=1; return; }
1324
1361
  const counts = Object.fromEntries(["direct","transitive","unknown"].map(k=>[k,descriptor.deps.filter(d=>d.relation===k).length]));
@@ -1327,8 +1364,8 @@ async function timedPhase(label, fn) {
1327
1364
  return;
1328
1365
  }
1329
1366
  if (options.exportAnonymized) {
1330
- const { serializeDeps } = require("./lib/deps-descriptor");
1331
- const { collectExternalParents, collectImportBoms, collectPropertyOverrides, collectVersionPropertyNames } = require("./lib/maven-bom");
1367
+ const { serializeDeps } = require("./lib/inventory/deps-descriptor");
1368
+ const { collectExternalParents, collectImportBoms, collectPropertyOverrides, collectVersionPropertyNames } = require("./lib/codecs/maven/bom");
1332
1369
  const pkgVersion = require("./package.json").version;
1333
1370
  // Carry the Maven resolution hints so a no-source-tree online warm run (Phase 2) can
1334
1371
  // resolve the versionless deps' versions and warm their CVE caches in ONE exchange.
@@ -1343,8 +1380,8 @@ async function timedPhase(label, fn) {
1343
1380
  let applications = [];
1344
1381
  if (options.appPlugins !== "none") {
1345
1382
  try {
1346
- const { allApplicationPlugins } = require("./lib/application-plugins");
1347
- const { runApplicationPlugins } = require("./lib/application-plugins/runner");
1383
+ const { allApplicationPlugins } = require("./lib/applications/plugins");
1384
+ const { runApplicationPlugins } = require("./lib/applications/plugins/runner");
1348
1385
  const appState = await runApplicationPlugins(options.src, { plugins: allApplicationPlugins(),
1349
1386
  selection: options.appPlugins, resolvedDeps: resolved, activeCodecIds: activeIds, offline: true,
1350
1387
  publicComponents: options.publicComponent, privateComponentPaths: options.privateComponent });
@@ -1353,7 +1390,7 @@ async function timedPhase(label, fn) {
1353
1390
  // Public catalogue identities only — private/custom components never
1354
1391
  // leave the enclave, exactly like the live query that filters them out.
1355
1392
  const components = app.type === "wordpress"
1356
- ? require("./lib/application-providers/wordfence-projection").componentQueries(
1393
+ ? require("./lib/providers/wpvulnerability/assess").publicComponentQueries(
1357
1394
  appState.inventory.filter(c => c.applicationId === app.id)).map(q => `wordpress:${q.type}:${q.slug}`)
1358
1395
  : [...new Set(appState.inventory
1359
1396
  .filter(c => c.applicationId === app.id && c.visibility !== "private"
@@ -1364,7 +1401,7 @@ async function timedPhase(label, fn) {
1364
1401
  } catch { /* the descriptor stays valid without application identities */ }
1365
1402
  }
1366
1403
  let omittedProperties = 0;
1367
- const reactor = mavenCtx?.store && mavenCtx?.propsByPom ? require('./lib/maven-airgap').buildReactorHints(mavenCtx, { exclude: deps2Exclude, versionPropertyNames: collectVersionPropertyNames(mavenCtx.store) }) : null;
1404
+ const reactor = mavenCtx?.store && mavenCtx?.propsByPom ? require('./lib/codecs/maven/airgap').buildReactorHints(mavenCtx, { exclude: deps2Exclude, versionPropertyNames: collectVersionPropertyNames(mavenCtx.store) }) : null;
1368
1405
  const descriptor = serializeDeps(resolved, { generator: `vigievuln ${pkgVersion}`, externalParents, importBoms, reactor,
1369
1406
  imageReferences: imageDiscovery.references, images: options.images,
1370
1407
  propertyOverrides, versionPropertyNames: collectVersionPropertyNames(mavenCtx?.store), applications,
@@ -1383,10 +1420,10 @@ async function timedPhase(label, fn) {
1383
1420
  const srcShown = options.src || "./proj";
1384
1421
  ui.section("Next steps");
1385
1422
  ui.info(`${chalk.dim("Phase 2 —")} ${chalk.cyan("ONLINE")} ${chalk.dim("(any box, no --src): warm the caches, then bundle them")}`);
1386
- ui.info(" " + chalk.white(`vigievuln cache prepare ${descFile} --output fad-cache.tar.gz`));
1423
+ ui.info(" " + chalk.white(`vigievuln cache prepare ${descFile} --output vigievuln-cache.tar.gz`));
1387
1424
  ui.info(`${chalk.dim("Phase 3 —")} ${chalk.cyan("OFFLINE")} ${chalk.dim("(back here): import the cache, then run the full report")}`);
1388
- ui.info(" " + chalk.white("vigievuln --import-cache fad-cache.tar.gz"));
1389
- ui.info(" " + chalk.white(`vigievuln -s ${srcShown} --offline`));
1425
+ ui.info(" " + chalk.white("vigievuln cache import vigievuln-cache.tar.gz"));
1426
+ ui.info(" " + chalk.white(`vigievuln scan ${srcShown} --offline`));
1390
1427
  return;
1391
1428
  }
1392
1429
 
@@ -1415,7 +1452,7 @@ async function timedPhase(label, fn) {
1415
1452
  let copiedManifests = 0;
1416
1453
  if (!readOnly) {
1417
1454
  try {
1418
- const { copyEcosystemManifests } = require("./lib/manifest-copy");
1455
+ const { copyEcosystemManifests } = require("./lib/inventory/manifest-copy");
1419
1456
  const r = await copyEcosystemManifests(options.src, options.target, { excludePath, defaultExcludes });
1420
1457
  copiedManifests = r.copied;
1421
1458
  } catch (err) { console.error(chalk.red(" ✗ manifest copy failed:"), err.message); }
@@ -1439,7 +1476,7 @@ async function timedPhase(label, fn) {
1439
1476
  // cache and backfills its managed versions — so only classify as "likely private"
1440
1477
  // the ones it genuinely can't resolve. effectivePom is cache-first + offline-aware,
1441
1478
  // and warms the cache the BOM/parent backfill reuses later in the report flow.
1442
- const { effectivePom } = require("./lib/transitive");
1479
+ const { effectivePom } = require("./lib/codecs/maven/transitive");
1443
1480
  const resolvable = [], unresolved = [];
1444
1481
  await Promise.all(missingParents.map(async id => {
1445
1482
  const [g, a, v] = id.split(":");
@@ -1506,7 +1543,7 @@ async function timedPhase(label, fn) {
1506
1543
  if (extractOnly) {
1507
1544
  ui.section("Extraction done");
1508
1545
  ui.info(chalk.dim("-t is an extraction step: cleaned tree + POM analysis only, no vulnerability scan."));
1509
- ui.info(chalk.dim("for the vigievuln report: ") + chalk.white(`vigievuln -s ${options.src}`) + chalk.dim(" · or add --snyk / --report-<type> / --fail-on to this command"));
1546
+ ui.info(chalk.dim("for the vigievuln report: ") + chalk.white(`vigievuln scan ${options.src}`) + chalk.dim(" · or add --snyk / --report-<type> / --fail-on to this command"));
1510
1547
  ui.section("Next step");
1511
1548
  ui.info(`run Snyk on the cleaned tree:`);
1512
1549
  console.log(" " + chalk.white(`cd ${options.target} && snyk test --json --all-projects | snyk-to-html -o ../snyk-deps-check.html`));
@@ -1527,20 +1564,20 @@ async function timedPhase(label, fn) {
1527
1564
  console.error(chalk.red(`❌ scan failed: ${err.message || String(err)}`));
1528
1565
  if (verbose && err.stack) console.error(err.stack);
1529
1566
  process.exitCode = 2;
1530
- });
1567
+ }).finally(async()=>{await preparedSource?.cleanup();});
1531
1568
 
1532
1569
  async function runReportFlow(resolved, ecoFlags = {}) {
1533
1570
  if (!options.proxyCache && !options.importAnonymized) {
1534
- const t = require("./lib/i18n").makeT(options.lang);
1571
+ const t = require("./lib/reports/i18n").makeT(options.lang);
1535
1572
  console.error("\n " + chalk.yellow("⚠") + " " + chalk.yellow(t("For faster scans with the VigieVuln DB or a seed → vigievuln setup")));
1536
1573
  }
1537
1574
  const { activeIds = [], runMaven = true, runGradle = false, runNpm = false, privateLibIds = [], mavenRepos = [], regMap = {}, collectWarnings = [], mavenPropsByPom = null, mavenStore = null, gradlePlatformBoms = [], parsedManifests = [], composerPlatforms = [], walkOpts = {} } = ecoFlags;
1538
1575
  const { excludePath = [], defaultExcludes = true } = walkOpts;
1539
1576
  const registriesFor = eco => regMap[eco] || [];
1540
- const { expandWithTransitives } = require("./lib/cve-match");
1541
- const { writeReports, computeStats } = require("./lib/cve-report");
1577
+ const { expandWithTransitives } = require("./lib/advisories/cve-match");
1578
+ const { writeReports, computeStats } = require("./lib/reports/cve-report");
1542
1579
  const { getCodec } = require("./lib/codecs");
1543
- const outdated = require("./lib/outdated");
1580
+ const outdated = require("./lib/maintenance/outdated");
1544
1581
  const { getNvdApiKey } = require("./lib/config");
1545
1582
  const offline = !!options.offline;
1546
1583
 
@@ -1550,6 +1587,11 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1550
1587
  const npmWarnings = collectWarnings || [];
1551
1588
  const scanNotices = [...profileNotices];
1552
1589
  let scanWarnings = profileWarnings.map(message => ({type:'source-unavailable', message}));
1590
+ const reliability = require('./lib/scan/reliability');
1591
+ const discoveryCoverage = reliability.createDiscoveryCoverage();
1592
+ const matchedNativeSources = [];
1593
+ const completeDiscoverySources = [];
1594
+ let reviewedMatched = false;
1553
1595
  const sourceLimitations = [];
1554
1596
  const noteSourceLimitation = (source, message) => {
1555
1597
  if (!sourceLimitations.some(note => note.source === source && note.message === message)) sourceLimitations.push({source,message});
@@ -1558,12 +1600,12 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1558
1600
  const directCount = resolved.size;
1559
1601
  let appState = { applications: [], inventory: [], findings: [], coverage: [], diagnostics: [] };
1560
1602
  let applicationRelations = [];
1561
- if (options.src) {
1603
+ if (options.src && !options.imagesOnly) {
1562
1604
  const wordfenceApiKey = ['us', 'eu'].includes(options.sourceProfile) ? null : (options.wordfenceApiKey || process.env.WORDFENCE_API_KEY || null);
1563
- const { DRUPAL_ADVISORIES_URL, WORDFENCE_PRODUCTION_URL, PRESTASHOP_GITHUB_ADVISORIES_URL, TYPO3_GITHUB_ADVISORIES_URL } = require("./lib/application-providers/live-snapshot");
1605
+ const { DRUPAL_ADVISORIES_URL, WORDFENCE_PRODUCTION_URL, PRESTASHOP_GITHUB_ADVISORIES_URL, TYPO3_GITHUB_ADVISORIES_URL } = require("./lib/applications/live-snapshot");
1564
1606
  const wordfenceLiveUrl = options.wordfenceFeedUrl || ((options.wordfenceLive || wordfenceApiKey) && !options.wordfenceFeed ? WORDFENCE_PRODUCTION_URL : null);
1565
1607
  const spipLiveUrl = options.spipAdvisoriesLive
1566
- ? (options.spipAdvisoriesLive === true ? require("./lib/application-providers/spip-advisories").SPIP_ADVISORIES_URL : options.spipAdvisoriesLive) : null;
1608
+ ? (options.spipAdvisoriesLive === true ? require("./lib/providers/spip/advisories").SPIP_ADVISORIES_URL : options.spipAdvisoriesLive) : null;
1567
1609
  if (offline && (wordfenceLiveUrl || options.drupalAdvisoriesLive || options.prestashopAdvisoriesLive || options.typo3AdvisoriesLive || options.wpChecksumsLive || spipLiveUrl)) {
1568
1610
  console.error(chalk.red("❌ --offline cannot fetch live advisory sources; supply a local --wordfence-feed / --drupal-advisories / --prestashop-advisories / --typo3-advisories / --spip-advisories / --wp-checksums snapshot instead"));
1569
1611
  process.exit(2);
@@ -1580,13 +1622,15 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1580
1622
  const typo3LiveUrl = options.typo3AdvisoriesLive
1581
1623
  ? (options.typo3AdvisoriesLive === true ? TYPO3_GITHUB_ADVISORIES_URL : options.typo3AdvisoriesLive) : null;
1582
1624
  const wpChecksumsLiveUrl = options.wpChecksumsLive
1583
- ? (options.wpChecksumsLive === true ? require("./lib/application-providers/wp-checksums").WP_CHECKSUMS_API : options.wpChecksumsLive) : null;
1625
+ ? (options.wpChecksumsLive === true ? require("./lib/providers/wordpress/checksums").WP_CHECKSUMS_API : options.wpChecksumsLive) : null;
1584
1626
  try {
1585
- const { allApplicationPlugins } = require("./lib/application-plugins");
1586
- const { runApplicationPlugins } = require("./lib/application-plugins/runner");
1587
- const { buildApplicationRelations } = require("./lib/application-inventory");
1627
+ const { allApplicationPlugins } = require("./lib/applications/plugins");
1628
+ const { runApplicationPlugins } = require("./lib/applications/plugins/runner");
1629
+ const { buildApplicationRelations } = require("./lib/applications/inventory");
1588
1630
  appState = await runApplicationPlugins(options.src, { plugins: allApplicationPlugins(), selection: options.appPlugins,
1589
1631
  reportProviderFailures: true,
1632
+ // Publisher advisories of a detected CMS are consulted without a flag.
1633
+ automaticLiveSources: options.sourceProfile === "all",
1590
1634
  resolvedDeps: resolved, activeCodecIds: activeIds, excludePath, defaultExcludes, scanContext: options.scanContext,
1591
1635
  privateComponentPaths: options.privateComponent || [], publicComponents: options.publicComponent || [],
1592
1636
  wordfenceFeedPath: options.wordfenceFeed || null, drupalAdvisoriesPath: options.drupalAdvisories || null,
@@ -1597,7 +1641,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1597
1641
  liveSpipAdvisoriesUrl: spipLiveUrl, spipAdvisoriesApiKey: getNvdApiKey(),
1598
1642
  wpChecksumsPath: options.wpChecksums || null, liveWpChecksumsUrl: wpChecksumsLiveUrl,
1599
1643
  wpChecksumsLocale: options.wpChecksumsLocale || "en_US",
1600
- advisoryCacheDir: path.join(require("./lib/cache-directory").getCacheDir(), "advisory-snapshots"),
1644
+ advisoryCacheDir: path.join(require("./lib/cache/directory").getCacheDir(), "advisory-snapshots"),
1601
1645
  offline,
1602
1646
  fetchImpl: (...args) => fetch(...args),
1603
1647
  maxAdvisoryAgeMs,
@@ -1617,14 +1661,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1617
1661
  // The lanes may have run from a cached snapshot (auto-consumed) — only warn
1618
1662
  // when the coverage rows say the lane genuinely did not execute.
1619
1663
  const laneRan = sourceId => appState.coverage.some(c => c.sourceId === sourceId && c.execution !== "not-run");
1620
- if (appState.applications.some(app => app.type === "wordpress") && !options.wordfenceFeed && !wordfenceLiveUrl && !laneRan("wordfence-v3"))
1621
- ui.warn("WordPress advisory scan did not run: supply --wordfence-feed, or a Wordfence API key for the live feed (a warmed catalogue snapshot is reused without one).");
1664
+ if (appState.applications.some(app => app.type === "wordpress") && !options.wordfenceFeed && !wordfenceLiveUrl && !laneRan("wordfence-v3") && !laneRan('wpvulnerability'))
1665
+ ui.warn("WordPress advisory scan did not run: check the public component identities and the WPVulnerability cache or source diagnostics.");
1622
1666
  if (appState.applications.some(app => app.type === "prestashop") && !options.prestashopAdvisories && !prestashopLiveUrl && !laneRan("github-prestashop-advisories"))
1623
- ui.warn("PrestaShop advisory scan did not run: supply --prestashop-advisories, use --prestashop-advisories-live — or warm it once so the cached snapshot is reused.");
1667
+ ui.warn("PrestaShop advisory scan did not run: no advisory snapshot is cached for an offline or restricted scan. Run once online, or supply --prestashop-advisories.");
1624
1668
  if (appState.applications.some(app => app.type === "typo3") && !options.typo3Advisories && !typo3LiveUrl && !laneRan("github-typo3-advisories"))
1625
- ui.warn("TYPO3 advisory scan did not run: supply --typo3-advisories, use --typo3-advisories-live — or warm it once so the cached snapshot is reused.");
1669
+ ui.warn("TYPO3 advisory scan did not run: no advisory snapshot is cached for an offline or restricted scan. Run once online, or supply --typo3-advisories.");
1626
1670
  if (appState.applications.some(app => app.type === "spip") && !options.spipAdvisories && !spipLiveUrl && !laneRan("spip-security-advisories"))
1627
- ui.warn("SPIP advisory scan did not run: supply --spip-advisories, use --spip-advisories-live — or warm it once so the cached NVD snapshot is reused.");
1671
+ ui.warn("SPIP advisory scan did not run: no advisory snapshot is cached for an offline or restricted scan. Run once online, or supply --spip-advisories.");
1628
1672
  } catch (error) {
1629
1673
  console.error(chalk.red(`❌ application plugin selection failed: ${error.message}`));
1630
1674
  process.exit(2);
@@ -1651,15 +1695,13 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1651
1695
  // and the Maven-Central transitive/BOM/outdated/EOL passes cover them — they're EXCLUDED
1652
1696
  // from the per-codec registry loop below to avoid double-processing.
1653
1697
  const cveScanner = (runMaven || runGradle) ? (getCodec("maven").nativeScanners || []).find(s => s.kind === "cve") : null;
1654
- const cveStore = require("./lib/advisory-store").openAdvisoryStore();
1655
- const cveIndexExists = !!require("./lib/cve-download").loadCveIndex() || !!cveStore.getSourceCoverage("cveproject", "*") || !!cveStore.getSourceCoverage("cveproject-legacy", "*");
1698
+ const cveStore = require("./lib/advisories/store").openAdvisoryStore();
1699
+ const cveIndexExists = !!require("./lib/providers/cveproject/download").loadCveIndex() || !!cveStore.getSourceCoverage("cveproject", "*") || !!cveStore.getSourceCoverage("cveproject-legacy", "*");
1656
1700
  const otherRegistryIds = activeIds.filter(id => id !== "maven" && id !== "gradle" && id !== "npm" && id !== "yarn" && getCodec(id)?.checkRegistry);
1657
1701
  const willCve = !options.disableCveProject && !!cveScanner && (!(options.cveOffline || offline) || cveIndexExists);
1658
- if (!options.disableCveProject && cveScanner && (options.cveOffline || offline) && !cveIndexExists) {
1659
- scanWarnings.push({type: "source-unavailable", message: "CVEProject: local Maven CVE index is missing; Maven CVE coverage is incomplete."});
1660
- }
1702
+ const willPrepareNativeCve = !willCve && !options.disableCveProject;
1661
1703
  // Maven with a source tree: every module is resolved on ITS OWN effective model
1662
- // (lib/maven-reactor.js) and the scan set is rebuilt from the union — this replaces the
1704
+ // (lib/codecs/maven/reactor.js) and the scan set is rebuilt from the union — this replaces the
1663
1705
  // old global merged pass + additive per-module overlay, which let one project's pins
1664
1706
  // re-version another's. Runs even with --no-transitive (directs and their managed
1665
1707
  // versions are still per module). The global pass remains for Gradle records and for a
@@ -1671,7 +1713,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1671
1713
  // Spring Boot setup). Cached via poms-cache; offline-aware (uses warmed POMs,
1672
1714
  // never the network — same as transitive resolution).
1673
1715
  const importBoms = (runMaven && mavenPropsByPom)
1674
- ? require("./lib/maven-bom").collectImportBoms(mavenPropsByPom) : [];
1716
+ ? require("./lib/codecs/maven/bom").collectImportBoms(mavenPropsByPom) : [];
1675
1717
  // Gradle `platform(...)` BOMs are the same as Maven `<scope>import</scope>` BOMs — feed
1676
1718
  // them through the same managed-version backfill (e.g. spring-boot-dependencies → all the
1677
1719
  // versionless spring-boot-starter-* declared in build.gradle get their version).
@@ -1688,7 +1730,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1688
1730
  // runs in the MAINLINE flow (not just the --transitive overlay) so the warmed cache always
1689
1731
  // captures the parent POMs for offline reuse.
1690
1732
  const externalParents = (runMaven && mavenStore)
1691
- ? require("./lib/maven-bom").collectExternalParents(mavenStore) : [];
1733
+ ? require("./lib/codecs/maven/bom").collectExternalParents(mavenStore) : [];
1692
1734
  const willBom = allBoms.length > 0 || inferredGradleBoms.length > 0 || externalParents.length > 0;
1693
1735
  const willOsv = !!options.osv || options.osvDb === true;
1694
1736
  // Packagist security-advisories lane (Composer): the advisory DB `composer audit`
@@ -1697,11 +1739,16 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1697
1739
  // CVE-2026-46643 on the real-instance corpus) — this lane is their official home.
1698
1740
  const willPackagistAudit = options.packagistAudit !== false &&
1699
1741
  [...resolved.values()].some(d => d.ecosystem === "composer");
1742
+ // Ruby advisory database lane (RubyGems): what `bundler-audit` reads. It records
1743
+ // advisories GitHub's reviewed database, hence OSV, does not carry for gems.
1744
+ const willRubyAdvisories = options.rubyAdvisories !== false &&
1745
+ [...resolved.values()].some(d => d.ecosystem === "ruby");
1700
1746
  const willOutdated = !!options.allLibs;
1701
1747
  const willNvd = !!options.nvd;
1702
1748
  const willEpss = !!options.epss;
1703
1749
  const willKev = !!options.kev;
1704
1750
  const willGcve = options.gcve !== false && !options.disableGcve;
1751
+ const willGcvePackages = willGcve && [...resolved.values()].some(d => d.provenance !== 'binary' && require('./lib/advisories/native-package-match').depIdentity(d));
1705
1752
  const willEuvd = options.euvd !== false;
1706
1753
  const willCertFr = options.certfr !== false;
1707
1754
  const willEol = options.eol !== false;
@@ -1711,25 +1758,27 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1711
1758
  const willCerts = options.certs !== false && !!options.src;
1712
1759
  const certExpiryDays = parseInt(options.certExpiryDays, 10) || 90;
1713
1760
  // Identify committed native binaries by checksum (deps.dev + CIRCL) when present.
1714
- const willBinaryId = !options.disableBinaryId && [...resolved.values()].some(d => d.provenance === "binary");
1761
+ const willBinaryId = !options.disableBinaryId && [...resolved.values()].some(d => !d.artifactTargetId && d.provenance === "binary");
1715
1762
  // License detection piggybacks on the registry passes (same fetched metadata),
1716
1763
  // so it adds no progress step of its own.
1717
1764
  const totalSteps = [willBom, willReactor, willTransitive, willCve, willEol, willEol && composerPlatforms.length > 0,
1718
1765
  willOutdated, /*npm reg*/ true, ...otherRegistryIds.map(() => true), willOsv, willPackagistAudit,
1719
- willNvd, willEpss, willKev, willGcve, willEuvd, willCertFr, willRetire, willCerts, willBinaryId].filter(Boolean).length;
1766
+ willPrepareNativeCve, willNvd, willEpss, willKev, willGcvePackages, willEuvd, willCertFr, willRetire, willCerts, willBinaryId].filter(Boolean).length;
1720
1767
  const progress = new ui.Progress(totalSteps);
1721
- // Missing POMs and truncated traversal make the dependency inventory
1722
- // incomplete even when every advisory source is available. Keep coordinates
1723
- // in memory only; reports disclose the count rather than private names.
1768
+ // Keep confirmed repository absence separate from unavailable structural
1769
+ // data. The former is an alert; the latter cancels report publication.
1724
1770
  const missingMavenPoms = new Set();
1771
+ const absentMavenPoms = new Set();
1725
1772
  const mavenVariantCollisions = new Set();
1726
1773
  let mavenDepthLimited = false;
1727
1774
  let mavenResolutionErrors = 0;
1728
1775
  const mavenCoverage = {
1729
1776
  onMissingPom: ({groupId, artifactId, version}) => missingMavenPoms.add(`${groupId}:${artifactId}:${version}`),
1777
+ onAbsentPom: ({groupId, artifactId, version}) => absentMavenPoms.add(`${groupId}:${artifactId}:${version}`),
1730
1778
  onDepthLimit: count => { if (count > 0) mavenDepthLimited = true; },
1731
1779
  onVariantCollision: ({groupId, artifactId}) => mavenVariantCollisions.add(`${groupId}:${artifactId}`),
1732
1780
  onResolutionError: () => { mavenResolutionErrors++; },
1781
+ onPomCycle: () => { mavenResolutionErrors++; },
1733
1782
  };
1734
1783
 
1735
1784
  // The external import-BOM + <parent> managed table, kept for the transitive pass: Maven
@@ -1739,7 +1788,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1739
1788
  if (willBom) {
1740
1789
  const st = progress.start("BOM / parent version resolution (Maven Central)");
1741
1790
  try {
1742
- const { resolveBomManagedVersions, backfillVersions } = require("./lib/maven-bom");
1791
+ const { resolveBomManagedVersions, backfillVersions } = require("./lib/codecs/maven/bom");
1743
1792
  const effCache = new Map();
1744
1793
  const base = { repos: mavenRepos, offline, verbose, effCache, ...mavenCoverage };
1745
1794
  // Import BOMs first: a local <scope>import</scope> declaration wins over the
@@ -1750,7 +1799,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1750
1799
  // External parents second: fill only coords the BOMs didn't already manage, and
1751
1800
  // honor the project's own <properties> overrides (e.g. a patched <log4j2.version>)
1752
1801
  // so the version reflects the classpath, not the framework default.
1753
- const propertyOverrides = require("./lib/maven-bom").collectPropertyOverrides(mavenStore);
1802
+ const propertyOverrides = require("./lib/codecs/maven/bom").collectPropertyOverrides(mavenStore);
1754
1803
  const parentMgmt = await resolveBomManagedVersions(externalParents, { ...base, via: "parent", propertyOverrides });
1755
1804
  for (const [k, v] of parentMgmt) if (!mgmt.has(k)) mgmt.set(k, v);
1756
1805
  bomDepMgmt = mgmt;
@@ -1764,7 +1813,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1764
1813
  if (willReactor) {
1765
1814
  const st = progress.start(options.transitive ? "Maven resolution, module by module (Maven Central)" : "Maven direct versions, module by module");
1766
1815
  try {
1767
- const { resolveReactor } = require("./lib/maven-reactor");
1816
+ const { resolveReactor } = require("./lib/codecs/maven/reactor");
1768
1817
  const rr = await resolveReactor(resolved, mavenStore, mavenPropsByPom, {
1769
1818
  verbose,
1770
1819
  offline,
@@ -1796,17 +1845,20 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1796
1845
  });
1797
1846
  st.done(`+${resolved.size - directCount} transitive (total ${resolved.size})`);
1798
1847
  }
1799
- if (missingMavenPoms.size) scanWarnings.push({type:'dependency-coverage',count:missingMavenPoms.size,
1800
- message:`${missingMavenPoms.size} Maven POM(s) could not be resolved; transitive dependency coverage may be incomplete.`});
1848
+ const unresolvedMavenPoms=[...missingMavenPoms].filter(id=>!absentMavenPoms.has(id));
1849
+ if (unresolvedMavenPoms.length) scanWarnings.push({type:'dependency-coverage',count:unresolvedMavenPoms.length,
1850
+ items:unresolvedMavenPoms.sort().map(id=>({id})),
1851
+ message:`${unresolvedMavenPoms.length} Maven POM(s) could not be resolved; transitive dependency coverage may be incomplete.`});
1801
1852
  if (mavenVariantCollisions.size) scanWarnings.push({type:'dependency-coverage',count:mavenVariantCollisions.size,
1802
- message:`${mavenVariantCollisions.size} Maven coordinate(s) occur with different types or classifiers; version and transitive dependency coverage may be incomplete.`});
1853
+ items:[...mavenVariantCollisions].sort().map(id=>({id})),
1854
+ message:`${mavenVariantCollisions.size} Maven coordinate(s) occur with types or classifiers that resolve to different versions; only one version of each was assessed.`});
1803
1855
  if (mavenResolutionErrors) scanWarnings.push({type:'dependency-coverage',count:mavenResolutionErrors,
1804
1856
  message:'Maven transitive resolution failed for part of the dependency graph; coverage is incomplete.'});
1805
1857
 
1806
1858
  // <dependencyManagement>-only pins: keep the ones a resolution pass reached (now
1807
1859
  // transitives), drop the rest — a pin nothing pulls in is on no classpath.
1808
1860
  {
1809
- const { settleManagedOnly } = require("./lib/cve-match");
1861
+ const { settleManagedOnly } = require("./lib/advisories/cve-match");
1810
1862
  const settled = settleManagedOnly(resolved);
1811
1863
  if (verbose && settled.dropped.length) {
1812
1864
  console.log(chalk.gray(` ${settled.dropped.length} <dependencyManagement>-only pin(s) not on any classpath, not scanned: ${settled.dropped.slice(0, 10).join(", ")}${settled.dropped.length > 10 ? ", …" : ""}`));
@@ -1817,7 +1869,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1817
1869
  // still without a concrete version (external BOM truly unreachable, or offline)
1818
1870
  // are flagged, not the ones we just resolved from spring-boot-dependencies & co.
1819
1871
  if (runMaven || runGradle) {
1820
- const { detectScanCompletenessWarnings } = require("./lib/scan-completeness");
1872
+ const { detectScanCompletenessWarnings } = require("./lib/scan/completeness");
1821
1873
  scanWarnings.push(...detectScanCompletenessWarnings(resolved, { ranSnyk: !!options.snyk, ranTransitive: !!options.transitive }));
1822
1874
  }
1823
1875
 
@@ -1826,12 +1878,19 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1826
1878
  const sourceConsultations = [];
1827
1879
  const undecidableAdvisories = [];
1828
1880
  let cveDataDate = null;
1881
+ const cveWarningStart = scanWarnings.length;
1829
1882
  if (willCve) {
1830
1883
  const st = progress.start("CVE index (CVEProject)");
1831
- try {
1832
- const r = await cveScanner.scan(resolved, { cveRefresh: !!options.cveRefresh, cveOffline: !!options.cveOffline, offline, verbose, hostedProxy: !!options.vigievulnProxy, queryTtlMs:options.advisoryQueryTtlMs });
1884
+ const publicMavenDeps=discoveryCoverage.publicDependencies(resolved,{privateMavenIds:[...privateLibIds,...absentMavenPoms]});
1885
+ if (![...publicMavenDeps.values()].some(d=>d.ecosystem==='maven')) st.skip('no public Maven packages');
1886
+ else try {
1887
+ const r = await cveScanner.scan(publicMavenDeps, { cveRefresh: !!options.cveRefresh, cveOffline: !!options.cveOffline, offline, verbose, hostedProxy: !!options.vigievulnProxy, queryTtlMs:options.advisoryQueryTtlMs });
1833
1888
  cveMatches = r.matches || [];
1834
1889
  cveDataDate = r.meta?.cveDataDate || null;
1890
+ if (!r.meta?.incomplete && !r.meta?.stale && !r.meta?.timestampUnknown) for (const dep of publicMavenDeps.values()) {
1891
+ if (dep.ecosystem === 'maven') for (const version of dep.versions?.length ? dep.versions : [dep.version])
1892
+ discoveryCoverage.consulted(dep,'cveproject',version);
1893
+ }
1835
1894
  if (r.meta?.incomplete) {
1836
1895
  if (!r.meta.refreshError) noteSourceLimitation('CVEProject','The Maven lookup uses a partial native or legacy projection; some source records may not be represented.');
1837
1896
  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.`});
@@ -1848,30 +1907,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1848
1907
  }
1849
1908
  }
1850
1909
 
1851
- // CVEProject also publishes explicit npm PURLs. They are independent of
1852
- // the Maven-only projected index and complement OSV when a CNA advisory is
1853
- // absent there; never infer npm identity from the product description.
1854
- if (!options.disableCveProject && runNpm) {
1855
- try {
1856
- if (!offline && !options.cveOffline && require('./lib/providers').hasHostedProxy()) {
1857
- try {
1858
- const status=await require('./lib/cve-npm-proxy').refreshNpmCves(resolved,cveStore,{ttlMs:options.advisoryQueryTtlMs});
1859
- if(status.incomplete)noteSourceLimitation('CVEProject','Available npm proxy records were assessed; the response does not certify an exhaustive, current catalogue.');
1860
- } catch (err) {scanWarnings.push({type:'source-unavailable',message:`CVEProject npm proxy: ${err.message}; cached records are still matched.`});}
1861
- }
1862
- const npmCves = require('./lib/native-advisories').matchNativeNpmCves(resolved, cveStore);
1863
- cveMatches = require('./lib/merge-sources').mergeBySource(cveMatches, npmCves.matches);
1864
- undecidableAdvisories.push(...npmCves.unknown);
1865
- const npmNames=require('./lib/cve-npm-proxy').packageNames(resolved);
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.');
1867
- } catch (err) { scanWarnings.push({type:'source-unavailable',message:`CVEProject npm: ${err.message}; advisory coverage is incomplete.`}); }
1868
- }
1910
+
1911
+ for (const warning of scanWarnings.slice(cveWarningStart)) if (warning.severity !== 'info') warning.reliabilityFailure = true;
1869
1912
 
1870
1913
  // 1c. Identify committed native binaries by checksum (deps.dev → CIRCL).
1871
1914
  if (willBinaryId) {
1872
1915
  const st = progress.start("Binary identification (deps.dev + CIRCL)");
1873
1916
  try {
1874
- const { enrichUnmanaged } = require("./lib/unmanaged");
1917
+ const { enrichUnmanaged } = require("./lib/inventory/unmanaged");
1875
1918
  const s = await enrichUnmanaged(resolved, { offline, onProgress: (p, t) => st.tick(p, t) });
1876
1919
  const bits = [`${s.identified}/${s.total} identified`, s.pristine ? `${s.pristine} pristine` : null, s.unknown ? `${s.unknown} unknown` : null, s.malicious ? `${s.malicious} ⚠ malicious` : null].filter(Boolean).join(", ");
1877
1920
  st.done(bits);
@@ -1932,7 +1975,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1932
1975
  const st = progress.start("npm registry");
1933
1976
  try {
1934
1977
  const { checkNpmRegistryDeps } = require("./lib/codecs/npm/registry");
1935
- const npmReg = await checkNpmRegistryDeps(resolved, { verbose, offline, allLibs: options.allLibs, registries: registriesFor("npm"), onProgress: (p, t) => st.tick(p, t) });
1978
+ const npmReg = await checkNpmRegistryDeps(resolved, { verbose, offline, allLibs: options.allLibs, registries: registriesFor("npm"), onWarning: w => scanWarnings.push(w), onProgress: (p, t) => st.tick(p, t) });
1936
1979
  obsoleteResults = obsoleteResults.concat(npmReg.deprecated);
1937
1980
  outdatedResults = outdatedResults.concat(npmReg.outdated);
1938
1981
  licenseFindings = licenseFindings.concat(npmReg.licensed || []);
@@ -1974,20 +2017,53 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1974
2017
  // query transitives for the authoritative deprecation signal.
1975
2018
  outdatedResults = outdatedResults.filter(r => r.dep.scope !== "transitive");
1976
2019
 
2020
+ const privateDiscovery = {privateMavenIds:[...privateLibIds,...absentMavenPoms],
2021
+ privateDeps:registryPrivateHits.filter(h=>h.ecosystem===h.dep.ecosystem).map(h=>h.dep)};
2022
+ const publicAdvisoryDeps = discoveryCoverage.publicDependencies(resolved,privateDiscovery);
2023
+ const privateAdvisoryDeps = discoveryCoverage.publicDependencies(resolved,privateDiscovery,true);
2024
+ if (!options.disableCveProject && cveScanner && (options.cveOffline || offline) && !cveIndexExists &&
2025
+ [...publicAdvisoryDeps.values()].some(d=>d.ecosystem==='maven')) {
2026
+ scanWarnings.push({type: "source-unavailable", reliabilityFailure:true, message: "CVEProject: local Maven CVE index is missing; Maven CVE coverage is incomplete."});
2027
+ }
2028
+ const advisoryWarningStart = scanWarnings.length;
2029
+ // CVEProject also publishes explicit npm PURLs. They are independent of
2030
+ // the Maven-only projected index and complement OSV when a CNA advisory is
2031
+ // absent there; never infer npm identity from the product description.
2032
+ if (!options.disableCveProject && runNpm) {
2033
+ try {
2034
+ if (!offline && !options.cveOffline && require('./lib/providers').hasHostedProxy()) {
2035
+ try {
2036
+ const status=await require('./lib/providers/cveproject/npm-proxy').refreshNpmCves(publicAdvisoryDeps,cveStore,{ttlMs:options.advisoryQueryTtlMs});
2037
+ if(status.incomplete)noteSourceLimitation('CVEProject','Available npm proxy records were assessed; the response does not certify an exhaustive, current catalogue.');
2038
+ } catch (err) {scanWarnings.push({type:'source-unavailable',message:`CVEProject npm proxy: ${err.message}; cached records are still matched.`});}
2039
+ }
2040
+ const npmCves = require('./lib/advisories/native').matchNativeNpmCves(resolved, cveStore);
2041
+ cveMatches = require('./lib/findings/merge').mergeBySource(cveMatches, npmCves.matches);
2042
+ undecidableAdvisories.push(...npmCves.unknown);
2043
+ const npmNames=require('./lib/providers/cveproject/npm-proxy').packageNames(publicAdvisoryDeps);
2044
+ 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.');
2045
+ } catch (err) { scanWarnings.push({type:'source-unavailable',message:`CVEProject npm: ${err.message}; advisory coverage is incomplete.`}); }
2046
+ }
2047
+
1977
2048
  // Consult our published records by package even when the operator already
1978
2049
  // has a complete OSV seed. The saved consultation makes removals effective
1979
2050
  // offline too, without downloading the global cache again.
1980
2051
  if (!offline && require('./lib/providers').hasProxyRoute() && (options.sourceProfile === 'proxy' || require('./lib/providers').hasHostedProxy())) {
1981
- try { await require('./lib/vigievuln-advisories').refreshReviewed(resolved,cveStore,{ttlMs:options.advisoryQueryTtlMs}); }
2052
+ try { await require('./lib/providers/vigievuln/advisories').refreshReviewed(publicAdvisoryDeps,cveStore,{ttlMs:options.advisoryQueryTtlMs}); }
1982
2053
  catch (err) { scanWarnings.push({type:'source-unavailable',message:`VigieVuln: reviewed advisory refresh failed (${err.message}); cached records are used with incomplete coverage.`}); }
1983
2054
  }
1984
2055
  // 4b. OSV.dev — Maven-native CVE+GHSA feed (huge recall win over raw CVEProject)
1985
2056
  if (willOsv) {
1986
2057
  const st = progress.start("OSV.dev");
1987
2058
  try {
1988
- const { queryOsvForDeps } = require("./lib/osv");
1989
- const osvMatches = await queryOsvForDeps(resolved, { ...options, verbose, offline, allowStaleFallback:true, queryTtlMs:options.osvDbRefresh ? 0 : options.advisoryQueryTtlMs, useStoredRanges:options.osvDb !== false,
2059
+ const { queryOsvForDeps } = require("./lib/providers/osv/query");
2060
+ const osvMatches = await queryOsvForDeps(publicAdvisoryDeps, { ...options, verbose, offline, allowStaleFallback:true, onConsulted:discoveryCoverage.consulted, queryTtlMs:options.osvDbRefresh ? 0 : options.advisoryQueryTtlMs, useStoredRanges:options.osvDb !== false,
1990
2061
  onProgress: (p, t) => st.tick(p, t), onWarning: w => scanWarnings.push(w) });
2062
+ // Confirmed private coordinates can still match existing advisory evidence;
2063
+ // unavailable public lookups are not required for their classification.
2064
+ if (privateAdvisoryDeps.size) osvMatches.push(...await queryOsvForDeps(privateAdvisoryDeps,
2065
+ {...options,offline:true,allowStaleFallback:true,onWarning:()=>{}}));
2066
+ reviewedMatched = true;
1991
2067
  const before = cveMatches.length;
1992
2068
  cveMatches = mergeBySource(cveMatches, osvMatches);
1993
2069
  st.done(`${osvMatches.length} vulns · +${cveMatches.length - before} after merge`);
@@ -1997,7 +2073,9 @@ async function runReportFlow(resolved, ecoFlags = {}) {
1997
2073
  }
1998
2074
  }
1999
2075
  else {
2000
- try { cveMatches=mergeBySource(cveMatches,require('./lib/osv').queryReviewedForDeps(resolved,{store:cveStore,offline,maxAdvisoryAgeMs:options.maxAdvisoryAgeMs,queryTtlMs:options.advisoryQueryTtlMs,onWarning:w=>scanWarnings.push(w)})); }
2076
+ // Without OSV the reviewed records are still a consulted advisory source:
2077
+ // the coverage assessment must count them, or the scan looks unassessed.
2078
+ try { cveMatches=mergeBySource(cveMatches,require('./lib/providers/osv/query').queryReviewedForDeps(resolved,{store:cveStore,offline,maxAdvisoryAgeMs:options.maxAdvisoryAgeMs,queryTtlMs:options.advisoryQueryTtlMs,onWarning:w=>scanWarnings.push(w)})); reviewedMatched = true; }
2001
2079
  catch(err) { scanWarnings.push({type:'source-unavailable',message:`VigieVuln: reviewed advisory matching failed (${err.message}); coverage is incomplete.`}); }
2002
2080
  }
2003
2081
 
@@ -2007,12 +2085,12 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2007
2085
  if (willPackagistAudit) {
2008
2086
  const st = progress.start("Packagist security advisories");
2009
2087
  try {
2010
- const { queryPackagistAudit } = require("./lib/packagist-audit");
2088
+ const { queryPackagistAudit } = require("./lib/providers/packagist/audit");
2011
2089
  let skippedOtherRegistry = [];
2012
2090
  let unknownPackages = [];
2013
- const pkMatches = await queryPackagistAudit(resolved, { verbose, offline,
2091
+ const pkMatches = await queryPackagistAudit(publicAdvisoryDeps, { verbose, offline, onConsulted:discoveryCoverage.consulted,
2014
2092
  onProgress: (p, t) => st.tick(p, t), onSkipped: names => { skippedOtherRegistry = names; },
2015
- onUnknown: names => { unknownPackages = names; } });
2093
+ onWarning: warning => scanWarnings.push(warning), onUnknown: names => { unknownPackages = names; } });
2016
2094
  const before = cveMatches.length;
2017
2095
  cveMatches = mergeBySource(cveMatches, pkMatches);
2018
2096
  st.done(`${pkMatches.length} advisories matched · +${cveMatches.length - before} after merge` +
@@ -2021,22 +2099,38 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2021
2099
  if (skippedOtherRegistry.length) scanWarnings.push({ type: "packagist-non-packagist-package",
2022
2100
  message: `${skippedOtherRegistry.length} Composer package(s) from another registry were not queried against Packagist: ${skippedOtherRegistry.join(", ")}. Their application advisory coverage remains incomplete.` });
2023
2101
  if (unknownPackages.length) scanWarnings.push({ type: "packagist-advisory-data-unknown",
2024
- message: `Packagist returned no advisory data for ${unknownPackages.length} Composer package(s): ${unknownPackages.join(", ")}. Their Packagist advisory coverage is unknown.` });
2102
+ message: `No ${offline ? "cached " : ""}Packagist advisory data was available for ${unknownPackages.length} Composer package(s): ${unknownPackages.join(", ")}. Their Packagist advisory coverage is unknown.` });
2025
2103
  } catch (err) {
2026
2104
  st.fail(err.message);
2027
2105
  scanWarnings.push({type:"source-unavailable",message:`Packagist: ${err.message}; advisory coverage is incomplete.`});
2028
2106
  }
2029
2107
  }
2030
2108
 
2109
+ // 4b-ter. Ruby advisory database (RubyGems). Default-on like Packagist; one archive is
2110
+ // fetched, no package name leaves the machine.
2111
+ if (willRubyAdvisories) {
2112
+ const st = progress.start("Ruby advisory database");
2113
+ try {
2114
+ const rubyMatches = await require("./lib/providers/rubysec/advisories").queryRubyAdvisories(publicAdvisoryDeps, { offline,
2115
+ forceUpdate: options.forceUpdate, onConsulted: discoveryCoverage.consulted, onWarning: warning => scanWarnings.push(warning) });
2116
+ const before = cveMatches.length;
2117
+ cveMatches = mergeBySource(cveMatches, rubyMatches);
2118
+ st.done(`${rubyMatches.length} advisories matched · +${cveMatches.length - before} after merge`);
2119
+ } catch (err) {
2120
+ st.fail(err.message);
2121
+ scanWarnings.push({type:"source-unavailable",message:`Ruby advisory database: ${err.message}; advisory coverage is incomplete.`});
2122
+ }
2123
+ }
2124
+
2031
2125
  // GCVE records are matched locally, including when imported in a cache seed.
2032
2126
  // Online scans refresh the index through the configured proxy when one is active.
2033
- if (willGcve) {
2127
+ if (willGcvePackages && [...publicAdvisoryDeps.values()].some(d=>d.provenance!=='binary' && require('./lib/advisories/native-package-match').depIdentity(d))) {
2034
2128
  const st = progress.start("GCVE (local index)");
2035
2129
  try {
2036
2130
  const path = require('node:path');
2037
- const { readGcveIndex } = require('./lib/gcve-index');
2038
- const store = require('./lib/advisory-store').openAdvisoryStore();
2039
- const file = path.join(require('./lib/cache-directory').getCacheDir(), 'gcve-data', 'index.json');
2131
+ const { readGcveIndex } = require('./lib/providers/gcve/local-index');
2132
+ const store = require('./lib/advisories/store').openAdvisoryStore();
2133
+ const file = path.join(require('./lib/cache/directory').getCacheDir(), 'gcve-data', 'index.json');
2040
2134
  let index = null;
2041
2135
  try { index = readGcveIndex(file); } catch {}
2042
2136
  const nativeCoverage = store.getSourceCoverage('gcve','*');
@@ -2044,7 +2138,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2044
2138
  let stale = !oldest.length || Date.now() - Math.min(...oldest) >= options.advisoryQueryTtlMs;
2045
2139
  if ((!index && !nativeCoverage || stale || options.forceUpdate) && !offline && !options.gcveOffline) {
2046
2140
  try {
2047
- const feed=require('./lib/gcve-feed');
2141
+ const feed=require('./lib/providers/gcve/feed');
2048
2142
  index = (await feed.updateGcveIndex({cacheFile:file,
2049
2143
  ...(options.proxyCache?{fetcher:feed.proxyGcveFetcher}:{})})).index;
2050
2144
  stale = false;
@@ -2058,8 +2152,8 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2058
2152
  ? 'GCVE has no local data for an offline scan; run an online scan first or import a GCVE cache seed'
2059
2153
  : 'GCVE source returned no advisory data');
2060
2154
  const asOf = oldest.length ? Math.min(...oldest) : 0;
2061
- if (index && (!nativeCoverage || nativeCoverage.fetchedAt < asOf)) await require('./lib/native-advisories').importGcveIndex(store,index,{provenance:{transport:'cache'}});
2062
- const result = require('./lib/native-advisories').matchGcveStore(resolved,store,index);
2155
+ if (index && (!nativeCoverage || nativeCoverage.fetchedAt < asOf)) await require('./lib/advisories/native').importGcveIndex(store,index,{provenance:{transport:'cache'}});
2156
+ const result = require('./lib/advisories/native').matchGcveStore(resolved,store,index);
2063
2157
  const before = cveMatches.length;
2064
2158
  cveMatches = mergeBySource(cveMatches,result.matches);
2065
2159
  if (stale) scanWarnings.push({type:'source-stale',...(offline || options.gcveOffline ? {severity:'info'} : {}),message:'GCVE index is older than the advisory query TTL or lacks a source timestamp; advisory coverage may be outdated.'});
@@ -2067,6 +2161,8 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2067
2161
  const unindexed = result.coverage.reduce((n,c)=>n+(c.unindexed || 0),0);
2068
2162
  if (!result.sourceCoverage?.complete || (index && (!index.directory?.verified || !result.coverage.length || result.coverage.some(c=>!c.complete) || skipped || unindexed)))
2069
2163
  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.`);
2164
+ if (!stale && index?.directory?.verified && index.directory.notCollected === 0 && index.coverage?.length && index.coverage.every(c=>c.complete) && !unindexed)
2165
+ completeDiscoverySources.push('gcve');
2070
2166
  undecidableAdvisories.push(...result.unknown);
2071
2167
  st.done(`${result.matches.length} matched · +${cveMatches.length-before} new`);
2072
2168
  } catch (err) {
@@ -2080,23 +2176,38 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2080
2176
  // the older Maven/npm projections without guessing product identities.
2081
2177
  {
2082
2178
  const sources = [!options.disableCveProject && 'cveproject', willGcve && 'gcve'].filter(Boolean);
2179
+ const st = willPrepareNativeCve ? progress.start("CVEProject package index") : null;
2083
2180
  try {
2181
+ let preparationIssue;
2084
2182
  // The Maven scanner already prepares CVEProject. Other ecosystems
2085
2183
  // need the same preparation even when OSV has returned no findings.
2086
- if (!willCve && !options.disableCveProject && [...resolved.values()].some(d => d.provenance !== 'binary' && require('./lib/native-package-match').depIdentity(d))) {
2087
- const prepared = await require('./lib/native-source-prepare').prepareNativeSources(resolved,{
2184
+ if (st && [...publicAdvisoryDeps.values()].some(d => d.provenance !== 'binary' && require('./lib/advisories/native-package-match').depIdentity(d))) {
2185
+ st.phase("Checking source data");
2186
+ const prepared = await require('./lib/advisories/native-source-prepare').prepareNativeSources(publicAdvisoryDeps,{
2088
2187
  ...options, offline, store:cveStore, nativeSources:['cveproject'],
2188
+ onCveProgress: (phase, detail) => st.phase(phase, detail),
2089
2189
  });
2090
2190
  for (const c of prepared.coverage) {
2091
2191
  sourceConsultations.push({capability:'sources',collector:c.source,execution:c.execution,result:c.status,reason:c.reason,fetchedAt:c.fetchedAt});
2092
- if (c.issue && c.issue!=='refresh-failed') scanWarnings.push({type:'source-unavailable',...(c.issue==='missing-source'?{severity:'info'}:{}),source:c.source,message:`CVEProject: ${c.reason}.`});
2192
+ if (c.issue && c.issue!=='refresh-failed') scanWarnings.push({type:'source-unavailable',source:c.source,message:`CVEProject: ${c.reason}.`});
2193
+ if (c.issue) preparationIssue = c;
2093
2194
  }
2094
2195
  for (const warning of prepared.warnings) scanWarnings.push(typeof warning==='string'?{type:'source-unavailable',message:warning}:warning);
2095
- }
2096
- const native = require('./lib/native-advisories').matchNativePackages(resolved,cveStore,{sources});
2196
+ } else if (st) st.skip("no eligible packages");
2197
+ st?.phase("Matching packages");
2198
+ const native = require('./lib/advisories/native').matchNativePackages(resolved,cveStore,{
2199
+ sources, onProgress: count => st?.phase("Matching packages", `${count} records checked`),
2200
+ });
2097
2201
  cveMatches = mergeBySource(cveMatches,native.matches);
2202
+ matchedNativeSources.push(...sources);
2098
2203
  undecidableAdvisories.push(...native.unknown);
2099
- } catch (err) { scanWarnings.push({type:'source-unavailable',message:`Native advisories: ${err.message}; coverage is incomplete.`}); }
2204
+ if (preparationIssue?.issue === 'missing-source') st.skip(preparationIssue.reason);
2205
+ else if (preparationIssue) st.fail(preparationIssue.reason);
2206
+ else st?.done("Package matching complete");
2207
+ } catch (err) {
2208
+ st?.fail(err.message);
2209
+ scanWarnings.push({type:'source-unavailable',message:`Native advisories: ${err.message}; coverage is incomplete.`});
2210
+ }
2100
2211
  }
2101
2212
 
2102
2213
  // Application-provider findings enter the shared enrichment, priority and gate
@@ -2106,14 +2217,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2106
2217
  // merges into ONE finding with the union of sources, and the application attribution
2107
2218
  // is rebuilt from the physical occurrence (expandComposerFindings). Findings the
2108
2219
  // standard lanes cannot see (Drupal core, WordPress catalogue) pass through intact.
2109
- if (appState.findings.length) cveMatches = require("./lib/merge-sources").mergeBySource(cveMatches, appState.findings);
2220
+ if (appState.findings.length) cveMatches = require("./lib/findings/merge").mergeBySource(cveMatches, appState.findings);
2110
2221
 
2111
2222
  // 4c. NVD enrichment — canonical description + full CVSS for matched CVEs.
2112
2223
  if (willNvd) {
2113
2224
  const st = progress.start("NVD enrichment");
2114
2225
  let nvdBindings = [];
2115
2226
  if (willOsv && options.osvDb !== false) try {
2116
- nvdBindings = require('./lib/nvd-package-ranges').collectPackageNvdBindings(resolved, require('./lib/advisory-store').openAdvisoryStore());
2227
+ nvdBindings = require('./lib/providers/nvd/package-ranges').collectPackageNvdBindings(publicAdvisoryDeps, cveStore, cveMatches);
2117
2228
  } catch (err) {
2118
2229
  scanWarnings.push({type:'source-unavailable',message:`NVD package candidates: ${err.message}; additional range coverage is incomplete.`});
2119
2230
  }
@@ -2121,7 +2232,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2121
2232
  st.skip("no CVE to enrich");
2122
2233
  } else {
2123
2234
  try {
2124
- const { enrichMatches, hasCachedAbsence } = require("./lib/nvd");
2235
+ const { enrichMatches, hasCachedAbsence } = require("./lib/providers/nvd/enrich");
2125
2236
  const nvdCandidates = [...cveMatches, ...nvdBindings];
2126
2237
  const answeredAbsent = new Set();
2127
2238
  await enrichMatches(nvdCandidates, { ...options, verbose, offline, mirror: options.nvdMirror !== false, onProgress: (p, t) => st.tick(p, t), onAbsent:id=>answeredAbsent.add(id) });
@@ -2137,9 +2248,9 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2137
2248
  // candidates become findings only after an artifact-level CPE/range
2138
2249
  // match; neither generic framework CPEs nor guessed names qualify.
2139
2250
  let nvdAdded = 0;
2140
- const {matchBoundNvdRanges,matchNvdAffected} = require('./lib/nvd-package-ranges');
2251
+ const {matchBoundNvdRanges,matchNvdAffected} = require('./lib/providers/nvd/package-ranges');
2141
2252
  let nativeNvdUncertain = false, nativeNvdCandidates = false;
2142
- const needsReview=require('./lib/coverage-diagnostics').needsMavenReview;
2253
+ const needsReview=require('./lib/advisories/coverage-diagnostics').needsMavenReview;
2143
2254
  const boundNvd = [...matchNvdAffected(resolved, nvdCandidates, {onUncertain:candidate=>{nativeNvdCandidates=true;if(needsReview(candidate,cveStore,{ttlMs:options.advisoryQueryTtlMs}))nativeNvdUncertain=true;}}), ...matchBoundNvdRanges(resolved, nvdCandidates)];
2144
2255
  if (nativeNvdUncertain) scanWarnings.push({type:'source-unavailable',severity:'info',message:'NVD: some native affected entries have unverified package identities or version applicability; those candidates were not reported and coverage is incomplete.'});
2145
2256
  else if (nativeNvdCandidates) noteSourceLimitation('NVD','Some product-only candidates lack a reliable Maven package identity; independent OSV evidence is used when available.');
@@ -2149,7 +2260,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2149
2260
  nvdAdded += cveMatches.length - before;
2150
2261
  }
2151
2262
  if (options.nvdCpeMatch) try {
2152
- const { matchDepsAgainstNvdCpe } = require("./lib/cpe");
2263
+ const { matchDepsAgainstNvdCpe } = require("./lib/providers/nvd/cpe");
2153
2264
  const records = {};
2154
2265
  for (const m of cveMatches) {
2155
2266
  const id = m.cve?.id;
@@ -2166,7 +2277,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2166
2277
  // confidence and flag likely false positives (version outside CPE range).
2167
2278
  let filtered = 0;
2168
2279
  try {
2169
- const { refineMatchesWithCpe } = require("./lib/cpe");
2280
+ const { refineMatchesWithCpe } = require("./lib/providers/nvd/cpe");
2170
2281
  refineMatchesWithCpe(cveMatches);
2171
2282
  filtered = cveMatches.filter(m => m.cpeFiltered).length;
2172
2283
  } catch (err) { ui.warn(`CPE refinement skipped: ${err.message}`); }
@@ -2174,20 +2285,28 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2174
2285
  st.done(`${uniqueCves} CVE${nvdAdded ? ` · +${nvdAdded} via NVD ranges` : ""}${filtered ? ` · ${filtered} false-positive(s) filtered` : ""}${hasNvdKey || options.vigievulnProxy ? "" : " · no key (slow)"}`);
2175
2286
  } catch (err) {
2176
2287
  st.fail(err.message);
2177
- scanWarnings.push(nvdBindings.length || options.nvdCpeMatch
2288
+ scanWarnings.push(nvdBindings.length
2178
2289
  ? {type:'source-unavailable',message:`NVD: ${err.message}; additional version-range coverage is incomplete.`}
2179
2290
  : {type:'cve-record-source',source:'nvd',affectsCompleteness:false,message:err.message});
2180
2291
  }
2181
2292
  }
2182
2293
  }
2183
2294
 
2295
+ for (const warning of scanWarnings.slice(advisoryWarningStart)) {
2296
+ if (warning.severity !== 'info' && warning.affectsCompleteness !== false &&
2297
+ ['source-unavailable','source-stale','osv-coverage'].includes(warning.type)) warning.reliabilityFailure=true;
2298
+ }
2299
+ const missingDiscovery = discoveryCoverage.assess(resolved,{store:cveStore,options,
2300
+ nativeSources:matchedNativeSources,completeSources:completeDiscoverySources,reviewed:reviewedMatched,
2301
+ ...privateDiscovery});
2302
+ if (missingDiscovery) scanWarnings.push(missingDiscovery);
2184
2303
  // 4e. EPSS — exploit-prediction percentile for each matched CVE (FIRST.org).
2185
2304
  if (willEpss) {
2186
2305
  const st = progress.start("EPSS (FIRST.org)");
2187
2306
  if (!cveMatches.length) { st.skip("no CVE"); }
2188
2307
  else {
2189
2308
  try {
2190
- const { enrichEpss } = require("./lib/epss");
2309
+ const { enrichEpss } = require("./lib/providers/epss/enrich");
2191
2310
  await enrichEpss(cveMatches, { verbose, offline, onProgress: (p, t) => st.tick(p, t) });
2192
2311
  const scored = cveMatches.filter(m => m.cve?.epssPercentile != null).length;
2193
2312
  st.done(`${scored} scored`);
@@ -2201,7 +2320,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2201
2320
  if (!cveMatches.length) { st.skip("no CVE"); }
2202
2321
  else {
2203
2322
  try {
2204
- const { enrichKev } = require("./lib/kev");
2323
+ const { enrichKev } = require("./lib/providers/kev/enrich");
2205
2324
  await enrichKev(cveMatches, { verbose, offline, hostedProxy: !!options.vigievulnProxy });
2206
2325
  const kevd = cveMatches.filter(m => m.cve?.kev).length;
2207
2326
  st.done(`${kevd} known-exploited`);
@@ -2211,7 +2330,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2211
2330
 
2212
2331
  // 4g. Composite priority (KEV > EPSS-weighted CVSS). Always — cheap, pure.
2213
2332
  try {
2214
- const { attachPriority } = require("./lib/priority");
2333
+ const { attachPriority } = require("./lib/findings/priority");
2215
2334
  attachPriority(cveMatches);
2216
2335
  } catch (err) { ui.warn(`priority scoring skipped: ${err.message}`); }
2217
2336
 
@@ -2248,7 +2367,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2248
2367
  // description. Folded into this step so the progress count stays exact.
2249
2368
  if (retireMatches.length && willNvd) {
2250
2369
  try {
2251
- const { enrichMatches } = require("./lib/nvd");
2370
+ const { enrichMatches } = require("./lib/providers/nvd/enrich");
2252
2371
  await enrichMatches(retireMatches, { ...options, verbose, offline, mirror: options.nvdMirror !== false, onProgress: (p, t) => st.tick(p, t) });
2253
2372
  } catch (err) { if (verbose) ui.warn(`vendored-JS NVD enrichment skipped: ${err.message}`); }
2254
2373
  }
@@ -2280,7 +2399,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2280
2399
  const message="--snyk requires --target (snyk runs on cleaned POMs)";
2281
2400
  ui.warn(message);scanWarnings.push({type:'source-unavailable',message});
2282
2401
  } else {
2283
- const snyk = require("./lib/snyk");
2402
+ const snyk = require("./lib/providers/snyk/client");
2284
2403
  try {
2285
2404
  const raw = await snyk.runSnykTest(options.target, { verbose });
2286
2405
  const errors = raw.filter(project => project?.ok === false && project.error).map(project => String(project.error));
@@ -2301,7 +2420,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2301
2420
  // Context applies to every finding origin, including vendored JS and optional
2302
2421
  // late providers. Each source runs independently and keeps per-CVE evidence.
2303
2422
  {
2304
- const { enrichEuropeanFindings, europeanAdapters } = require('./lib/finding-enrichment');
2423
+ const { enrichEuropeanFindings, europeanAdapters } = require('./lib/findings/enrichment');
2305
2424
  const contextMatches = [...cveMatches, ...retireMatches];
2306
2425
  const enabled = {gcve:willGcve,euvd:willEuvd,certfr:willCertFr};
2307
2426
  for (const adapter of europeanAdapters.filter(a => enabled[a.id])) {
@@ -2325,8 +2444,8 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2325
2444
  // assessment pipeline. Only the isolated report binds local source locations.
2326
2445
  const imageProgress = new ui.Progress(2);
2327
2446
  let imageProgressStep = null, imageProgressPhase = null;
2328
- const imageState = await require('./lib/source-image-scan').scanSourceImages(ecoFlags.imageReferences, {
2329
- ...options, offline, cacheDir:require('./lib/cache-directory').getCacheDir(),
2447
+ const imageState = await require('./lib/images/source-scan').scanSourceImages(ecoFlags.imageReferences, {
2448
+ ...options, offline, cacheDir:require('./lib/cache/directory').getCacheDir(),
2330
2449
  platform:options.imagePlatform, fetcher:globalThis.fetch,
2331
2450
  registryFetcher:offline ? async () => { throw Error('Registry access is disabled offline'); } : registryFetch,
2332
2451
  queryTtlMs:options.advisoryQueryTtlMs,
@@ -2363,7 +2482,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2363
2482
  // chapters, exports, gate) — otherwise, on a root spanning several independent
2364
2483
  // projects, every version is reported against every manifest holding the coord.
2365
2484
  {
2366
- const { attributeMatchOrigins } = require("./lib/attribution");
2485
+ const { attributeMatchOrigins } = require("./lib/findings/attribution");
2367
2486
  const reattributed = attributeMatchOrigins(cveMatches);
2368
2487
  if (reattributed && verbose) console.log(` re-attributed ${reattributed} match(es) to their resolving manifest/module`);
2369
2488
  }
@@ -2373,7 +2492,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2373
2492
  // runs a vendor build — the finding leaves the EOL list for a chapter-0 note.
2374
2493
  if (eolResults.length) {
2375
2494
  try {
2376
- const { annotateCommercialSupport } = require("./lib/commercial-support");
2495
+ const { annotateCommercialSupport } = require("./lib/maintenance/commercial-support");
2377
2496
  const { commercialBuilds } = await annotateCommercialSupport(eolResults, cveMatches, { offline, repos: mavenRepos });
2378
2497
  if (commercialBuilds.length) {
2379
2498
  eolResults = eolResults.filter(e => e.status !== "commercial");
@@ -2382,20 +2501,24 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2382
2501
  } catch (err) { if (verbose) console.warn(chalk.yellow(` commercial-support annotation skipped: ${err.message}`)); }
2383
2502
  }
2384
2503
  if (options.src) {
2385
- const { expandComposerFindings } = require("./lib/application-inventory");
2504
+ const { expandComposerFindings } = require("./lib/applications/inventory");
2386
2505
  cveMatches = expandComposerFindings(cveMatches, options.src, applicationRelations);
2506
+ require("./lib/applications/layout").attributeLayoutFindings(cveMatches,appState.applications,appState.inventory,options.src);
2387
2507
  }
2388
2508
  {
2389
- const { coalescePhysicalFindings } = require("./lib/finding-summary");
2509
+ const { coalescePhysicalFindings } = require("./lib/findings/summary");
2390
2510
  cveMatches = coalescePhysicalFindings(cveMatches, options.src || null);
2391
- const { attachPriority } = require("./lib/priority");
2511
+ const { attachPriority } = require("./lib/findings/priority");
2392
2512
  attachPriority(cveMatches);
2393
2513
  }
2394
2514
 
2395
2515
  // 6b. Supply-chain risk lane (pure + offline): flag KNOWN-MALICIOUS advisories
2396
2516
  // (OSV MAL-… already in the match set) always, and detect suspected TYPOSQUATS
2397
2517
  // (opt-in --typosquat, heuristic — names one edit from a popular package).
2398
- const { flagMalicious, detectTyposquats } = require("./lib/malware");
2518
+ const { flagMalicious, detectTyposquats, withoutForeignMalicious } = require("./lib/findings/malware");
2519
+ const foreignMalicious = withoutForeignMalicious(cveMatches);
2520
+ cveMatches = foreignMalicious.matches;
2521
+ for (const m of foreignMalicious.dropped) noteSourceLimitation('OSV', `${m.cve.id} designates the registry package ${m.dep.name}; this project resolves ${m.dep.name} from ${m.dep.resolved}, another artifact of the same name. The malicious-package advisory was not applied.`);
2399
2522
  const maliciousCount = flagMalicious(cveMatches);
2400
2523
  const typosquats = options.typosquat ? detectTyposquats(resolved) : [];
2401
2524
  if (maliciousCount || typosquats.length) {
@@ -2420,7 +2543,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2420
2543
  const triageWarnings = [];
2421
2544
  if (options.ignore || options.vex) {
2422
2545
  try {
2423
- const { parseIgnoreFile, parseVex, applySuppressions, hasGlobalIgnoreRule } = require("./lib/suppress");
2546
+ const { parseIgnoreFile, parseVex, applySuppressions, hasGlobalIgnoreRule } = require("./lib/findings/suppress");
2424
2547
  const rules = [];
2425
2548
  if (options.ignore) rules.push(...parseIgnoreFile(fs.readFileSync(options.ignore, "utf8")));
2426
2549
  if (options.vex) rules.push(...parseVex(JSON.parse(fs.readFileSync(options.vex, "utf8"))));
@@ -2435,7 +2558,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2435
2558
  } catch (err) { ui.warn(`suppression skipped: ${err.message}`); }
2436
2559
  }
2437
2560
 
2438
- const { sortByPriority } = require("./lib/priority");
2561
+ const { sortByPriority } = require("./lib/findings/priority");
2439
2562
  const isEmbedded = m => !m.dep?.artifactTargetId && m.dep?.provenance === "embedded";
2440
2563
  // Embedded-binary findings get their own chapter, so keep them out of the
2441
2564
  // declared prod/dev sets (a coord that's both declared AND embedded yields two
@@ -2473,77 +2596,12 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2473
2596
  ].filter(Boolean).join(" ") || chalk.gray("none");
2474
2597
  const heading = (label, n, extra = "") => console.log("\n " + chalk.bold(label) + chalk.dim(` (${n})`) + (extra ? " " + extra : ""));
2475
2598
 
2476
- ui.section("Results");
2477
-
2478
- heading("CVE · production", prodActive.length, fmtStats(stats) + (kevCount ? " " + chalk.bgRed.white(` ${kevCount} KEV `) : ""));
2479
- for (const m of prodActive.slice(0, 12)) {
2480
- const epss = m.cve?.epssPercentile != null ? chalk.dim(` epss ${Math.round(m.cve.epssPercentile * 100)}%`) : "";
2481
- const kev = m.cve?.kev ? " " + chalk.bgRed.white(" KEV ") : "";
2482
- console.log(" " + sev(m.cve.severity)((m.cve.severity || "UNKNOWN").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${depLabel(m.dep)}:${m.dep.version}`) + epss + kev);
2483
- }
2484
- if (prodActive.length > 12) console.log(chalk.dim(` …and ${prodActive.length - 12} more (see report)`));
2485
- if (cpeFilteredCount) console.log(chalk.dim(` ${cpeFilteredCount} likely false positive(s) → report appendix`));
2486
-
2487
- heading("CVE · dev", devActive.length, devActive.length ? fmtStats(devStats) : "");
2488
-
2489
- if (embeddedActive.length) {
2490
- heading("CVE · embedded binaries", embeddedActive.length, fmtStats(computeStats(embeddedActive)));
2491
- for (const m of embeddedActive.slice(0, 8)) {
2492
- const top = (m.dep.manifestPaths?.[0] || "").split("!/")[0];
2493
- console.log(" " + sev(m.cve.severity)((m.cve.severity || "UNKNOWN").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${depLabel(m.dep)}:${m.dep.version}`) + chalk.dim(` ⊂ ${top}`));
2494
- }
2495
- if (embeddedActive.length > 8) console.log(chalk.dim(` …and ${embeddedActive.length - 8} more (see report ch.1B)`));
2496
- }
2497
-
2498
- {
2499
- const { buildInventory } = require("./lib/unmanaged");
2500
- const inv = buildInventory(new Map([...resolved].filter(([, dep]) => !dep.artifactTargetId)));
2501
- if (inv.length) {
2502
- heading("Unmanaged binaries", inv.length);
2503
- for (const e of inv.slice(0, 10)) {
2504
- const id = e.identity ? `${e.identity.ecosystem ? e.identity.ecosystem + ":" : ""}${e.identity.name || ""}${e.identity.version ? "@" + e.identity.version : ""}` : chalk.dim("unknown");
2505
- const flags = [e.knownMalicious ? chalk.bgRed.white(" malicious ") : null, e.nameMismatch ? chalk.yellow("name≠checksum") : null, e.shouldBeManaged ? chalk.cyan("should-be-managed") : null, (e.noOnlineInfo ? chalk.dim("unknown") : null)].filter(Boolean).join(" ");
2506
- console.log(" " + chalk.white(path.basename(String(e.path))) + " " + chalk.dim(id) + (flags ? " " + flags : ""));
2507
- }
2508
- if (inv.length > 10) console.log(chalk.dim(` …and ${inv.length - 10} more (see report ch.1C)`));
2509
- }
2510
- }
2511
-
2512
- if (certFindings.length) {
2513
- const privN = certFindings.filter(c => c.kind === "private-key").length;
2514
- const expiredN = certFindings.filter(c => c.issues.some(i => i.type === "cert-expired")).length;
2515
- heading("Certificates & keys", certFindings.length, [privN ? chalk.red(`${privN} private key`) : null, expiredN ? chalk.yellow(`${expiredN} expired`) : null].filter(Boolean).join(" "));
2516
- for (const c of certFindings.slice(0, 10)) {
2517
- const vis = c.keyVisibility ? chalk.dim(`[${c.keyVisibility}]`) : "";
2518
- const label = c.kind === "certificate" ? `${c.subject || "?"}` : `${c.algorithm || ""} ${c.kind}`.trim();
2519
- console.log(" " + sev(c.severity.toUpperCase())((c.severity || "?").padEnd(8)) + " " + chalk.white(path.basename(String(c.path))) + " " + vis + " " + chalk.dim(label));
2520
- }
2521
- if (certFindings.length > 10) console.log(chalk.dim(` …and ${certFindings.length - 10} more (see report ch.2.4)`));
2522
- }
2523
-
2524
- const eolDirectN = eolResults.filter(e => e.dep?.scope !== "transitive").length;
2525
- heading("EOL frameworks", eolResults.length, eolResults.length ? chalk.dim(`${eolDirectN} direct, ${eolResults.length - eolDirectN} transitive`) : "");
2526
- const eolWhenText = e => e.status === "unsupported" ? `support ended ${e.support}` : (e.eol === true || e.eol === "true" ? "EOL" : `EOL ${e.eol}`);
2527
- for (const e of eolResults.slice(0, 8)) console.log(" " + chalk.yellow(e.product.padEnd(18)) + " " + chalk.dim(`${coordOf(e.dep)}:${e.dep.version}`) + " " + chalk.dim(eolWhenText(e)) + (e.components?.length > 1 ? chalk.dim(` (+${e.components.length - 1} components)`) : "") + definedInOf(e.dep));
2528
- if (eolResults.length > 8) console.log(chalk.dim(` …and ${eolResults.length - 8} more`));
2529
-
2530
- heading("Obsolete / deprecated", obsoleteResults.length);
2531
- for (const o of obsoleteResults.slice(0, 8)) console.log(" " + chalk.dim(`${coordOf(o.dep)}:${o.dep.version}`) + " → " + (o.replacement || chalk.dim("n/a")) + definedInOf(o.dep));
2532
- if (obsoleteResults.length > 8) console.log(chalk.dim(` …and ${obsoleteResults.length - 8} more`));
2533
-
2534
- heading("Outdated", outdatedResults.length, options.allLibs ? "" : chalk.dim("pass -a/--allLibs to query registries"));
2535
-
2536
- if (retireMatches.length) {
2537
- heading("Vendored JS (retire.js)", retireMatches.length);
2538
- for (const m of retireMatches.slice(0, 8)) console.log(" " + sev(m.cve.severity)((m.cve.severity || "?").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${m.dep.artifactId}@${m.dep.version}`));
2539
- if (retireMatches.length > 8) console.log(chalk.dim(` …and ${retireMatches.length - 8} more`));
2540
- }
2541
-
2542
- if (undecidableAdvisories.length) scanWarnings.push(require('./lib/diagnostics').advisoryEvidenceDiagnostic(undecidableAdvisories));
2543
- const durableIssues = require('./lib/package-versions').drainIssues();
2599
+ if (undecidableAdvisories.length) scanWarnings.push(require('./lib/scan/diagnostics').advisoryEvidenceDiagnostic(undecidableAdvisories));
2600
+ const durableIssues = require('./lib/inventory/package-versions').drainIssues();
2544
2601
  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
2602
  // Reconcile source and image enrichment by CVE identity, once for the whole scan.
2546
- const recordSummary = require('./lib/cve-record-coverage').summarizeCveRecords([...cveMatches, ...retireMatches], {
2603
+ await require('./lib/findings/cve-descriptions').completeCveDescriptions([...cveMatches,...retireMatches],{...options,nvd:willNvd,euvd:willEuvd,offline});
2604
+ const recordSummary = require('./lib/findings/cve-record-coverage').summarizeCveRecords([...cveMatches, ...retireMatches], {
2547
2605
  ...options, nvd:willNvd, euvd:willEuvd, offline,
2548
2606
  coverage:[...sourceConsultations,...imageState.artifacts.flatMap(a=>a.coverage||[])],
2549
2607
  });
@@ -2551,10 +2609,10 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2551
2609
  scanWarnings = scanWarnings.filter(w=>w.type!=='cve-enrichment-summary' && w.type!=='cve-record-source');
2552
2610
  if (recordSummary.warning) scanWarnings.push(recordSummary.warning);
2553
2611
  sourceConsultations.push(recordSummary.coverage);
2554
- { const split=require('./lib/diagnostics').partitionDiagnostics(scanWarnings); scanWarnings=split.warnings; scanNotices.push(...split.notices); }
2612
+ { const split=require('./lib/scan/diagnostics').partitionDiagnostics(scanWarnings); scanWarnings=split.warnings; scanNotices.push(...split.notices); }
2555
2613
  if (scanWarnings.length) {
2556
2614
  console.log();
2557
- const groupedWarnings = require('./lib/report-notices').groupReportWarnings(scanWarnings);
2615
+ const groupedWarnings = require('./lib/reports/notices').groupReportWarnings(scanWarnings);
2558
2616
  ui.warn(`${groupedWarnings.length} scan issue(s):`);
2559
2617
  for (const w of groupedWarnings) {
2560
2618
  ui.info(chalk.dim(`[${w.type}] ${w.message}`));
@@ -2574,10 +2632,10 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2574
2632
  if (willLicenses) {
2575
2633
  try {
2576
2634
  if (runMaven || runGradle) {
2577
- const { collectMavenLicenses } = require("./lib/maven-license");
2635
+ const { collectMavenLicenses } = require("./lib/codecs/maven/license");
2578
2636
  licenseFindings = licenseFindings.concat(collectMavenLicenses(resolved));
2579
2637
  }
2580
- const { assessLicenses } = require("./lib/license-policy");
2638
+ const { assessLicenses } = require("./lib/inventory/license-policy");
2581
2639
  licenseResults = assessLicenses(licenseFindings);
2582
2640
  const flaggedN = licenseResults.flagged.length;
2583
2641
  heading("Licenses", licenseResults.assessed.length, flaggedN ? chalk.yellow(`${flaggedN} to review`) : "");
@@ -2593,8 +2651,9 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2593
2651
  // with the anonymized descriptor it was fed).
2594
2652
  const srcResolved = options.src ? path.resolve(options.src) : null;
2595
2653
  const projectInfo = {
2596
- name: srcResolved ? path.basename(srcResolved) : "anonymized-descriptor",
2654
+ name: preparedSource?.name || (routedCommand?.descriptorScan ? path.basename(routedCommand.sourceInput) : srcResolved ? path.basename(srcResolved) || srcResolved : "anonymized-descriptor"),
2597
2655
  src: srcResolved || "(anonymized descriptor — source path withheld)",
2656
+ ...(preparedSource?.archive ? {sourceArchive:preparedSource.archive} : {}),
2598
2657
  generatedAt: new Date().toISOString(),
2599
2658
  toolVersion: pkg.version,
2600
2659
  cveDataDate,
@@ -2605,7 +2664,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2605
2664
  // reproducible/defensible audit. Surfaced in the report's Methodology chapter and
2606
2665
  // the JSON export's `provenance` block.
2607
2666
  try {
2608
- const { buildScanProvenance } = require("./lib/provenance");
2667
+ const { buildScanProvenance } = require("./lib/scan/provenance");
2609
2668
  projectInfo.provenance = buildScanProvenance({ toolVersion: pkg.version, generatedAt: projectInfo.generatedAt, options,
2610
2669
  ecosystems:new Set([...resolved.values()].filter(d=>d.provenance!=='binary').map(d=>d.ecosystem)) });
2611
2670
  if (sourceLimitations.length) projectInfo.provenance.sourceLimitations=sourceLimitations;
@@ -2642,11 +2701,17 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2642
2701
  let excludedDirs = [];
2643
2702
  if (options.src && (out.html || out.doc || out.xlsx || out.json)) {
2644
2703
  try {
2645
- const { collectExcludedDirs } = require("./lib/path-filter");
2704
+ const { collectExcludedDirs } = require("./lib/inventory/path-filter");
2646
2705
  excludedDirs = collectExcludedDirs({ srcRoot: options.src, excludePath, defaultExcludes });
2647
2706
  } catch { /* best effort — never block the report on the appendix walk */ }
2648
2707
  }
2649
2708
 
2709
+ if (mavenDepthLimited) scanWarnings.push(reliability.coverageWarning('The Maven dependency graph reached its configured depth limit.'));
2710
+ if (imageAcquisitionFailed) scanWarnings.push(reliability.coverageWarning('A requested image could not be acquired or assessed.'));
2711
+ for (const c of appState.coverage.filter(reliability.incompleteCheck)) {
2712
+ const reason=appState.diagnostics.find(d=>d.applicationId===c.applicationId && d.code===c.diagnostic)?.message;
2713
+ scanWarnings.push(reliability.coverageWarning(`Incomplete ${c.capability} check for ${c.applicationId} (${c.sourceId || c.diagnostic || c.execution}).${reason ? ' '+reason : ''}`));
2714
+ }
2650
2715
  const reportWarnings = [
2651
2716
  ...triageWarnings,
2652
2717
  ...sourceHealth.unreportedOutages([...enrichmentRequestKeys,...scanWarnings.flatMap(w=>w.requestKeys||[])]).map(s => ({type:"source-unavailable",count:1,
@@ -2660,39 +2725,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2660
2725
  version: e.commercialBuild.version, lastPublic: e.commercialBuild.lastPublic, until: e.extendedSupport,
2661
2726
  ...(e.dep.manifestPaths?.[0] ? { manifestPath: e.dep.manifestPaths[0] } : {}),
2662
2727
  message: `${e.dep.groupId}:${e.dep.artifactId} ${e.commercialBuild.version} is not on Maven Central and is newer than the last public ${e.product} ${e.cycle} release (${e.commercialBuild.lastPublic}): a vendor build under paid support${e.extendedSupport && e.extendedSupport !== "true" ? ` (until ${e.extendedSupport})` : ""}, not reported as end-of-life.` })),
2663
- ...appState.diagnostics.map(d => ({ type: d.sourceIds?.length ? "source-unavailable" : "cms-coverage", code: d.code,
2664
- applicationId: d.applicationId || null, ...(d.path ? { path: d.path } : {}),
2665
- message: `${d.applicationId || d.pluginId || "application"}: ${d.message}` })),
2666
- // CMS coverage gaps are grouped per (application, capability, source, diagnostic)
2667
- // cause: 14 unassessed themes are one cause with 14 components, not 14 identical
2668
- // alerts. The structured fields let the report render reason, action and the
2669
- // component list in its own language; the English message stays for JSON consumers.
2670
- ...(() => {
2671
- const componentById = new Map(appState.inventory.map(c => [c.id, c]));
2672
- const groups = new Map();
2673
- for (const c of appState.coverage) {
2674
- if (c.execution !== "partial" && c.execution !== "not-run" && c.execution !== "failed") continue;
2675
- if (appState.diagnostics.some(d => d.applicationId === c.applicationId && d.code === c.diagnostic)) continue;
2676
- const diagnostic = c.diagnostic || "CMS_INCOMPLETE";
2677
- const key = `${c.applicationId}\0${c.capability}\0${c.sourceId || ""}\0${diagnostic}`;
2678
- if (!groups.has(key)) groups.set(key, { applicationId: c.applicationId, capability: c.capability,
2679
- sourceId: c.sourceId || null, execution: c.execution, diagnostic, checks: [] });
2680
- groups.get(key).checks.push(c);
2681
- }
2682
- return [...groups.values()].map(g => {
2683
- const items = g.checks.map(c => {
2684
- const component = componentById.get(c.occurrenceId);
2685
- return { id: component ? `${component.kind || "component"} · ${component.name || component.coord || component.id}`
2686
- : c.occurrenceId || g.applicationId,
2687
- manifestPaths: component?.path ? [path.join(options.src, component.path)] : [] };
2688
- });
2689
- return { type: "cms-coverage", code: g.diagnostic, count: g.checks.length,
2690
- applicationId: g.applicationId, capability: g.capability, sourceId: g.sourceId,
2691
- execution: g.execution, diagnostic: g.diagnostic, items,
2692
- message: `${g.applicationId}: ${g.capability}${g.sourceId ? ` (${g.sourceId})` : ""} — ` +
2693
- `${g.checks.length} component(s) not evaluated (${g.diagnostic})` };
2694
- });
2695
- })(),
2728
+ ...require('./lib/scan/coverage').applicationWarnings(appState,options.src),
2696
2729
  ...(suppressedCount ? [{
2697
2730
  type: "suppressed", severity:"info",
2698
2731
  count: suppressedCount,
@@ -2705,14 +2738,16 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2705
2738
  // Maven probes for these explicitly; every other ecosystem now reports the same thing
2706
2739
  // out of its registry pass. One warning either way — an auditor wants "here is what
2707
2740
  // is internal", not one list per package manager.
2708
- const { buildPrivateItems } = require("./lib/private-deps");
2709
- const mavenItems = privateLibIds.map(id => {
2741
+ const { buildPrivateItems } = require("./lib/inventory/private-deps");
2742
+ const mavenItems = [...new Set([...privateLibIds,...absentMavenPoms])].map(id => {
2710
2743
  const dep = resolved.get(id);
2711
2744
  const paths = options.src ? (dep?.pomPaths || []).map(p => path.relative(options.src, p)) : [];
2712
2745
  return { id, ecosystem: "maven", manifestPaths: paths };
2713
2746
  });
2714
2747
  const otherItems = buildPrivateItems(registryPrivateHits, { relativise: p => options.src ? path.relative(options.src, p) : '' });
2715
- const items = [...mavenItems, ...otherItems];
2748
+ // CMS extensions follow the same rule: declared private, or unknown to the public catalogue.
2749
+ const applicationItems = require("./lib/scan/coverage").privateComponents(appState);
2750
+ const items = [...mavenItems, ...otherItems, ...applicationItems];
2716
2751
  if (!items.length) return [];
2717
2752
  const ecos = [...new Set(items.map(i => i.ecosystem))].sort().join(", ");
2718
2753
  return [{
@@ -2725,14 +2760,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2725
2760
  ];
2726
2761
  // Freshness is provenance, not a source outage. Keep the evidence in JSON
2727
2762
  // and scan context, without classifying normal provenance as failed work.
2728
- const informational=require('./lib/diagnostics').partitionDiagnostics(reportWarnings);
2763
+ const informational=require('./lib/scan/diagnostics').partitionDiagnostics(reportWarnings);
2729
2764
  if(informational.notices.length){
2730
2765
  projectInfo.provenance ||= {mode:offline?'offline':'online'};
2731
2766
  projectInfo.provenance.notices=[...(projectInfo.provenance.notices||[]),...informational.notices];
2732
2767
  reportWarnings.splice(0,reportWarnings.length,...informational.warnings);
2733
2768
  }
2734
2769
  const freshnessNotices = [];
2735
- const { freshnessNotice } = require('./lib/cve-report');
2770
+ const { freshnessNotice } = require('./lib/reports/cve-report');
2736
2771
  for (let i = reportWarnings.length - 1; i >= 0; i--) {
2737
2772
  const info = freshnessNotice(reportWarnings[i], !offline);
2738
2773
  if (info) { freshnessNotices.unshift(info); reportWarnings.splice(i, 1); }
@@ -2742,6 +2777,41 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2742
2777
  projectInfo.provenance.freshnessNotices = freshnessNotices;
2743
2778
  }
2744
2779
 
2780
+ const warmingOnly=options.importAnonymized && options.report===false && (!options.failOn || options.failOn==='none') && !options.failOnNew;
2781
+ // An incomplete scan publishes its report marked incomplete (chapter 0 lists every
2782
+ // gap, summary.scanReliable is false). It is cancelled only when nothing reliable can
2783
+ // be shown, or when --fail-on-incomplete requires the missing capability.
2784
+ const strictCapabilities = options.failOnIncomplete
2785
+ ? (options.failOnIncomplete === true ? "inventory,advisories,sources" : String(options.failOnIncomplete)).split(",").map(x => x.trim()).filter(Boolean)
2786
+ : [];
2787
+ const publication = reliability.publication(reportWarnings, { inventoryCount: resolved.size + appState.inventory.length, strict: strictCapabilities });
2788
+ if (!warmingOnly && publication.cancel) {
2789
+ console.error(reliability.cancellation(publication.reasons,options.lang));
2790
+ process.exitCode=2;
2791
+ return;
2792
+ }
2793
+ if (options.failOnIncomplete) {
2794
+ const { requiredCoverageComplete } = require("./lib/scan/coverage");
2795
+ const raw = options.failOnIncomplete === true ? "inventory,advisories,sources" : String(options.failOnIncomplete);
2796
+ const required = [...new Set(raw.split(",").map(x => x.trim()).filter(Boolean))];
2797
+ const known = new Set(["inventory", "advisories", "recipes", "sources"]);
2798
+ // Application (CMS/framework) coverage is required when an application was inventoried or
2799
+ // explicitly requested. A project without one has no application check to complete.
2800
+ const applicationCoverageRequired = appState.coverage.length > 0 || !["auto", "none"].includes(String(options.appPlugins || "auto"));
2801
+ if (!required.length || required.some(x => !known.has(x))) {
2802
+ console.error(chalk.red(`❌ invalid --fail-on-incomplete capabilities: ${raw}`));
2803
+ process.exitCode = 2;
2804
+ console.error(reliability.cancellation([],options.lang));
2805
+ return;
2806
+ } 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" || w.type === "packagist-advisory-data-unknown")))) || (applicationCoverageRequired && !requiredCoverageComplete(appState.coverage, required.filter(x => x !== "sources")))) {
2807
+ ui.section("Coverage gate");
2808
+ console.log(chalk.red(`✗ required scan checks incomplete: ${required.join(", ")}`));
2809
+ process.exitCode = 2;
2810
+ console.error(reliability.cancellation(reportWarnings.filter(w=>w.affectsCompleteness!==false),options.lang));
2811
+ return;
2812
+ }
2813
+ }
2814
+
2745
2815
  // Differential audit vs --baseline: build the current findings doc once, diff it
2746
2816
  // against the prior export → a `diff` block for the report + JSON export, and a
2747
2817
  // `--fail-on-new` gate signal. The baseline is validated before scanning.
@@ -2749,21 +2819,93 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2749
2819
  if (options.baseline) {
2750
2820
  try {
2751
2821
  const baseDoc = baselineDoc;
2752
- const { buildFindings } = require("./lib/json-export");
2822
+ const { buildFindings } = require("./lib/reports/json-export");
2753
2823
  const curDoc = buildFindings({ cveMatches, retireMatches, vendoredJsInventory, eolResults, obsoleteResults, outdatedResults, licenseResults,
2754
2824
  excludedDirs, resolvedDeps: resolved, projectInfo, toolVersion: pkg.version, typosquats,
2755
2825
  applications: appState.applications, applicationInventory: appState.inventory,
2756
2826
  applicationRelations, coverage: appState.coverage, warnings: reportWarnings });
2757
- const { diffFindings, summarizeDiff, baselineProjectWarning } = require("./lib/diff");
2827
+ const { diffFindings, summarizeDiff, baselineProjectWarning } = require("./lib/findings/diff");
2758
2828
  const warning = baselineProjectWarning(baseDoc, curDoc);
2759
2829
  if (warning) { reportWarnings.push(warning); ui.warn(warning.message); }
2760
2830
  const dd = diffFindings(baseDoc, curDoc);
2761
2831
  diff = { ...dd, summary: summarizeDiff(dd) };
2762
- jsonDiff = { summary: diff.summary, cve: { added: dd.cve.added, removed: dd.cve.removed, unassessed: dd.cve.unassessed } };
2832
+ jsonDiff = { summary: diff.summary, cve: { added: dd.cve.added, removed: dd.cve.removed, unassessed: dd.cve.unassessed, unassessedAdded: dd.cve.unassessedAdded } };
2763
2833
  } catch (err) { throw new Error(`baseline diff failed (${options.baseline}): ${err.message}`); }
2764
2834
  }
2765
2835
 
2766
2836
  const wrote = [];
2837
+ if (options.failOnNew && diff?.summary.cve.unassessedAddedProduction) {
2838
+ console.error("Cannot determine whether all current production findings are new against this baseline.");
2839
+ process.exitCode = 2;
2840
+ console.error(reliability.cancellation([],options.lang));
2841
+ return;
2842
+ }
2843
+ ui.section("Results");
2844
+
2845
+ heading("CVE · production", prodActive.length, fmtStats(stats) + (kevCount ? " " + chalk.bgRed.white(` ${kevCount} KEV `) : ""));
2846
+ for (const m of prodActive.slice(0, 12)) {
2847
+ const epss = m.cve?.epssPercentile != null ? chalk.dim(` epss ${Math.round(m.cve.epssPercentile * 100)}%`) : "";
2848
+ const kev = m.cve?.kev ? " " + chalk.bgRed.white(" KEV ") : "";
2849
+ console.log(" " + sev(m.cve.severity)((m.cve.severity || "UNKNOWN").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${depLabel(m.dep)}:${m.dep.version}`) + epss + kev);
2850
+ }
2851
+ if (prodActive.length > 12) console.log(chalk.dim(` …and ${prodActive.length - 12} more (see report)`));
2852
+ if (cpeFilteredCount) console.log(chalk.dim(` ${cpeFilteredCount} likely false positive(s) → report appendix`));
2853
+
2854
+ heading("CVE · dev", devActive.length, devActive.length ? fmtStats(devStats) : "");
2855
+
2856
+ if (embeddedActive.length) {
2857
+ heading("CVE · embedded binaries", embeddedActive.length, fmtStats(computeStats(embeddedActive)));
2858
+ for (const m of embeddedActive.slice(0, 8)) {
2859
+ const top = (m.dep.manifestPaths?.[0] || "").split("!/")[0];
2860
+ console.log(" " + sev(m.cve.severity)((m.cve.severity || "UNKNOWN").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${depLabel(m.dep)}:${m.dep.version}`) + chalk.dim(` ⊂ ${top}`));
2861
+ }
2862
+ if (embeddedActive.length > 8) console.log(chalk.dim(` …and ${embeddedActive.length - 8} more (see report ch.1B)`));
2863
+ }
2864
+
2865
+ {
2866
+ const { buildInventory } = require("./lib/inventory/unmanaged");
2867
+ const inv = buildInventory(new Map([...resolved].filter(([, dep]) => !dep.artifactTargetId)));
2868
+ if (inv.length) {
2869
+ heading("Unmanaged binaries", inv.length);
2870
+ for (const e of inv.slice(0, 10)) {
2871
+ const id = e.identity ? `${e.identity.ecosystem ? e.identity.ecosystem + ":" : ""}${e.identity.name || ""}${e.identity.version ? "@" + e.identity.version : ""}` : chalk.dim("unknown");
2872
+ const flags = [e.knownMalicious ? chalk.bgRed.white(" malicious ") : null, e.nameMismatch ? chalk.yellow("name≠checksum") : null, e.shouldBeManaged ? chalk.cyan("should-be-managed") : null, (e.noOnlineInfo ? chalk.dim("unknown") : null)].filter(Boolean).join(" ");
2873
+ console.log(" " + chalk.white(path.basename(String(e.path))) + " " + chalk.dim(id) + (flags ? " " + flags : ""));
2874
+ }
2875
+ if (inv.length > 10) console.log(chalk.dim(` …and ${inv.length - 10} more (see report ch.1C)`));
2876
+ }
2877
+ }
2878
+
2879
+ if (certFindings.length) {
2880
+ const privN = certFindings.filter(c => c.kind === "private-key").length;
2881
+ const expiredN = certFindings.filter(c => c.issues.some(i => i.type === "cert-expired")).length;
2882
+ heading("Certificates & keys", certFindings.length, [privN ? chalk.red(`${privN} private key`) : null, expiredN ? chalk.yellow(`${expiredN} expired`) : null].filter(Boolean).join(" "));
2883
+ for (const c of certFindings.slice(0, 10)) {
2884
+ const vis = c.keyVisibility ? chalk.dim(`[${c.keyVisibility}]`) : "";
2885
+ const label = c.kind === "certificate" ? `${c.subject || "?"}` : `${c.algorithm || ""} ${c.kind}`.trim();
2886
+ console.log(" " + sev(c.severity.toUpperCase())((c.severity || "?").padEnd(8)) + " " + chalk.white(path.basename(String(c.path))) + " " + vis + " " + chalk.dim(label));
2887
+ }
2888
+ if (certFindings.length > 10) console.log(chalk.dim(` …and ${certFindings.length - 10} more (see report ch.2.4)`));
2889
+ }
2890
+
2891
+ const eolDirectN = eolResults.filter(e => e.dep?.scope !== "transitive").length;
2892
+ heading("EOL frameworks", eolResults.length, eolResults.length ? chalk.dim(`${eolDirectN} direct, ${eolResults.length - eolDirectN} transitive`) : "");
2893
+ const eolWhenText = e => e.status === "unsupported" ? `support ended ${e.support}` : (e.eol === true || e.eol === "true" ? "EOL" : `EOL ${e.eol}`);
2894
+ for (const e of eolResults.slice(0, 8)) console.log(" " + chalk.yellow(e.product.padEnd(18)) + " " + chalk.dim(`${coordOf(e.dep)}:${e.dep.version}`) + " " + chalk.dim(eolWhenText(e)) + (e.components?.length > 1 ? chalk.dim(` (+${e.components.length - 1} components)`) : "") + definedInOf(e.dep));
2895
+ if (eolResults.length > 8) console.log(chalk.dim(` …and ${eolResults.length - 8} more`));
2896
+
2897
+ heading("Obsolete / deprecated", obsoleteResults.length);
2898
+ for (const o of obsoleteResults.slice(0, 8)) console.log(" " + chalk.dim(`${coordOf(o.dep)}:${o.dep.version}`) + " → " + (o.replacement || chalk.dim("n/a")) + definedInOf(o.dep));
2899
+ if (obsoleteResults.length > 8) console.log(chalk.dim(` …and ${obsoleteResults.length - 8} more`));
2900
+
2901
+ heading("Outdated", outdatedResults.length, options.allLibs ? "" : chalk.dim("pass -a/--allLibs to query registries"));
2902
+
2903
+ if (retireMatches.length) {
2904
+ heading("Vendored JS (retire.js)", retireMatches.length);
2905
+ for (const m of retireMatches.slice(0, 8)) console.log(" " + sev(m.cve.severity)((m.cve.severity || "?").padEnd(8)) + " " + chalk.white(m.cve.id) + " " + chalk.dim(`${m.dep.artifactId}@${m.dep.version}`));
2906
+ if (retireMatches.length > 8) console.log(chalk.dim(` …and ${retireMatches.length - 8} more`));
2907
+ }
2908
+
2767
2909
  let exportFailed = false;
2768
2910
  // Announce coverage gaps for every output combination, including JSON-only.
2769
2911
  warnIfDegraded(enrichmentRequestKeys);
@@ -2790,7 +2932,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2790
2932
  // the artifacts are complete; cpeFiltered is marked as a property/flag, not dropped.
2791
2933
  if (out.sbom) {
2792
2934
  try {
2793
- const { writeCycloneDx } = require("./lib/sbom-export");
2935
+ const { writeCycloneDx } = require("./lib/reports/sbom-export");
2794
2936
  await ensureDir(out.sbom);
2795
2937
  writeCycloneDx(resolved, cveMatches, out.sbom, { projectInfo, toolVersion: pkg.version, timestamp: projectInfo.generatedAt, licenseResults });
2796
2938
  wrote.push(["CycloneDX SBOM", out.sbom]);
@@ -2798,7 +2940,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2798
2940
  }
2799
2941
  if (out.csaf) {
2800
2942
  try {
2801
- const { writeCsaf } = require("./lib/csaf-export");
2943
+ const { writeCsaf } = require("./lib/reports/csaf-export");
2802
2944
  await ensureDir(out.csaf);
2803
2945
  writeCsaf(resolved, cveMatches, out.csaf, { projectInfo, toolVersion: pkg.version, timestamp: projectInfo.generatedAt });
2804
2946
  wrote.push(["CSAF 2.0 VEX", out.csaf]);
@@ -2806,7 +2948,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2806
2948
  }
2807
2949
  if (out.json) {
2808
2950
  try {
2809
- const { writeFindings } = require("./lib/json-export");
2951
+ const { writeFindings } = require("./lib/reports/json-export");
2810
2952
  await ensureDir(out.json);
2811
2953
  writeFindings({ cveMatches, retireMatches, vendoredJsInventory, certFindings, eolResults, obsoleteResults,
2812
2954
  outdatedResults, licenseResults, excludedDirs, resolvedDeps: resolved, projectInfo, toolVersion: pkg.version,
@@ -2817,7 +2959,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2817
2959
  }
2818
2960
  if (out.xlsx) {
2819
2961
  try {
2820
- const { writeXlsx } = require("./lib/xlsx-export");
2962
+ const { writeXlsx } = require("./lib/reports/xlsx-export");
2821
2963
  await ensureDir(out.xlsx);
2822
2964
  writeXlsx({ cveMatches, retireMatches, vendoredJsInventory, certFindings, eolResults, obsoleteResults,
2823
2965
  outdatedResults, licenseResults, excludedDirs, resolvedDeps: resolved, projectInfo, toolVersion: pkg.version,
@@ -2828,7 +2970,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2828
2970
  }
2829
2971
  if (out.sarif) {
2830
2972
  try {
2831
- const { writeSarif } = require("./lib/sarif-export");
2973
+ const { writeSarif } = require("./lib/reports/sarif-export");
2832
2974
  await ensureDir(out.sarif);
2833
2975
  writeSarif(cveMatches.filter(m => !m.suppressed), out.sarif, { projectInfo, toolVersion: pkg.version, certFindings });
2834
2976
  wrote.push(["SARIF", out.sarif]);
@@ -2840,7 +2982,7 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2840
2982
  // default; --no-checksums disables. Written beside the first artifact.
2841
2983
  if (wrote.length && options.checksums !== false) {
2842
2984
  try {
2843
- const { writeChecksums } = require("./lib/report-integrity");
2985
+ const { writeChecksums } = require("./lib/reports/integrity");
2844
2986
  const files = wrote.map(([, p]) => p);
2845
2987
  const manifestDir = path.dirname(path.resolve(files[0]));
2846
2988
  const manifestPath = path.join(manifestDir, "SHA256SUMS");
@@ -2869,18 +3011,21 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2869
3011
  console.log();
2870
3012
  }
2871
3013
 
3014
+ if (publication.incomplete) console.error(chalk.yellow("\n ⚠ " + reliability.incompleteNotice(publication.blockers, options.lang)));
3015
+
2872
3016
  // CI gating — set a non-zero exit code (after all reports/exports are written)
2873
3017
  // when a production finding meets the --fail-on threshold, OR (--fail-on-new) when
2874
3018
  // the scan introduces any new production CVE finding vs the --baseline.
2875
3019
  const newProd = (options.failOnNew && diff && diff.summary) ? diff.summary.cve.addedProduction : 0;
2876
- if ((options.failOn && options.failOn !== "none") || options.failOnNew) {
2877
- const { evaluateGate } = require("./lib/gate");
3020
+ // A known-malicious package always blocks, with or without --fail-on (as in system scan).
3021
+ // Cache preparation only warms the caches: it reports the package and writes its archive.
3022
+ const maliciousActive = warmingOnly ? [] : [...prodActive, ...embeddedActive].filter(m => m.malicious);
3023
+ if ((options.failOn && options.failOn !== "none") || options.failOnNew || maliciousActive.length) {
3024
+ const { evaluateGate } = require("./lib/findings/gate");
2878
3025
  // Embedded-binary findings are real production risk → gate on them too.
2879
3026
  const gate = (options.failOn && options.failOn !== "none")
2880
3027
  ? evaluateGate([...prodActive, ...embeddedActive], options.failOn)
2881
3028
  : { failed: false, reason: "" };
2882
- // A known-malicious package always blocks, regardless of the --fail-on level.
2883
- const maliciousActive = [...prodActive, ...embeddedActive].filter(m => m.malicious);
2884
3029
  if (gate.failed || maliciousActive.length || newProd > 0) {
2885
3030
  ui.section("Gate");
2886
3031
  if (maliciousActive.length) console.log(chalk.red.bold(`✗ ${maliciousActive.length} known-malicious package(s) detected — always blocks`));
@@ -2891,28 +3036,14 @@ async function runReportFlow(resolved, ecoFlags = {}) {
2891
3036
  ui.info(chalk.dim(`gate: no blocking finding`));
2892
3037
  }
2893
3038
  }
2894
- if (options.failOnIncomplete) {
2895
- const { requiredCoverageComplete } = require("./lib/scan-coverage");
2896
- const raw = options.failOnIncomplete === true ? "inventory,advisories,sources" : String(options.failOnIncomplete);
2897
- const required = [...new Set(raw.split(",").map(x => x.trim()).filter(Boolean))];
2898
- const known = new Set(["inventory", "advisories", "recipes", "sources"]);
2899
- if (!required.length || required.some(x => !known.has(x))) {
2900
- console.error(chalk.red(`❌ invalid --fail-on-incomplete capabilities: ${raw}`));
2901
- process.exitCode = 2;
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"))) {
2903
- ui.section("Coverage gate");
2904
- console.log(chalk.red(`✗ required scan checks incomplete: ${required.join(", ")}`));
2905
- process.exitCode = 2;
2906
- }
2907
- }
2908
3039
  if (exportFailed) process.exitCode = 2;
2909
3040
  return {imageReferences:imageState.references,cveIds:[...new Set(cveMatches.map(m=>m.cve?.id).filter(id=>/^CVE-\d{4}-\d{4,7}$/.test(id||'')))]};
2910
3041
  }
2911
3042
 
2912
- // mergeBySource now lives in lib/merge-sources.js (extracted to be unit-testable,
3043
+ // mergeBySource now lives in lib/findings/merge.js (extracted to be unit-testable,
2913
3044
  // and made alias-aware: the same advisory can arrive keyed by its CVE from one source
2914
3045
  // and by its GHSA remoteId from another — see that module's header).
2915
- const { mergeBySource } = require("./lib/merge-sources");
3046
+ const { mergeBySource } = require("./lib/findings/merge");
2916
3047
 
2917
3048
  } // end: regular scan / dedicated CLI commands
2918
3049
  } // end: compiled-binary retire-mode guard (see top of file)