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
@@ -1,12 +1,12 @@
1
1
  /**
2
- * lib/maven-repo.js — fan-out HTTP fetcher across the user's configured
2
+ * lib/providers/maven/repo.js — fan-out HTTP fetcher across the user's configured
3
3
  * Maven repositories with Maven Central as a final fallback.
4
4
  *
5
5
  * Use cases:
6
- * - Fetching a transitive POM (lib/transitive.js)
6
+ * - Fetching a transitive POM (lib/codecs/maven/transitive.js)
7
7
  * - Checking whether an artifact exists at all (HEAD)
8
8
  * - Reading <maven-metadata.xml> for latest-version discovery
9
- * (lib/outdated.js)
9
+ * (lib/maintenance/outdated.js)
10
10
  *
11
11
  * Repository entry shape (from ~/.fad-checker/config.json or CLI):
12
12
  * { name?, url, auth? } auth = "user:pass" (we wrap as Basic <base64>)
@@ -22,6 +22,8 @@
22
22
  * @email: pp9ping@gmail.com
23
23
  */
24
24
  const MAVEN_CENTRAL = { name: "central", url: "https://repo1.maven.org/maven2/", central: true };
25
+ // Different catalogue from Central: last-resort public repository, not a mirror.
26
+ const GOOGLE_MAVEN = { name: "google-android", url: "https://dl.google.com/dl/android/maven2/", fallback: true };
25
27
 
26
28
  /**
27
29
  * The mirrors Maven itself lists, and only those:
@@ -81,11 +83,12 @@ function hashKey(str) {
81
83
  function orderRepos(repos, key) {
82
84
  const list = repos || [];
83
85
  if (!key) return list.slice();
84
- const head = list.filter(r => !r.central);
86
+ const head = list.filter(r => !r.central && !r.fallback);
85
87
  const block = list.filter(r => r.central);
86
- if (block.length < 2) return [...head, ...block];
88
+ const tail = list.filter(r => r.fallback && !r.central);
89
+ if (block.length < 2) return [...head, ...block, ...tail];
87
90
  const off = hashKey(String(key)) % block.length;
88
- return [...head, ...block.slice(off), ...block.slice(0, off)];
91
+ return [...head, ...block.slice(off), ...block.slice(0, off), ...tail];
89
92
  }
90
93
 
91
94
  function normalise(url) {
@@ -112,7 +115,7 @@ function splitUrlAuth(url) {
112
115
 
113
116
  /**
114
117
  * Build the effective repository list: user-configured + extras (from --repo
115
- * CLI) + Maven Central as final fallback. Dedupes by URL.
118
+ * CLI), Maven Central and its mirrors, then Google Maven. Dedupes by URL.
116
119
  */
117
120
  function buildRepoList(userRepos, extraRepos = [], { mirrors = true } = {}) {
118
121
  const out = [];
@@ -123,12 +126,13 @@ function buildRepoList(userRepos, extraRepos = [], { mirrors = true } = {}) {
123
126
  if (seen.has(url)) return;
124
127
  seen.add(url);
125
128
  out.push({ name: r.name || url, url, auth: r.auth || auth || null, token: r.token || null,
126
- central: !!r.central, mirror: !!r.mirror });
129
+ central: !!r.central, mirror: !!r.mirror, ...(r.fallback ? {fallback:true} : {}) });
127
130
  };
128
131
  for (const r of userRepos || []) push(r);
129
132
  for (const r of extraRepos || []) push(r);
130
133
  push(MAVEN_CENTRAL);
131
- if (mirrors && !require('./providers').hasHostedProxy()) for (const m of DEFAULT_CENTRAL_MIRRORS) push(m);
134
+ if (mirrors && !require('..').hasHostedProxy()) for (const m of DEFAULT_CENTRAL_MIRRORS) push(m);
135
+ push(GOOGLE_MAVEN);
132
136
  return out;
133
137
  }
134
138
 
@@ -174,14 +178,23 @@ async function withDeadline(timeoutMs, fn) {
174
178
 
175
179
  async function tryRepos(repos, pathSuffix, opts = {}) {
176
180
  const { method = "GET", fetcher = globalThis.fetch, readBody = false, userAgent = "vigievuln-maven-repo", onMiss, timeoutMs = DEFAULT_TIMEOUT_MS, health = defaultRepoHealth, key = null } = opts;
177
- // Why tracked here and not by lib/source-health.js's fetch guard: these requests carry
181
+ // Why tracked here and not by lib/scan/source-health.js's fetch guard: these requests carry
178
182
  // our own AbortSignal, so the guard passes them straight through (it must not retry
179
183
  // inside our deadline, nor in front of this failover). Exhausting the rotation without
180
184
  // one host answering is the coverage hole, and only this loop knows it happened.
181
185
  const misses = [];
182
186
  let firstUrl = null;
183
- for (const repo of orderRepos(repos, key)) {
184
- if (health && health.isDown(repo.url)) continue;
187
+ const ordered = orderRepos(repos,key);
188
+ const structural = method === 'GET' && pathSuffix.endsWith('.pom');
189
+ const available = ordered.filter(repo=>!health?.isDown(repo.url));
190
+ const lastCentral = available.filter(repo=>repo.central).at(-1);
191
+ // HEAD probes can exhaust their mirror list before a required POM is read.
192
+ // Let the final structural lookup use its own retry schedule.
193
+ if (structural && !available.length && ordered.length) available.push(ordered.at(-1));
194
+ const noticeFailover = (repo, reason) => {
195
+ if (structural && repo !== available.at(-1)) require('../../ui').networkNotice(`Maven POM: ${reason}, trying the next mirror.`);
196
+ };
197
+ for (const repo of available) {
185
198
  const url = repo.url + pathSuffix.replace(/^\//, "");
186
199
  if (!firstUrl) firstUrl = url;
187
200
  const headers = { "User-Agent": userAgent };
@@ -189,16 +202,19 @@ async function tryRepos(repos, pathSuffix, opts = {}) {
189
202
  if (ah) headers.Authorization = ah;
190
203
  let r;
191
204
  try {
192
- const providers = require("./providers");
193
- const official = repo.url === MAVEN_CENTRAL.url && !repo.auth && !repo.token;
194
- const params = { path: pathSuffix.replace(/^\/+/, ""), method };
195
- if (official && providers.hasHostedProxy()) r = await providers.getResource("maven", "artifact", params, {fetcher, headers, requestTimeoutMs:timeoutMs});
205
+ const providers = require("..");
206
+ const official = [MAVEN_CENTRAL.url,GOOGLE_MAVEN.url].includes(repo.url) && !repo.auth && !repo.token;
207
+ const params = { path: pathSuffix.replace(/^\/+/, ""), method,
208
+ ...(repo.url===GOOGLE_MAVEN.url ? {repository:'google'} : {}) };
209
+ const lastPom = structural && (repo===available.at(-1) || repo===lastCentral);
210
+ if ((official && providers.hasHostedProxy()) || lastPom) r = await providers.getResource("maven", "artifact", params, {fetcher, headers, requestTimeoutMs:timeoutMs, ...(official ? {} : {urlOverride:url,direct:true})});
196
211
  else r = await withDeadline(timeoutMs, signal => providers.getResource("maven", "artifact", params,
197
212
  { fetcher, headers, signal, ...(official ? {} : { urlOverride: url, direct: true }) }));
198
213
  } catch (err) {
199
214
  // Unreachable or timed out: a mirror that does this once will do it for every
200
215
  // remaining coordinate, so take it out of the rotation for the run.
201
216
  if (health) health.markDown(repo, err.message);
217
+ noticeFailover(repo, "transport failure");
202
218
  misses.push(`network: ${err.message}`);
203
219
  if (onMiss) onMiss(repo, `network: ${err.message}`);
204
220
  continue;
@@ -212,11 +228,11 @@ async function tryRepos(repos, pathSuffix, opts = {}) {
212
228
  }
213
229
  // 404 means "this repo does not hold that artifact", which is normal and says nothing
214
230
  // about its health. Rate limiting and server errors do: stop asking this mirror.
215
- if (r.status === 429 || r.status >= 500) { if (health) health.markDown(repo, `HTTP ${r.status}`); }
231
+ if (r.status === 429 || r.status >= 500) { noticeFailover(repo, `HTTP ${r.status}`); if (health) health.markDown(repo, `HTTP ${r.status}`); }
216
232
  misses.push(`HTTP ${r.status}`);
217
233
  if (onMiss) onMiss(repo, `HTTP ${r.status}`);
218
234
  }
219
- if (firstUrl) require("./source-health").noteFanoutExhausted(firstUrl, misses);
235
+ if (firstUrl) require("../../scan/source-health").noteFanoutExhausted(firstUrl, misses);
220
236
  return null;
221
237
  }
222
238
 
@@ -236,9 +252,9 @@ async function reachableRepos(repos, opts = {}) {
236
252
  const ah = repoAuthHeader(repo);
237
253
  if (ah) headers.Authorization = ah;
238
254
  try {
239
- const providers = require("./providers");
240
- if (providers.hasHostedProxy() && repo.url === MAVEN_CENTRAL.url && !repo.auth && !repo.token)
241
- await providers.getResource("maven", "preflight", {}, {fetcher, headers, requestTimeoutMs:timeoutMs});
255
+ const providers = require("..");
256
+ if (providers.hasProxyRoute() && [MAVEN_CENTRAL.url,GOOGLE_MAVEN.url].includes(repo.url) && !repo.auth && !repo.token)
257
+ await providers.getResource("maven", "preflight", repo.url===GOOGLE_MAVEN.url ? {repository:'google'} : {}, {fetcher, headers, requestTimeoutMs:timeoutMs});
242
258
  else await withDeadline(timeoutMs, signal => providers.getResource("maven", "preflight", {},
243
259
  { fetcher, headers, signal, urlOverride: repo.url, direct: true }));
244
260
  return repo;
@@ -269,6 +285,7 @@ function fetchMavenMetadata(repos, groupId, artifactId, opts = {}) {
269
285
 
270
286
  module.exports = {
271
287
  MAVEN_CENTRAL,
288
+ GOOGLE_MAVEN,
272
289
  DEFAULT_CENTRAL_MIRRORS,
273
290
  orderRepos,
274
291
  createRepoHealth,
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+ module.exports = {id:'mit-kerberos',ttlMs:24*3600000,build(type,params={}) {
3
+ if (type !== 'announcement' || !/^\d{4}q[1-4]$/.test(params.quarter) || !/^\d{6}$/.test(params.message))
4
+ throw Error('Invalid MIT Kerberos announcement');
5
+ return {url:`https://mailman.mit.edu/pipermail/kerberos-announce/${params.quarter}/${params.message}.html`};
6
+ }};
@@ -2,8 +2,8 @@
2
2
  // Official nginx.org advisory XML; upstream version ranges apply only to
3
3
  // packages with an explicitly declared vendor identity, never generic distro builds.
4
4
  const crypto=require('node:crypto');
5
- const {createCacheRepository}=require('../cache-repository');
6
- const {getCacheDir}=require('../cache-directory');
5
+ const {createCacheRepository}=require('../../cache/repository');
6
+ const {getCacheDir}=require('../../cache/directory');
7
7
  const PARSER_VERSION=2;
8
8
  const SOURCE='nginx-vendor-advisories',URL='https://raw.githubusercontent.com/nginx/nginx.org/master/xml/en/security_advisories.xml',PAGE='https://nginx.org/en/security_advisories.html';
9
9
  function ver(s){const m=/^(\d+)\.(\d+)\.(\d+)$/.exec(String(s));return m?m.slice(1).map(Number):null;}
@@ -36,7 +36,7 @@ async function parseNginxAdvisories(input,{maxBytes=4*1024*1024}={}){
36
36
  if(!records.length)throw Error('NGINX advisory XML has no identified records');return {records,parserVersion:PARSER_VERSION,sha256:crypto.createHash('sha256').update(bytes).digest('hex')};
37
37
  }
38
38
  async function syncNginxAdvisories(options={}){
39
- if(options.offline)throw Error('cannot refresh NGINX advisories offline');const timeout=AbortSignal.timeout(options.timeoutMs??30000),signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;const res=await require('../providers').getResource('nginx','advisories',{}, {fetcher:options.fetcher,signal,streaming:true,noStore:true});if(!res.ok){await res.body?.cancel();throw Error(`NGINX advisory HTTP ${res.status}`);}let size=0,chunks=[];for await(const chunk of res.body){size+=chunk.length;if(size>(options.maxBytes??4*1024*1024))throw Error('NGINX advisory XML exceeds size limit');chunks.push(Buffer.from(chunk));}const parsed=await parseNginxAdvisories(Buffer.concat(chunks),options),now=Date.now(),stamp=Date.parse(res.headers.get('x-fad-proxy-fetched-at')||''),proxy=require('../providers').hasProxyRoute(),valid=Number.isFinite(stamp)&&stamp>0&&stamp<=now;
39
+ if(options.offline)throw Error('cannot refresh NGINX advisories offline');const timeout=AbortSignal.timeout(options.timeoutMs??30000),signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;const res=await require('..').getResource('nginx','advisories',{}, {fetcher:options.fetcher,signal,streaming:true,noStore:true});if(!res.ok){await res.body?.cancel();throw Error(`NGINX advisory HTTP ${res.status}`);}let size=0,chunks=[];for await(const chunk of res.body){size+=chunk.length;if(size>(options.maxBytes??4*1024*1024))throw Error('NGINX advisory XML exceeds size limit');chunks.push(Buffer.from(chunk));}const parsed=await parseNginxAdvisories(Buffer.concat(chunks),options),now=Date.now(),stamp=Date.parse(res.headers.get('x-fad-proxy-fetched-at')||''),proxy=require('..').hasProxyRoute(),valid=Number.isFinite(stamp)&&stamp>0&&stamp<=now;
40
40
  const snapshot={...parsed,sourceURL:URL,observedAt:proxy&&valid?stamp:now,stale:proxy&&(!valid||res.headers.get('x-fad-proxy')==='stale')};(options.cacheRepository||createCacheRepository(options.cacheDir||getCacheDir())).put('catalogue','nginx-advisories',snapshot);return snapshot;
41
41
  }
42
42
  async function assessNginxAdvisories(packages,options={}){
@@ -1,4 +1,4 @@
1
- const { requestKey } = require("./common");
1
+ const { requestKey } = require("../common");
2
2
  module.exports = {
3
3
  id: "npm", ttlMs: 24 * 3600 * 1000,
4
4
  key(type, params, scope) { return requestKey("npm", type, { name: String(params?.name || "").toLowerCase() }, scope); },
@@ -1,4 +1,4 @@
1
- const { requestKey, encodePath } = require("./common");
1
+ const { requestKey, encodePath } = require("../common");
2
2
  module.exports = {
3
3
  id: "nuget", ttlMs: 24 * 3600 * 1000,
4
4
  key(type, params, scope) { return requestKey("nuget", type,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/cpe.js — CPE 2.3 parsing + matching of NVD configuration trees.
2
+ * lib/providers/nvd/cpe.js — CPE 2.3 parsing + matching of NVD configuration trees.
3
3
  *
4
4
  * CPE 2.3 URI binding:
5
5
  * cpe:2.3:part:vendor:product:version:update:edition:language:
@@ -18,13 +18,13 @@
18
18
  * @author: N.BRAUN
19
19
  * @email: pp9ping@gmail.com
20
20
  */
21
- const { compareMavenVersions } = require("./maven-version");
21
+ const { compareMavenVersions } = require("../../codecs/maven/version");
22
22
 
23
23
  let CPE_COORD_MAP_CACHE = null;
24
24
  function loadCpeCoordMap() {
25
25
  if (CPE_COORD_MAP_CACHE) return CPE_COORD_MAP_CACHE;
26
26
  try {
27
- CPE_COORD_MAP_CACHE = require("../data/cpe-coord-map.json");
27
+ CPE_COORD_MAP_CACHE = require("../../../data/cpe-coord-map.json");
28
28
  } catch {
29
29
  CPE_COORD_MAP_CACHE = { byVendorProduct: {}, byProduct: {} };
30
30
  }
@@ -128,23 +128,9 @@ function matchVersionRange(depVersion, cpeMatch) {
128
128
  * Returns true if any vulnerable cpeMatch in the node matches the dep.
129
129
  */
130
130
  function nodeAffectsDep(node, dep, cpeCoordMap, opts = {}) {
131
- if (!node) return false;
132
- const matches = node.cpeMatch || node.cpe_match || [];
133
- for (const m of matches) {
134
- if (m.vulnerable === false) continue;
135
- const parsed = parseCpe23Cached(m);
136
- if (!parsed) continue;
137
- if (!cpeMatchesDep(parsed, dep, cpeCoordMap, opts)) continue;
138
- if (!matchVersionRange(dep.version, m)) continue;
139
- return true;
140
- }
141
- // Recurse into children (NVD nests AND/OR nodes)
142
- if (Array.isArray(node.children)) {
143
- for (const child of node.children) {
144
- if (nodeAffectsDep(child, dep, cpeCoordMap, opts)) return true;
145
- }
146
- }
147
- return false;
131
+ return evaluateProductConfiguration(node,
132
+ leaf=>cpeMatchesDep(parseCpe23Cached(leaf),dep,cpeCoordMap,opts),
133
+ leaf=>matchVersionRange(dep.version,leaf)) === true;
148
134
  }
149
135
 
150
136
  /**
@@ -163,7 +149,7 @@ function cveCpeNamesDep(cveRecord, dep, cpeCoordMap) {
163
149
  const parsed = parseCpe23Cached(m);
164
150
  if (parsed && cpeMatchesDep(parsed, dep, map)) return true;
165
151
  }
166
- if (Array.isArray(n.children) && scan(n.children)) return true;
152
+ if (scan([...(n.children || []),...(n.nodes || [])])) return true;
167
153
  }
168
154
  return false;
169
155
  };
@@ -172,21 +158,30 @@ function cveCpeNamesDep(cveRecord, dep, cpeCoordMap) {
172
158
  return false;
173
159
  }
174
160
 
175
- /**
176
- * A node is "context-only" when it carries no vulnerable cpeMatch (recursively) —
177
- * e.g. the "…AND runs on linux_kernel" platform node, whose CPEs are all
178
- * `vulnerable: false`. In an AND configuration those nodes are runtime context we
179
- * deliberately ignore (we assume the library is in use), so they must NOT be
180
- * required for the config to count as affecting the dep.
181
- */
182
- function nodeIsContextOnly(node) {
183
- if (!node) return true;
184
- const matches = node.cpeMatch || node.cpe_match || [];
185
- if (matches.some(m => m.vulnerable !== false)) return false;
186
- if (Array.isArray(node.children) && node.children.some(c => !nodeIsContextOnly(c))) return false;
187
- return true;
161
+ // Evaluate only vulnerable entries identifying the audited product. Other CPEs
162
+ // describe environmental prerequisites, assumed satisfied by scanner policy.
163
+ // A context-only OR branch cannot establish a vulnerability for the product.
164
+ function evaluateProductConfiguration(node, isProduct, versionVerdict) {
165
+ function visit(current) {
166
+ if (!current || !['OR','AND',undefined].includes(current.operator)) return null;
167
+ const values=(current.cpeMatch || current.cpe_match || [])
168
+ .filter(leaf=>leaf.vulnerable===true && isProduct(leaf))
169
+ .map(versionVerdict);
170
+ for (const child of [...(current.nodes || []),...(current.children || [])]) {
171
+ const value=visit(child);
172
+ if(value!==undefined)values.push(value);
173
+ }
174
+ if(!values.length)return undefined;
175
+ if(current.negate)return null;
176
+ return current.operator==='AND'
177
+ ? values.includes(false)?false:values.includes(null)?null:true
178
+ : values.includes(true)?true:values.includes(null)?null:false;
179
+ }
180
+ const result=visit(node);
181
+ return result===undefined?false:result;
188
182
  }
189
183
 
184
+
190
185
  /**
191
186
  * Decide whether a CPE (parsed) refers to the same artifact as a dep.
192
187
  * Lookup order:
@@ -270,21 +265,13 @@ function evaluateCveForDep(cveRecord, dep, cpeCoordMap, opts = {}) {
270
265
  for (const cfg of configs) {
271
266
  const nodes = cfg.nodes || [];
272
267
  const op = (cfg.operator || "OR").toUpperCase();
273
- let passes;
274
- if (op === "AND") {
275
- // AND configs are typically (vulnerable software) AND (platform/runtime
276
- // context). We assume the library is in use, so context-only nodes are not
277
- // required — only the vulnerable node(s) must match the dep version. Without
278
- // this, a "vulnerable:false" platform node makes .every() false and the real
279
- // finding is wrongly dropped as a CPE false-positive.
280
- const vulnNodes = nodes.filter(n => !nodeIsContextOnly(n));
281
- passes = vulnNodes.length > 0 && vulnNodes.every(n => nodeAffectsDep(n, dep, map, opts));
282
- } else {
283
- passes = nodes.some(n => nodeAffectsDep(n, dep, map, opts));
284
- }
268
+ const passes=nodeAffectsDep({...cfg,operator:op},dep,map,opts);
285
269
  if (passes) {
286
270
  // Determine confidence: scan vulnerable cpeMatches that hit
287
- for (const n of nodes) {
271
+ const pending=nodes.slice();
272
+ while(pending.length) {
273
+ const n=pending.pop();
274
+ pending.push(...(n.nodes || []),...(n.children || []));
288
275
  for (const m of n.cpeMatch || n.cpe_match || []) {
289
276
  if (m.vulnerable === false) continue;
290
277
  const parsed = parseCpe23Cached(m);
@@ -447,6 +434,7 @@ function matchDepsAgainstNvdCpe(resolvedDeps, nvdRecordsById, opts = {}) {
447
434
  }
448
435
 
449
436
  module.exports = {
437
+ evaluateProductConfiguration,
450
438
  parseCpe23,
451
439
  matchVersionRange,
452
440
  cpeMatchesDep,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/nvd.js — enrich already-found CVEs with the NIST NVD record.
2
+ * lib/providers/nvd/enrich.js — enrich already-found CVEs with the NIST NVD record.
3
3
  *
4
4
  * NVD's API doesn't expose a Maven-coord index, so we don't use it for
5
5
  * recall. Instead we look up each known CVE ID to get the canonical
@@ -17,9 +17,9 @@
17
17
  const fs = require("fs");
18
18
  const path = require("path");
19
19
  const os = require("os");
20
- const { getNvdApiKey } = require("./config");
20
+ const { getNvdApiKey } = require("../../config");
21
21
 
22
- const NVD_CACHE_DIR = path.join(require("./cache-directory").getCacheDir(), "nvd-cache");
22
+ const NVD_CACHE_DIR = path.join(require("../../cache/directory").getCacheDir(), "nvd-cache");
23
23
  const NVD_CACHE_TTL_MS = 4 * 3600 * 1000;
24
24
  // Bump whenever `extractFromNvdRecord` adds a new field — pre-bump cache
25
25
  // entries are treated as cache-miss so we re-fetch and pick up the new field.
@@ -48,12 +48,13 @@ function cachePath(cveId) {
48
48
 
49
49
  function readCache(cveId, offline = false, cacheDir = path.dirname(NVD_CACHE_DIR), options = {}) {
50
50
  try {
51
- const db=require('./cache-db').getCacheDb(cacheDir);
51
+ const db=require('../../cache/db').getCacheDb(cacheDir);
52
52
  const row=db.prepare(`SELECT kind,fetched_at,body_deflate,body_bytes,metadata_json FROM nvd_records WHERE cve=?
53
53
  ${offline ? 'ORDER BY fetched_at DESC LIMIT 1' : "AND kind='live' LIMIT 1"}`).get(cveId);
54
54
  if(!row)return null;
55
- const bytes=require('./advisory-compression').decompress(row.body_deflate,row.body_bytes);
55
+ const bytes=require('../../cache/advisory-compression').decompress(row.body_deflate,row.body_bytes);
56
56
  const body=JSON.parse(bytes.toString('utf8')),metadata=JSON.parse(row.metadata_json);
57
+ if(body?.cvssVersion==='CVSS:2.0' && Number.isFinite(body.score))body.severity=body.score>=7?'HIGH':body.score>=4?'MEDIUM':'LOW';
57
58
  // Offline (air-gapped): the warmed cache is the ONLY source — never reject it
58
59
  // for age or an older schema. Dropping it would silently lose ALL NVD
59
60
  // enrichment (CWEs, CVSS vector, references, CPE configs) for that CVE, which
@@ -63,20 +64,20 @@ function readCache(cveId, offline = false, cacheDir = path.dirname(NVD_CACHE_DIR
63
64
  if (offline) return body;
64
65
  // Schema mismatch → force re-fetch so newly-added fields (e.g. cwes) get populated.
65
66
  if ((metadata.schema || 1) < NVD_CACHE_SCHEMA) return null;
66
- const origin=require('./providers').resourceOrigin();
67
+ const origin=require('..').resourceOrigin();
67
68
  if (metadata.origin ? metadata.origin !== origin : origin !== 'direct') return null;
68
- if (!options.forceUpdate && require('./cache-policy').fresh(row.fetched_at,NVD_CACHE_TTL_MS)) return body;
69
- if (!metadata.stale && row.fetched_at > 0 && row.fetched_at <= Date.now() && require('./record-freshness').stableRecord('nvd',body,options)) return body;
69
+ if (!options.forceUpdate && require('../../cache/policy').fresh(row.fetched_at,NVD_CACHE_TTL_MS)) return body;
70
+ if (!metadata.stale && row.fetched_at > 0 && row.fetched_at <= Date.now() && require('../../cache/record-freshness').stableRecord('nvd',body,options)) return body;
70
71
  } catch { /* ignore */ }
71
72
  return null;
72
73
  }
73
74
 
74
75
  function writeCache(cveId, body, fetchedAt = Date.now(), cacheDir = path.dirname(NVD_CACHE_DIR), provenance = {}) {
75
- const db=require('./cache-db').getCacheDb(cacheDir);
76
+ const db=require('../../cache/db').getCacheDb(cacheDir);
76
77
  const bytes=Buffer.from(JSON.stringify(body));
77
78
  db.prepare(`INSERT INTO nvd_records(cve,kind,fetched_at,revision_ms,body_deflate,body_bytes,metadata_json) VALUES (?,?,?,?,?,?,?)
78
79
  ON CONFLICT(cve,kind) DO UPDATE SET fetched_at=excluded.fetched_at,revision_ms=excluded.revision_ms,
79
- body_deflate=excluded.body_deflate,body_bytes=excluded.body_bytes,metadata_json=excluded.metadata_json`).run(cveId,'live',fetchedAt,null,require('./advisory-compression').compress(bytes),bytes.length,JSON.stringify({schema:NVD_CACHE_SCHEMA,origin:require('./providers').resourceOrigin(),stale:provenance.stale === true,...(provenance.refreshFailed ? {refreshFailed:true,reason:provenance.reason || 'refresh failed'} : {})}));
80
+ body_deflate=excluded.body_deflate,body_bytes=excluded.body_bytes,metadata_json=excluded.metadata_json`).run(cveId,'live',fetchedAt,null,require('../../cache/advisory-compression').compress(bytes),bytes.length,JSON.stringify({schema:NVD_CACHE_SCHEMA,origin:require('..').resourceOrigin(),stale:provenance.stale === true,...(provenance.refreshFailed ? {refreshFailed:true,reason:provenance.reason || 'refresh failed'} : {})}));
80
81
  }
81
82
 
82
83
  function responseEvidence(response, status) {
@@ -93,9 +94,9 @@ function responseEvidence(response, status) {
93
94
  // cache entry. Keep the distinction when reporting offline coverage.
94
95
  function hasCachedAbsence(cveId, options = {}) {
95
96
  try {
96
- const db=require('./cache-db').getCacheDb(options.cacheDir || path.dirname(NVD_CACHE_DIR));
97
+ const db=require('../../cache/db').getCacheDb(options.cacheDir || path.dirname(NVD_CACHE_DIR));
97
98
  const row=db.prepare('SELECT fetched_at,body_deflate,body_bytes FROM nvd_records WHERE cve=? ORDER BY fetched_at DESC LIMIT 1').get(cveId);
98
- return !!row && row.fetched_at > 1 && row.fetched_at <= Date.now() && (options.offline || Date.now()-row.fetched_at < NVD_CACHE_TTL_MS) && JSON.parse(require('./advisory-compression').decompress(row.body_deflate,row.body_bytes).toString('utf8')) === null;
99
+ return !!row && row.fetched_at > 1 && row.fetched_at <= Date.now() && (options.offline || Date.now()-row.fetched_at < NVD_CACHE_TTL_MS) && JSON.parse(require('../../cache/advisory-compression').decompress(row.body_deflate,row.body_bytes).toString('utf8')) === null;
99
100
  } catch { return false; }
100
101
  }
101
102
 
@@ -103,13 +104,13 @@ function hasCachedAbsence(cveId, options = {}) {
103
104
  // changing whether that row is eligible for enrichment.
104
105
  function cachedEvidence(cveId, status, opts = {}) {
105
106
  try {
106
- const db = require('./cache-db').getCacheDb(opts.cacheDir || path.dirname(NVD_CACHE_DIR));
107
+ const db = require('../../cache/db').getCacheDb(opts.cacheDir || path.dirname(NVD_CACHE_DIR));
107
108
  const row = db.prepare(`SELECT fetched_at,body_deflate,body_bytes,metadata_json FROM nvd_records WHERE cve=? ${opts.offline ? 'ORDER BY fetched_at DESC LIMIT 1' : "AND kind='live' LIMIT 1"}`).get(cveId);
108
109
  if (!row) return { status, stale: false };
109
110
  const metadata = JSON.parse(row.metadata_json);
110
- const body = JSON.parse(require('./advisory-compression').decompress(row.body_deflate, row.body_bytes).toString('utf8'));
111
+ const body = JSON.parse(require('../../cache/advisory-compression').decompress(row.body_deflate, row.body_bytes).toString('utf8'));
111
112
  const ageFresh = row.fetched_at > 0 && row.fetched_at <= Date.now() && Date.now() - row.fetched_at < NVD_CACHE_TTL_MS;
112
- const stale = metadata.stale === true || (!ageFresh && !require('./record-freshness').stableRecord('nvd', body, opts));
113
+ const stale = metadata.stale === true || (!ageFresh && !require('../../cache/record-freshness').stableRecord('nvd', body, opts));
113
114
  return { status, stale, ...(stale ? { reason: metadata.reason || (opts.offline ? 'offline' : 'stale cached response') } : {}), ...(metadata.refreshFailed === true ? { refreshFailed: true } : {}) };
114
115
  } catch { return { status, stale: false }; }
115
116
  }
@@ -127,7 +128,7 @@ function bestMetric(metrics) {
127
128
  return {
128
129
  version: VER[k],
129
130
  score: cv.baseScore,
130
- severity: (cv.baseSeverity || severityFromScore(cv.baseScore) || "UNKNOWN").toUpperCase(),
131
+ severity: (cv.baseSeverity || metrics[k][0].baseSeverity || (k==='cvssMetricV2' && Number.isFinite(cv.baseScore) ? (cv.baseScore>=7?'HIGH':cv.baseScore>=4?'MEDIUM':'LOW') : severityFromScore(cv.baseScore)) || "UNKNOWN").toUpperCase(),
131
132
  vector: cv.vectorString,
132
133
  };
133
134
  }
@@ -135,14 +136,7 @@ function bestMetric(metrics) {
135
136
  return null;
136
137
  }
137
138
 
138
- function severityFromScore(s) {
139
- if (s == null) return null;
140
- if (s >= 9) return "CRITICAL";
141
- if (s >= 7) return "HIGH";
142
- if (s >= 4) return "MEDIUM";
143
- if (s > 0) return "LOW";
144
- return "NONE";
145
- }
139
+ const { severityFromScore } = require("../../findings/severity");
146
140
 
147
141
  function extractFromNvdRecord(record) {
148
142
  if (!record) return null;
@@ -224,6 +218,8 @@ function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
224
218
  const MIRROR_TIMEOUT_MS = 30000;
225
219
  const MIRROR_NAME = "fkie-cad/nvd-json-data-feeds";
226
220
  const MIRROR_CONCURRENCY = 16;
221
+ // A batch needing more than this many NVD rate windows (4 × 30 s with a key) reads the mirror first.
222
+ const LARGE_BATCH_WINDOWS = 4;
227
223
 
228
224
  /**
229
225
  * Read one CVE from the fkie-cad mirror. → { record } (already extracted + cached),
@@ -234,7 +230,7 @@ const MIRROR_CONCURRENCY = 16;
234
230
  async function fetchFromMirror(cveId, opts = {}) {
235
231
  const { fetcher = globalThis.fetch } = opts;
236
232
  try {
237
- const providers = require("./providers");
233
+ const providers = require("..");
238
234
  const m = await providers.getResource("nvd", "cve-mirror", { id: cveId },
239
235
  { fetcher, headers: { "User-Agent": "vigievuln-nvd-enrich" }, ...(providers.hasHostedProxy() ? {requestTimeoutMs:MIRROR_TIMEOUT_MS, retryProxyDenied:false, noSourceRetry:true} : {signal:AbortSignal.timeout(MIRROR_TIMEOUT_MS)}) });
240
236
  if (m.status === 404) return { absent: true };
@@ -246,7 +242,7 @@ async function fetchFromMirror(cveId, opts = {}) {
246
242
  if (!extracted) return { failed: true };
247
243
  extracted.via = MIRROR_NAME;
248
244
  const evidence = responseEvidence(m, 'available');
249
- writeCache(cveId, extracted, require('./providers/common').responseFetchedAt(m), opts.cacheDir, evidence);
245
+ writeCache(cveId, extracted, require('../common').responseFetchedAt(m), opts.cacheDir, evidence);
250
246
  return { record: extracted, evidence };
251
247
  } catch { return { failed: true }; }
252
248
  }
@@ -254,7 +250,7 @@ async function fetchFromMirror(cveId, opts = {}) {
254
250
  /**
255
251
  * One CVE's NVD record. NVD first; when NVD does not ANSWER (throttled 403/429, 5xx, no
256
252
  * transport) the same record is read from the fkie-cad git mirror, and only when both fail
257
- * is the hole reported (lib/source-health.js#noteFanoutExhausted → the run stops before
253
+ * is the hole reported (lib/scan/source-health.js#noteFanoutExhausted → the run stops before
258
254
  * writing anything). A definitive NVD 404 is an answer — the CVE is not in NVD — and is
259
255
  * never sent to the mirror.
260
256
  *
@@ -278,22 +274,22 @@ async function fetchOne(cveId, opts = {}) {
278
274
  const key = getNvdApiKey();
279
275
  if (key) headers["apiKey"] = key;
280
276
  const url = `${NVD_BASE}?cveId=${encodeURIComponent(cveId)}`;
281
- const providers = require("./providers");
282
- const health = require("./source-health");
277
+ const providers = require("..");
278
+ const health = require("../../scan/source-health");
283
279
  const deadline = () => providers.hasHostedProxy() ? {requestTimeoutMs:MIRROR_TIMEOUT_MS} : (mirror ? { signal: AbortSignal.timeout(MIRROR_TIMEOUT_MS) } : {});
284
280
 
285
281
  let nvdReason;
286
282
  try {
287
- const r = await providers.getResource("nvd", "cve", { id: cveId }, { fetcher, headers, forceRefresh:opts.forceUpdate || require("./cache-policy").shouldForceUpdate(), ...deadline() });
288
- if (r.status === 404) { const evidence = responseEvidence(r,'no-match'); writeCache(cveId, null, require('./providers/common').responseFetchedAt(r), opts.cacheDir, evidence); opts.onAbsent?.(cveId); note(evidence); return null; }
283
+ const r = await providers.getResource("nvd", "cve", { id: cveId }, { fetcher, headers, forceRefresh:opts.forceUpdate || require("../../cache/policy").shouldForceUpdate(), ...deadline() });
284
+ if (r.status === 404) { const evidence = responseEvidence(r,'no-match'); writeCache(cveId, null, require('../common').responseFetchedAt(r), opts.cacheDir, evidence); opts.onAbsent?.(cveId); note(evidence); return null; }
289
285
  if (r.ok) {
290
286
  let data;try { data=await r.json(); } catch { throw Object.assign(new Error('malformed NVD response'),{code:'NVD_INVALID_RESPONSE'}); }
291
- if (Array.isArray(data?.vulnerabilities) && data.vulnerabilities.length===0 && data.totalResults===0) {const evidence=responseEvidence(r,'no-match');writeCache(cveId,null,require('./providers/common').responseFetchedAt(r),opts.cacheDir,evidence);opts.onAbsent?.(cveId);note(evidence);return null;}
287
+ if (Array.isArray(data?.vulnerabilities) && data.vulnerabilities.length===0 && data.totalResults===0) {const evidence=responseEvidence(r,'no-match');writeCache(cveId,null,require('../common').responseFetchedAt(r),opts.cacheDir,evidence);opts.onAbsent?.(cveId);note(evidence);return null;}
292
288
  const record=Array.isArray(data?.vulnerabilities) && data.vulnerabilities.length===1 ? data.vulnerabilities[0]?.cve : null;
293
289
  if (!record || String(record.id||'').toUpperCase()!==String(cveId).toUpperCase() || (data.totalResults!==undefined && data.totalResults!==1)) throw Object.assign(new Error('malformed NVD response'),{code:'NVD_INVALID_RESPONSE'});
294
290
  let extracted;try { extracted=extractFromNvdRecord(record); } catch { throw Object.assign(new Error('malformed NVD response'),{code:'NVD_INVALID_RESPONSE'}); }
295
291
  const evidence = responseEvidence(r,'available');
296
- writeCache(cveId, extracted, require('./providers/common').responseFetchedAt(r), opts.cacheDir, evidence);
292
+ writeCache(cveId, extracted, require('../common').responseFetchedAt(r), opts.cacheDir, evidence);
297
293
  note(evidence);
298
294
  return extracted;
299
295
  }
@@ -301,7 +297,7 @@ async function fetchOne(cveId, opts = {}) {
301
297
  } catch (err) {
302
298
  nvdReason = err.code==='NVD_INVALID_RESPONSE' ? err.message : `network: ${err.message}`;
303
299
  }
304
- if (verbose) require('./ui').networkNotice(` NVD ${nvdReason} for ${cveId}`);
300
+ if (verbose) require('../../ui').networkNotice(` NVD ${nvdReason} for ${cveId}`);
305
301
  opts.onFailure?.(cveId,nvdReason);
306
302
  // A 4xx we caused (bad request…) is an answer, not an outage: nothing to fall back for.
307
303
  if (health.classifyMissReason(nvdReason) === "answered") { note({status:'unavailable',reason:nvdReason,stale:false}); return null; }
@@ -309,15 +305,15 @@ async function fetchOne(cveId, opts = {}) {
309
305
  if (mirror) {
310
306
  const got = await fetchFromMirror(cveId, { ...opts, fetcher });
311
307
  if (got.record) {
312
- if (verbose) require('./ui').networkNotice(` ${cveId} served by the NVD mirror (${MIRROR_NAME})`);
308
+ if (verbose) require('../../ui').networkNotice(` ${cveId} served by the NVD mirror (${MIRROR_NAME})`);
313
309
  note(got.evidence);
314
310
  return got.record;
315
311
  }
316
312
  }
317
- const stale = require("./providers").hasHostedProxy() ? null : readCache(cveId, true, opts.cacheDir);
313
+ const stale = require("..").hasHostedProxy() ? null : readCache(cveId, true, opts.cacheDir);
318
314
  if (stale) { note({status:'available',stale:true,refreshFailed:true,reason:nvdReason}); return stale; }
319
315
  // Neither NVD nor its mirror produced this record: a coverage hole, reported under NVD.
320
- health.noteFanoutExhausted(url, [nvdReason], {requestKey:require('./providers/common').failureKey('nvd','cve',{id:cveId})});
316
+ health.noteFanoutExhausted(url, [nvdReason], {requestKey:require('../common').failureKey('nvd','cve',{id:cveId})});
321
317
  note({status:'unavailable',reason:nvdReason,stale:false});
322
318
  return null;
323
319
  }
@@ -335,7 +331,7 @@ async function enrichMatches(matches, opts = {}) {
335
331
  for (const m of matches) if (m.cve?.id?.startsWith("CVE-")) uniqueCves.add(m.cve.id);
336
332
  // `opts.hasKey` lets a test pin the key/no-key branch whatever ~/.fad-checker holds.
337
333
  const hasKey = opts.hasKey ?? !!getNvdApiKey();
338
- const hosted = !offline && require("./providers").hasHostedProxy();
334
+ const hosted = !offline && require("..").hasHostedProxy();
339
335
  const burst = hosted ? 10 : getBurstSize();
340
336
 
341
337
  // Partition cached vs live up-front so the progress display reflects the
@@ -364,7 +360,11 @@ async function enrichMatches(matches, opts = {}) {
364
360
  // through the normal paced loop below with NVD's full retry schedule, and a source
365
361
  // that still does not answer stops the run (reliability over speed). With a key NVD
366
362
  // stays first and the mirror is its fallback (fetchOne).
367
- const mirrorFirst = !offline && !require("./providers").hasHostedProxy() && opts.mirror !== false && !hasKey && liveIds.length > 0;
363
+ // With a key NVD allows 50 requests per 30 s: fine for a project, about 100 minutes for the
364
+ // 10 000 CVEs of a system with a kernel package. Beyond a few windows of work the mirror
365
+ // goes first as well; NVD then answers only for what the mirror does not hold yet.
366
+ const largeBatch = liveIds.length > burst * LARGE_BATCH_WINDOWS;
367
+ const mirrorFirst = !offline && !require("..").hasHostedProxy() && opts.mirror !== false && (!hasKey || largeBatch) && liveIds.length > 0;
368
368
  if (mirrorFirst) {
369
369
  const pending = [...liveIds];
370
370
  const notMirrored = [];
@@ -434,6 +434,7 @@ async function enrichMatches(matches, opts = {}) {
434
434
  if (evidence) m.cve.nvdRecordEvidence = { ...evidence };
435
435
  const data = byId.get(m.cve?.id);
436
436
  if (!data) continue;
437
+ if (data.id === m.cve.id) m.cve.sourceAdvisoryId ||= data.id;
437
438
  // Merge: prefer NVD's official text + CVSS but keep what vigievuln/OSV already has
438
439
  // NVD's description is the official long form — prefer it when available.
439
440
  if (data.description) {
@@ -453,7 +454,7 @@ async function enrichMatches(matches, opts = {}) {
453
454
  if (data.cvssVersion) m.cve.cvssVersion = data.cvssVersion;
454
455
  m.cve.nvdRefs = data.references || []; // [{url, tags, source}]
455
456
  m.cve.cpes = data.cpes || [];
456
- m.cve.cwes = data.cwes || [];
457
+ m.cve.cwes = [...new Set([...(m.cve.cwes || []), ...(data.cwes || [])])];
457
458
  m.cve.configurations = data.configurations || [];
458
459
  m.cve.nvdAffected = data.affected || [];
459
460
  m.cve.nvdVulnStatus = data.vulnStatus || null;
@@ -1,14 +1,28 @@
1
- const { cveId, requestKey } = require("./common");
1
+ const { cveId, requestKey } = require("../common");
2
2
  module.exports = {
3
- id: "nvd", ttlMs: 7 * 24 * 3600 * 1000, revalidateTypes: ['cve','cve-mirror'],
4
- key(type, params, scope) { return requestKey("nvd", type, type === "spip-advisories" ? {} : { id: cveId(params?.id) }, scope); },
3
+ id: "nvd", ttlMs: 7 * 24 * 3600 * 1000, revalidateTypes: ['cve','cve-mirror','image-product'],
4
+ key(type, params, scope) {
5
+ if (type === "image-product") {
6
+ const { product, version, cpe } = params;
7
+ return requestKey("nvd", type, { product, version, cpe }, scope);
8
+ }
9
+ return requestKey("nvd", type, type === "spip-advisories" ? {} : { id: cveId(params?.id) }, scope);
10
+ },
5
11
  build(operation, params) {
12
+ if (operation === "image-product") {
13
+ const product = require("../../artifacts/product-catalog").upstreamProducts.get(params?.product);
14
+ const cpe = params?.cpe;
15
+ if (!cpe || !product || ![product.cpe, ...(product.cpeAliases || [])].includes(cpe)) throw Error("Unknown image product CPE");
16
+ if (typeof params.version !== "string" || !/^\d{1,8}(?:\.\d{1,8}){1,3}$/.test(params.version)) throw Error("Invalid image product version");
17
+ const query = new URLSearchParams({virtualMatchString: "cpe:2.3:a:" + cpe + ":" + params.version, resultsPerPage: "2000", startIndex: "0"});
18
+ return {url: "https://services.nvd.nist.gov/rest/json/cves/2.0?" + query};
19
+ }
6
20
  if (operation === "spip-advisories") return {
7
21
  url: "https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:a:spip:spip&resultsPerPage=2000&startIndex=0",
8
22
  };
9
23
  // fkie-cad/nvd-json-data-feeds: a daily git mirror of the NVD API 2.0, one file per CVE
10
24
  // holding the API's own `cve` object, bucketed by the id minus its last two digits
11
- // (CVE-2021-44228 → CVE-2021-442xx). No key, no 5-per-30s rate limit. lib/nvd.js
25
+ // (CVE-2021-44228 → CVE-2021-442xx). No key, no 5-per-30s rate limit. lib/providers/nvd/enrich.js
12
26
  // falls back to it when NVD itself does not answer.
13
27
  if (operation === "cve-mirror") {
14
28
  const id = cveId(params?.id);