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
@@ -3,11 +3,11 @@
3
3
  const fs = require('node:fs');
4
4
  const path = require('node:path');
5
5
  const crypto = require('node:crypto');
6
- const { makeDepRecord } = require('../dep-record');
6
+ const { makeDepRecord } = require('../inventory/dep-record');
7
7
  const {IMAGE_COMPONENT_SCOPE,imageComponentRole,imageComponentSource} = require('./component-scope');
8
8
  const { openArtifact } = require('./index');
9
9
  const { collectInstalledApplications } = require('./applications');
10
- const { collectSystemInventory, assessSystemInventory, syncSystemAdvisories } = require('../system-inventory');
10
+ const { collectSystemInventory } = require('../system-inventory/collect');
11
11
 
12
12
  const SNAPSHOT_SCHEMA = 'vigievuln-artifact-inventory/1';
13
13
  const sha = value => crypto.createHash('sha256').update(value).digest('hex');
@@ -22,11 +22,23 @@ function coverageRecords(values = [], targetId, capability) {
22
22
  incomplete: 'partial', unknown: 'partial', missing: 'not-run', failed: 'failed', absent: 'not-applicable' })[value.status] || 'partial';
23
23
  return { ...value, artifactTargetId: targetId, capability: value.capability || capability,
24
24
  collector: value.collector || value.source || `${capability}-${index}`, execution,
25
- result: value.result || (execution === 'not-applicable' ? 'not-applicable' : 'indeterminate') };
25
+ result: value.result || (execution === 'not-applicable' ? 'not-applicable' :
26
+ execution === 'completed' && capability === 'inventory' ? 'inventoried' : 'indeterminate') };
26
27
  });
27
28
  }
29
+ // Strip the collected root from a path. On Windows what remains is written with forward
30
+ // slashes: an inventory names paths the same way wherever it was collected.
31
+ function relativeToRoot(value, root, sep, replacement = '') {
32
+ const native = root + sep, posix = root.replace(/\\/g, '/') + '/';
33
+ if (!value.includes(native) && !value.includes(posix)) return value;
34
+ const stripped = value.split(native).join(replacement).split(posix).join(replacement);
35
+ return sep === '\\' ? stripped.replace(/\\/g, '/') : stripped;
36
+ }
28
37
  function portable(value, root, replacement = '') {
29
- if (typeof value === 'string') return value.split(root + path.sep).join(replacement).split(root.replace(/\\/g, '/') + '/').join(replacement);
38
+ // For a live filesystem root, absolute evidence paths already refer to the
39
+ // target. Replacing "//" would corrupt URLs in package metadata.
40
+ if (root === path.parse(root).root) return value;
41
+ if (typeof value === 'string') return relativeToRoot(value, root, path.sep, replacement);
30
42
  if (Array.isArray(value)) return value.map(v => portable(v, root, replacement));
31
43
  if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, portable(v, root, replacement)]));
32
44
  return value;
@@ -51,12 +63,21 @@ async function inventoryTarget(target, options = {}) {
51
63
  const system = await collectSystemInventory(target.root, options);
52
64
  const applications = await collectInstalledApplications(target.root, options);
53
65
  const imageJs = options.imageRetire ? await require('./retire').collectImageJs(target.root,options,system.packages.flatMap(p=>p.ownedPaths || [])) : null;
54
- const binaries = await require('../codecs/binary.codec').collect(target.root, { ...options, defaultExcludes: false, srcRoot: target.root });
66
+ const binaries = await require('../codecs/binary.codec').collect(target.root, { ...options, defaultExcludes: false, imageProducts:true, srcRoot: target.root });
67
+ for (const dep of binaries.deps.values()) {
68
+ const product=require('./product-catalog').binaryProduct(dep.name);
69
+ if (!['tcl','java'].includes(product?.id) || dep.binaryMetadata?.format!=='elf') continue;
70
+ const location=path.relative(target.root,dep.manifestPaths[0]);
71
+ try {
72
+ const evidence=require('./install-version').installedVersion(target.root,location,dep.binaryMetadata,product);
73
+ if (evidence) (dep.binaryMetadata.products ||= []).push(evidence);
74
+ } catch { dep.binaryMetadata.productReadError=true; }
75
+ }
55
76
  const order = (a, b) => JSON.stringify([a.ecosystem, a.manager, a.namespace, a.name, a.version, a.architecture, a.manifestPath, a.manifestPaths]).localeCompare(JSON.stringify([b.ecosystem, b.manager, b.namespace, b.name, b.version, b.architecture, b.manifestPath, b.manifestPaths]));
56
77
  const packages = portable(system.packages, target.root).map(p => ({ ...p, ...(p.ownedPaths ? { ownedPaths: [...p.ownedPaths].sort() } : {}) })).sort(order);
57
78
  const appDeps = portable([...applications.deps.values(), ...binaries.deps.values(), ...(imageJs?.deps || [])], target.root).sort(order);
58
79
  const id = target.kind === 'rootfs' && target.metadata.format === 'directory'
59
- ? `rootfs-inventory:sha256:${sha(JSON.stringify({ distribution: system.distribution, packages, deps: appDeps }))}` : target.id;
80
+ ? `rootfs-inventory:sha256:${sha(JSON.stringify({ systemSource:options.systemSource, distribution: system.distribution, packages, deps: appDeps }))}` : target.id;
60
81
  const owners = new Map();
61
82
  const pathKey = value => path.posix.normalize('/' + String(value || '').replace(/\\/g, '/').replace(/^\/+/, ''));
62
83
  for (const pkg of packages) for (const ownedPath of pkg.ownedPaths || []) {
@@ -65,38 +86,45 @@ async function inventoryTarget(target, options = {}) {
65
86
  // symlink: ownership of a link does not confer ownership of its destination.
66
87
  try {
67
88
  const root = fs.realpathSync(target.root), parent = fs.realpathSync(path.dirname(path.join(root, ownedPath.replace(/^\/+/, ''))));
68
- if (parent === root || parent.startsWith(root + path.sep)) keys.add(pathKey(path.relative(root, path.join(parent, path.basename(ownedPath)))));
89
+ if (parent === root || parent.startsWith(root.endsWith(path.sep) ? root : root + path.sep)) keys.add(pathKey(path.relative(root, path.join(parent, path.basename(ownedPath)))));
69
90
  } catch { /* Removed/unavailable owned paths do not create invented evidence. */ }
70
91
  for (const key of keys) {
71
92
  const list = owners.get(key) || [];
72
- list.push({ name: pkg.name, version: pkg.version, manager: pkg.manager, evidencePath: pkg.manifestPath });
93
+ list.push({ name: pkg.name, version: pkg.version, manager: pkg.manager, ...(pkg.architecture && {architecture:pkg.architecture}), evidencePath: pkg.manifestPath });
73
94
  owners.set(key, list);
74
95
  }
75
96
  }
76
97
  const deps = [...packages.map(p => systemDep(p, id, system.distribution)), ...appDeps.map(d => {
77
98
  const evidence = d.binaryEvidence?.binaryPath || d.installEvidence?.path || d.manifestPaths?.[0];
78
99
  // A shared aggregate manifest does not prove that every package it names is OS-owned.
79
- const aggregate = ['composer', 'composer-php', 'nuget'].includes(d.installEvidence?.source);
100
+ const aggregate = d.provenance === 'lockfile' || ['composer', 'composer-php', 'nuget'].includes(d.installEvidence?.source);
80
101
  const owned = evidence && !aggregate ? owners.get(pathKey(evidence)) : null;
81
102
  return qualify(owned?.length ? { ...d, osPackageOwners: owned } : d, id);
82
103
  })];
83
- for(const dep of deps){dep.imageRole=imageComponentRole(dep);dep.imageSource=imageComponentSource(dep);dep.scope=dep.imageRole==='transitive'?'transitive':'runtime';}
104
+ require('./image-products').applyProductVersions(deps);
105
+ for(const dep of deps){dep.imageRole=imageComponentRole(dep);dep.imageSource=imageComponentSource(dep);if(dep.provenance!=='lockfile')dep.scope=dep.imageRole==='transitive'?'transitive':'runtime';}
84
106
  const warnings = portable(normalizeWarnings([...(system.warnings || []), ...applications.warnings, ...binaries.warnings, ...(imageJs?.warnings || []),
85
107
  ...(target.metadata.warnings || [])]), target.root);
86
108
  const coverage = coverageRecords(system.coverage, id, 'inventory');
109
+ const productErrors=deps.filter(d=>d.binaryMetadata?.productReadError || d.binaryMetadata?.partial);
110
+ if(productErrors.length) {
111
+ coverage.push({artifactTargetId:id,capability:'inventory',collector:'image-product-metadata',execution:'partial',result:'indeterminate',count:productErrors.length});
112
+ warnings.push({capability:'inventory',type:'dependency-coverage',reason:'image-product-metadata-incomplete',message:'Product metadata could not be fully read in '+productErrors.length+' executable(s).'});
113
+ }
87
114
  if(imageJs)coverage.push({...imageJs.coverage,artifactTargetId:id});
88
115
  coverage.push({ artifactTargetId: id, capability: 'inventory', collector: 'installed-applications',
89
- execution: applications.warnings.length ? 'partial' : 'completed', result: 'indeterminate', count: applications.deps.size });
116
+ execution: applications.coverage.complete ? 'completed' : 'partial', result: applications.coverage.complete ? 'inventoried' : 'indeterminate', count: applications.deps.size });
90
117
  coverage.push({ artifactTargetId: id, capability: 'inventory', collector: 'native-binaries',
91
- execution: binaries.warnings.length ? 'partial' : 'completed', result: 'indeterminate', count: [...binaries.deps.values()].filter(d => d.ecosystem === 'binary').length });
118
+ execution: binaries.warnings.length ? 'partial' : 'completed', result: binaries.warnings.length ? 'indeterminate' : 'inventoried', count: [...binaries.deps.values()].filter(d => d.ecosystem === 'binary').length });
92
119
  if (target.metadata.warnings?.length) coverage.push({ artifactTargetId: id, capability: 'inventory', collector: 'artifact-reader', execution: 'partial', result: 'indeterminate' });
93
- const source = options.source || path.basename(target.metadata.source || target.root);
120
+ const originalSource = target.metadata.source || target.root;
121
+ const source = options.source || path.basename(originalSource) || originalSource;
94
122
  const acquisition = options.registry ? { kind: 'registry', reference: source } : {
95
- kind: target.metadata.format === 'directory' ? 'rootfs-directory' : target.metadata.format === 'oci-layout' && target.metadata.source && fs.statSync(target.metadata.source).isDirectory() ? 'oci-layout' : 'archive', source,
123
+ kind: target.metadata.diskFormat ? 'vm-disk' : target.metadata.format === 'directory' ? 'rootfs-directory' : target.metadata.format === 'oci-layout' && target.metadata.source && fs.statSync(target.metadata.source).isDirectory() ? 'oci-layout' : 'archive', source,
96
124
  };
97
125
  return { id, kind: target.kind, metadata: { ...target.metadata, componentScope:IMAGE_COMPONENT_SCOPE, source, acquisition, definitions: [], definitionDiscovery: {status:'not-supplied'} },
98
126
  evidence: 'content-inventory', inventoryAt: new Date().toISOString(), distribution: system.distribution,
99
- packages, deps, coverage, warnings, componentCount: deps.length };
127
+ packages, deps, coverage, warnings: require('./access-warnings').foldAccessWarnings(warnings), componentCount: deps.length };
100
128
  }
101
129
 
102
130
  function sbomTarget(input, options = {}) {
@@ -128,6 +156,28 @@ function validateSnapshot(doc) {
128
156
  for (const target of content.targets) {
129
157
  if (!target || typeof target.id !== 'string' || !target.id || targetIds.has(target.id) || !target.metadata || !Array.isArray(target.deps) || !Array.isArray(target.packages) || !Array.isArray(target.coverage) || !Array.isArray(target.warnings)) throw Error('invalid or duplicate artifact inventory target');
130
158
  targetIds.add(target.id);
159
+ const apps = target.metadata.systemApplications;
160
+ if (apps !== undefined) {
161
+ if (!Array.isArray(apps?.applications) || !Array.isArray(apps.inventory)) throw Error('invalid system application inventory');
162
+ const ids = new Set();
163
+ function checkApp(app) {
164
+ if (typeof app?.id !== 'string' || !app.id.startsWith(target.id + ':') || ids.has(app.id) ||
165
+ typeof app.root !== 'string' || !app.root || /[\\\x00]/.test(app.root) || app.root.startsWith('/') || app.root.split('/').includes('..'))
166
+ throw Error('invalid system application or root');
167
+ ids.add(app.id);
168
+ }
169
+ for (const app of apps.applications) checkApp(app);
170
+ const parents = new Set(ids);
171
+ if (apps.embeddedApplications !== undefined) {
172
+ if (!Array.isArray(apps.embeddedApplications)) throw Error('invalid embedded applications');
173
+ for (const entry of apps.embeddedApplications) {
174
+ checkApp(entry?.app);
175
+ if (!parents.has(entry.applicationId) || !Array.isArray(entry.inventory) ||
176
+ entry.inventory.some(c=>c?.applicationId!==entry.app.id)) throw Error('invalid embedded application owner');
177
+ }
178
+ }
179
+ if (apps.inventory.some(item => !parents.has(item?.applicationId))) throw Error('invalid system application component owner');
180
+ }
131
181
  for (const dep of target.deps) {
132
182
  if (typeof dep?.coordKey !== 'string' || !dep.coordKey || componentIds.has(dep.coordKey) || dep.artifactTargetId !== target.id || typeof dep.ecosystem !== 'string' || typeof dep.name !== 'string') throw Error('invalid or duplicate artifact inventory component');
133
183
  componentIds.add(dep.coordKey);
@@ -140,21 +190,40 @@ function readSnapshot(file, options = {}) {
140
190
  if (fs.statSync(file).size > (options.maxSnapshotBytes ?? 128 * 1024 * 1024)) throw Error('artifact inventory exceeds configured size limit');
141
191
  return validateSnapshot(JSON.parse(fs.readFileSync(file, 'utf8'))).map(t => ({ ...require('./inventory-scope').applyComponentScope(t), evidence: 'cached-inventory', originalEvidence: t.originalEvidence || t.evidence }));
142
192
  }
143
- async function writeSnapshot(file, targets) {
193
+ async function writeSnapshot(file, targets, {compact = false, validate = false} = {}) {
144
194
  const absolute = path.resolve(file);
195
+ const snapshot = createSnapshot(targets);
196
+ if (validate) validateSnapshot(snapshot);
145
197
  await fs.promises.mkdir(path.dirname(absolute), { recursive: true });
146
198
  const temp = absolute + '.' + crypto.randomUUID() + '.tmp';
147
- try { await fs.promises.writeFile(temp, JSON.stringify(createSnapshot(targets), null, 2) + '\n', { mode: 0o600 }); await fs.promises.rename(temp, absolute); }
199
+ try { await fs.promises.writeFile(temp, JSON.stringify(snapshot, null, compact ? undefined : 2) + '\n', { mode: 0o600 }); await fs.promises.rename(temp, absolute); }
148
200
  finally { await fs.promises.rm(temp, { force: true }); }
149
201
  }
150
202
 
151
203
  async function acquireInventories(input, options = {}) {
204
+ if(options.localDockerReference){
205
+ const local=await require('../images/local-docker').openImage(input,options.dockerSocket);
206
+ if(local){
207
+ try{
208
+ const targets=await acquireInventories(local.path,{...options,localDockerReference:null,source:input});
209
+ for(const target of targets){target.metadata.localDocker=local.metadata;target.metadata.acquisition={...target.metadata.acquisition,reference:input,kind:'docker'};}
210
+ return targets;
211
+ }finally{await local.cleanup();}
212
+ }
213
+ // Never silently: a mistyped path, or a locally built image while the Docker Engine is
214
+ // unreachable, would otherwise become a lookup of that name on a public registry.
215
+ if(!options.offline){
216
+ let where=input;try{const ref=require('../images/registry').parseReference(input);where=`${ref.registry}/${ref.repository}`;}catch{}
217
+ options.onSourceWarning?.(`${input} is not a local path and was not found in the local Docker Engine; acquiring it from ${where}.`);
218
+ }
219
+ return acquireInventories(input,{...options,localDockerReference:null,registry:true});
220
+ }
152
221
  if (options.inventory) return readSnapshot(input, options);
153
222
  if (options.sbom) return [sbomTarget(input, options)];
154
- const cache = options.registry ? require('../cache-repository').createCacheRepository(options.cacheDir) : null;
155
- const legacyCacheKey = sha(JSON.stringify([input, options.platform || null, !!options.preferSbom]));
156
- const ref = options.registry ? require('../image-registry').parseReference(input) : null;
157
- const cacheKey = ref ? sha(JSON.stringify([`${ref.registry}/${ref.repository}@${ref.reference}`, options.platform || null, !!options.preferSbom])) : legacyCacheKey;
223
+ const cache = options.registry ? require('../cache/repository').createCacheRepository(options.cacheDir) : null;
224
+ const legacyCacheKey = sha(JSON.stringify([input, options.platform || null, !!options.preferSbom,...(options.system ? [true] : [])]));
225
+ const ref = options.registry ? require('../images/registry').parseReference(input) : null;
226
+ const cacheKey = ref ? sha(JSON.stringify([`${ref.registry}/${ref.repository}@${ref.reference}`, options.platform || null, !!options.preferSbom,...(options.system ? [true] : [])])) : legacyCacheKey;
158
227
  if (options.registry && options.offline) {
159
228
  const saved = cache.get('image-inventory', cacheKey) || cache.get('image-inventory', legacyCacheKey);
160
229
  if (!saved?.value || saved.value.schema !== SNAPSHOT_SCHEMA) throw Error('image inventory is not cached; import an inventory/archive or prepare this reference online');
@@ -168,7 +237,7 @@ async function acquireInventories(input, options = {}) {
168
237
  if (cache) cache.put('image-inventory', cacheKey, createSnapshot(targets));
169
238
  return targets;
170
239
  };
171
- if (cache && !options.imageRetire && !options.forceUpdate && !require('../cache-policy').shouldForceUpdate()) {
240
+ if (cache && !options.imageRetire && !options.forceUpdate && !require('../cache/policy').shouldForceUpdate()) {
172
241
  let targets;
173
242
  try {
174
243
  const saved = cache.get('image-inventory', cacheKey) || cache.get('image-inventory', legacyCacheKey);
@@ -180,7 +249,7 @@ async function acquireInventories(input, options = {}) {
180
249
  // Older APK inventories discarded the maintainer needed to identify vendor NGINX.
181
250
  const vendorMetadataComplete=scoped?.every(t=>(t.packages||[]).every(p=>p.manager!=='apk'||p.sourceName!=='nginx'||p.packageMetadata));
182
251
  if (digest && vendorMetadataComplete && scoped.every(t => t.evidence === 'content-inventory' && t.metadata?.componentScope === require('./component-scope').IMAGE_COMPONENT_SCOPE && !t.warnings.some(w => w.reason === require('./inventory-scope').SCOPE_REASON) && t.metadata?.acquisition?.indexDigest === digest)) {
183
- const current = ref.reference.includes(':') ? ref.reference : await require('../image-registry').fetchRegistryDigest(input,
252
+ const current = ref.reference.includes(':') ? ref.reference : await require('../images/registry').fetchRegistryDigest(input,
184
253
  {...options, fetcher:options.registryFetcher || options.fetcher, limits:options.registryLimits});
185
254
  if (current === digest) return scoped.map(target => ({...target, evidence:'cached-inventory', originalEvidence:target.originalEvidence || target.evidence}));
186
255
  }
@@ -190,7 +259,7 @@ async function acquireInventories(input, options = {}) {
190
259
  if (options.registry) {
191
260
  if (options.preferSbom && !options.imageRetire) {
192
261
  try {
193
- const discovered = await require('../image-registry').fetchRegistrySboms(input, { ...options, fetcher: options.registryFetcher || options.fetcher, limits: options.registryLimits });
262
+ const discovered = await require('../images/registry').fetchRegistrySboms(input, { ...options, fetcher: options.registryFetcher || options.fetcher, limits: options.registryLimits });
194
263
  // Never drop image platforms when only a subset has publisher metadata.
195
264
  const subjects = new Set(discovered.documents.map(d => d.expectedDigest));
196
265
  if (discovered.documents.length && subjects.size >= (discovered.metadata.platforms?.length || 1)) {
@@ -211,16 +280,20 @@ async function acquireInventories(input, options = {}) {
211
280
  sbomAttempt = { status: 'fallback', reason: 'Publisher inventory could not be validated; full image content was requested.' };
212
281
  }
213
282
  }
214
- registry = await require('../image-registry').fetchRegistryImage(input, { ...options, fetcher: options.registryFetcher || options.fetcher, limits: options.registryLimits });
283
+ registry = await require('../images/registry').fetchRegistryImage(input, { ...options, fetcher: options.registryFetcher || options.fetcher, limits: options.registryLimits });
215
284
  }
216
- opened = await openArtifact(registry?.path || input, { ...options, limits: options.artifactLimits });
285
+ const source=registry?.path || input;
286
+ const disk=require('./disk');
287
+ opened=options.system && !registry && fs.statSync(source).isFile() && disk.isDisk(source) ? await disk.openDisk(source,options)
288
+ : await openArtifact(source, { ...options, limits: options.artifactLimits });
217
289
  const targets = [];
218
290
  for (const target of opened.targets) {
219
291
  if (options.platform) {
220
292
  const platform = target.metadata.platform;
221
293
  if (!platform || [platform.os, platform.architecture, platform.variant].filter(Boolean).join('/') !== options.platform && [platform.os, platform.architecture].join('/') !== options.platform) continue;
222
294
  }
223
- const inventory = await inventoryTarget(target, { ...options, source: registry ? input : undefined });
295
+ const collect=options.system?require('../cli-collect').collectSystemTarget:inventoryTarget;
296
+ const inventory = await collect(target, { ...options, source: registry ? input : options.source });
224
297
  if (registry) { inventory.metadata.registryEvidence = registry.metadata; inventory.metadata.acquisition.resolvedDigest = inventory.metadata.digest || null; inventory.metadata.acquisition.indexDigest = registry.metadata.digest; }
225
298
  if (sbomAttempt) inventory.metadata.publisherInventory = sbomAttempt;
226
299
  targets.push(inventory);
@@ -231,8 +304,17 @@ async function acquireInventories(input, options = {}) {
231
304
  }
232
305
 
233
306
  async function assessInventories(targets, options = {}) {
307
+ const { assessSystemInventory, syncSystemAdvisories } = require('../system-inventory');
234
308
  options.onArtifactProgress?.({stage:'Component identities'});
235
309
  targets=targets.map(target=>require('./inventory-scope').applyComponentScope(target,{checkPolicy:false}));
310
+ // The RPM database lists each imported signing key as a "gpg-pubkey" entry (version = key
311
+ // id). It is not software: no advisory can exist for it, and none is expected.
312
+ for(const target of targets){
313
+ const keys=target.packages.filter(p=>p.manager==='rpm' && p.name==='gpg-pubkey');
314
+ if(!keys.length)continue;
315
+ target.packages=target.packages.filter(p=>!keys.includes(p));
316
+ target.metadata={...target.metadata,rpmSigningKeys:keys.map(p=>({id:p.version,release:p.release??null}))};
317
+ }
236
318
  for(const target of targets){
237
319
  for(const pkg of target.packages){const origin=require('../system-inventory/distribution-sources').identifyPackageOrigin(pkg,options);if(origin)pkg.packageOrigin=origin;}
238
320
  for(const dep of target.deps){const origin=require('../system-inventory/distribution-sources').identifyPackageOrigin(dep,options);if(origin)dep.packageOrigin=origin;}
@@ -240,37 +322,78 @@ async function assessInventories(targets, options = {}) {
240
322
  for(const dep of identity.deps){const qualified=qualify({...dep,imageRole:'direct',scope:'runtime'},target.id);if(!target.deps.some(d=>d.coordKey===qualified.coordKey))target.deps.push(qualified);}
241
323
  target.coverage.push({...identity.coverage,artifactTargetId:target.id,capability:'inventory'});
242
324
  target.warnings.push(...identity.warnings);
325
+ // A Go binary built from a checkout names its main module "(devel)". Without verified
326
+ // version evidence the application's own advisories cannot be assessed: say so.
327
+ const identifiedBinaries=new Set(identity.deps.map(d=>d.binaryEvidence?.binaryPath));
328
+ const unversioned=target.deps.filter(d=>d.ecosystem==='binary' && !identifiedBinaries.has(d.artifactPath||d.manifestPaths?.[0])).map(d=>{
329
+ const main=(d.binaryMetadata?.go?.modules||[]).filter(m=>m.kind==='mod');
330
+ return main.length===1 && main[0].version==='(devel)' && main[0].path ? `${main[0].path} (${d.artifactPath||d.manifestPaths?.[0]})` : null;
331
+ }).filter(Boolean);
332
+ if(unversioned.length)target.warnings.push({type:'dependency-coverage',severity:'info',capability:'advisories',reason:'go-main-module-unversioned',count:unversioned.length,
333
+ items:unversioned.map(id=>({id})),message:`${unversioned.length} Go application module(s) carry no verifiable version: advisories for the application itself were not assessed; its embedded dependencies were.`});
243
334
  }
244
335
  const resolvedDeps = new Map(), cveMatches = [], warnings = [], artifacts = [], warmed = new Set();
245
336
  const nativeDeps=new Map();
246
- for(const target of targets)for(const dep of target.deps||[])if(dep.ecosystem!=='binary' && dep.installEvidence?.source!=='retire' && (!dep.osPackageOwners?.length || dep.binaryEvidence))nativeDeps.set(dep.coordKey,dep);
337
+ for(const target of targets)for(const dep of target.deps||[])if(dep.ecosystem!=='binary' && dep.ecosystem!=='image-product' && dep.installEvidence?.source!=='retire' && (!dep.osPackageOwners?.length || dep.binaryEvidence))nativeDeps.set(dep.coordKey,dep);
247
338
  let native={matches:[],unknown:[],coverage:{status:'not-applicable'}},nativePreparation={sources:[],coverage:[],warnings:[]};
248
339
  if(nativeDeps.size){
249
340
  const nativeOptions={...options};
250
341
  try{
251
342
  options.onArtifactProgress?.({stage:'Native advisory preparation'});
252
- nativePreparation=await require('../native-source-prepare').prepareNativeSources(nativeDeps,nativeOptions);
343
+ nativePreparation=await require('../advisories/native-source-prepare').prepareNativeSources(nativeDeps,nativeOptions);
253
344
  if(nativePreparation.sources.length){
254
- const store=require('../advisory-store').openAdvisoryStore({cacheDir:options.cacheDir});
345
+ const store=require('../advisories/store').openAdvisoryStore({cacheDir:options.cacheDir});
255
346
  options.onArtifactProgress?.({stage:'Native advisory matching'});
256
- try{native=require('../native-advisories').matchNativePackages(nativeDeps,store,{sources:nativePreparation.sources});}finally{store.close();}
347
+ try{native=require('../advisories/native').matchNativePackages(nativeDeps,store,{sources:nativePreparation.sources});}finally{store.close();}
257
348
  }
258
- }catch(error){nativePreparation.warnings.push(`Native advisory scan failed: ${error.message}`);native.coverage={status:'incomplete',reason:error.message};}
349
+ }catch(error){nativePreparation.warnings.push(`Native advisory scan failed: ${error.message}`);native.coverage={status:'failed',reason:error.message};}
259
350
  }
260
351
  for (const original of targets) {
261
352
  const target = JSON.parse(JSON.stringify(original));
262
353
  let targetWarnings = normalizeWarnings(target.warnings);
354
+ if (target.metadata.systemApplications && target.metadata.inspectLocalImages === false)
355
+ targetWarnings = targetWarnings.filter(w=>w.reason!=='image-reference-parse-error');
356
+ const reliability=require('../scan/reliability');
357
+ const discoveryCoverage=reliability.createDiscoveryCoverage();
263
358
  const assessedPackages = new Set();
264
- const coverage = [...target.coverage];
359
+ let distributionState = options.osv===false ? 'disabled' : undefined;
360
+ // The auditor evaluates lifecycle through system maintenance. An unsupported
361
+ // lifecycle hook in an inventory plugin is not a second requested lookup.
362
+ const coverage = target.metadata.systemApplications
363
+ ? target.coverage.filter(c=>c.diagnostic!=='CMS_LIFECYCLE_NOT_QUALIFIED')
364
+ : [...target.coverage];
365
+ if (options.publisherAdvisories !== false && target.metadata.systemApplications?.applications.some(app => app.pluginId)) {
366
+ const assessed = await require('../applications/plugins/runner').runApplicationPlugins(null, {
367
+ savedInventory:target.metadata.systemApplications, scanContext:'installation', offline:!!options.offline, fetchImpl:options.fetcher,
368
+ plugins:require('../applications/plugins').allApplicationPlugins(),
369
+ advisoryCacheDir:path.join(options.cacheDir || require('../cache/directory').getCacheDir(),'advisory-snapshots'),
370
+ wordfenceFeedPath:options.wordfenceFeed, drupalAdvisoriesPath:options.drupalAdvisories,
371
+ prestashopAdvisoriesPath:options.prestashopAdvisories, typo3AdvisoriesPath:options.typo3Advisories,
372
+ spipAdvisoriesPath:options.spipAdvisories,
373
+ });
374
+ for (const match of assessed.findings) {
375
+ const dep = qualify({...match.dep,systemSection:'project',systemApplicationIds:match.applicationIds,coordKey:JSON.stringify([match.dep.coordKey,match.ownerComponentIds])},target.id);
376
+ cveMatches.push({...match,dep});
377
+ }
378
+ coverage.push(...assessed.coverage.map(c=>({...c,collector:c.sourceId || 'system-applications',artifactTargetId:target.id})));
379
+ targetWarnings.push(...require('../scan/coverage').applicationWarnings({
380
+ diagnostics:assessed.diagnostics, inventory:target.metadata.systemApplications.inventory,
381
+ coverage:coverage.filter(c=>c.applicationId),
382
+ }));
383
+ }
265
384
  options.onArtifactProgress?.({stage:'Distribution advisories'});
266
385
  const distroKey = JSON.stringify(target.distribution);
267
- if (options.osv !== false && !options.offline && target.packages.length && !warmed.has(distroKey) && !require('../providers').hasHostedProxy()) {
386
+ const advisoryScope = target.packages.length && options.osv !== false ? require('../system-inventory').scope(target.distribution,options) : null;
387
+ // A scope made of several ecosystems, or fed by a security database, has no per-package
388
+ // query: its advisories are always taken in bulk, hosted service or not.
389
+ const bulkOnly = !!(advisoryScope?.accepts || advisoryScope?.secdb);
390
+ if (options.osv !== false && !options.offline && target.packages.length && !warmed.has(distroKey) && (bulkOnly || !require('../providers').hasHostedProxy())) {
268
391
  warmed.add(distroKey);
269
392
  try {
270
393
  const scope=require('../system-inventory').scope(target.distribution,options);
271
- const cached=scope && require('../cache-repository').createCacheRepository(options.cacheDir).getSnapshot('system-osv:'+scope.ecosystem);
394
+ const cached=scope && require('../cache/repository').createCacheRepository(options.cacheDir).getSnapshot('system-osv:'+scope.ecosystem);
272
395
  const age=Date.now()-(cached?.fetchedAt||0);
273
- if(options.refresh || !cached?.complete || cached.stale || age<0 || age>=require('../cache-policy').DEFAULT_TTL_MS)
396
+ if(options.refresh || !cached?.complete || cached.stale || age<0 || age>=require('../cache/policy').DEFAULT_TTL_MS)
274
397
  await syncSystemAdvisories(target.distribution, options);
275
398
  }
276
399
  catch (error) { targetWarnings.push({ type: 'source-unavailable', capability: 'sources', message: `System advisory refresh failed: ${error.message}` }); }
@@ -282,26 +405,38 @@ async function assessInventories(targets, options = {}) {
282
405
  }
283
406
  for(const warning of nativePreparation.warnings)targetWarnings.push(typeof warning==='string'?{type:'source-unavailable',capability:'sources',message:warning}:{capability:'sources',...warning});
284
407
  const nativeUnknown=native.unknown.filter(item=>!item.artifactTargetId||item.artifactTargetId===target.id);
285
- if(nativeUnknown.length){coverage.push({artifactTargetId:target.id,capability:'sources',collector:'native-comparisons',execution:'completed',result:'indeterminate',affectsCompleteness:false,affectsAssessment:true,count:nativeUnknown.length});targetWarnings.push({...require('../diagnostics').advisoryEvidenceDiagnostic(nativeUnknown),capability:'sources'});}
408
+ if(nativeUnknown.length){coverage.push({artifactTargetId:target.id,capability:'sources',collector:'native-comparisons',execution:'completed',result:'indeterminate',affectsCompleteness:false,affectsAssessment:true,count:nativeUnknown.length});targetWarnings.push({...require('../scan/diagnostics').advisoryEvidenceDiagnostic(nativeUnknown),capability:'sources'});}
286
409
  if (target.packages.length && options.osv === false) {
287
410
  coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'system-osv', execution: 'not-applicable', result: 'not-consulted', expected:false, reason: 'OSV is excluded by source configuration.' });
288
411
  } else if (target.packages.length) {
289
412
  const systemInventory = { distribution: target.distribution, packages: target.packages.filter(p=>!['third-party','ambiguous'].includes(p.packageOrigin?.status)) };
290
413
  const excluded=target.packages.length-systemInventory.packages.length;
291
414
  if(excluded){const reason='Distribution OSV ranges do not establish applicability for packages declaring another vendor.';coverage.push({artifactTargetId:target.id,capability:'advisories',collector:'system-osv-vendor-scope',execution:'partial',result:'indeterminate',count:excluded,reason});targetWarnings.push({type:'dependency-coverage',severity:'info',capability:'advisories',message:reason});}
292
- const hostedOnline = !options.offline && require('../providers').hasHostedProxy();
415
+ const hostedOnline = !options.offline && require('../providers').hasHostedProxy() && !bulkOnly;
293
416
  let assessment;
294
417
  try {
295
418
  assessment = hostedOnline ? await require('../system-inventory').assessTargetedSystemInventory(systemInventory, options)
296
419
  : await assessSystemInventory(systemInventory, options);
297
- if (options.offline && assessment.coverage.some(c => c.status === 'missing')) {
298
- const targeted = await require('../system-inventory').assessTargetedSystemInventory(systemInventory, options);
299
- if (targeted.coverage.some(c => c.consulted > c.unknown)) assessment = targeted;
420
+ if (!hostedOnline && assessment.coverage.some(c => c.status !== 'complete')) {
421
+ // Ask OSV for the exact installed versions when the bulk ranges cannot
422
+ // establish them. Offline runs can replay those verified consultations.
423
+ const targeted = bulkOnly ? {assessedPackages:[],coverage:[]} : await require('../system-inventory').assessTargetedSystemInventory(systemInventory, options);
424
+ if (targeted.assessedPackages?.length === systemInventory.packages.length ||
425
+ (options.offline && assessment.coverage.some(c=>c.status==='missing') && targeted.coverage.some(c=>c.consulted>c.unknown)))
426
+ assessment = targeted;
300
427
  }
301
428
  } catch(error) {
302
429
  assessment={matches:[],coverage:[{source:'system-osv',status:'incomplete',reason:error.message}],warnings:[`System OSV assessment failed: ${error.message}`]};
303
430
  }
304
- if (assessment.coverage.length && assessment.coverage.every(c=>c.status==='complete')) for(const pkg of systemInventory.packages) assessedPackages.add(`${pkg.manager}:${pkg.name}@${pkg.version}`);
431
+ if(options.offline && assessment.coverage.some(c=>c.status==='missing'))distributionState='distribution-cache-missing';
432
+ // A comparison that failed for one package says nothing about other packages.
433
+ const verified = new Set(assessment.assessedPackages || []);
434
+ const keyOf = p=>`${p.manager}:${p.name}@${p.version}`;
435
+ const unchecked = new Set(systemInventory.packages.filter(p=>!verified.has(p)).map(keyOf));
436
+ for(const pkg of verified)if(!unchecked.has(keyOf(pkg))){
437
+ assessedPackages.add(keyOf(pkg));
438
+ discoveryCoverage.consulted(systemDep(pkg,target.id,target.distribution),'osv');
439
+ }
305
440
  coverage.push(...coverageRecords(assessment.coverage, target.id, 'advisories'));
306
441
  targetWarnings.push(...normalizeWarnings(assessment.warnings, 'advisories'));
307
442
  for (const match of assessment.matches) {
@@ -314,42 +449,85 @@ async function assessInventories(targets, options = {}) {
314
449
  }
315
450
  }
316
451
  options.onArtifactProgress?.({stage:'Distribution security trackers'});
317
- const distribution=await require('../system-inventory/distribution-sources').assessDistributionSources({distribution:target.distribution,packages:target.packages},{...options,confirmedMatches:[...cveMatches,...native.matches].filter(m=>m.dep?.artifactTargetId===target.id)});
452
+ const distribution=await require('../system-inventory/distribution-sources').assessDistributionSources({distribution:target.distribution,packages:target.packages},{...options,
453
+ onPackageConsulted:(pkg,source)=>discoveryCoverage.consulted(systemDep(pkg,target.id,target.distribution),source),confirmedMatches:[...cveMatches,...native.matches].filter(m=>m.dep?.artifactTargetId===target.id)});
318
454
  coverage.push(...coverageRecords(distribution.coverage,target.id,'advisories'));
319
455
  targetWarnings.push(...normalizeWarnings(distribution.warnings,'advisories'));
456
+ // A known limit of the source, stated in the report rather than left to be guessed: errata
457
+ // describe fixes. It does not apply when a source of unfixed vulnerabilities answered.
458
+ const unfixedCovered = distribution.coverage.some(c => c.source === 'redhat-oval' && c.execution === 'completed');
459
+ if (advisoryScope?.fixedOnly && !unfixedCovered) targetWarnings.push({type:'dependency-coverage',severity:'info',capability:'advisories',reason:'distribution-fixed-advisories-only',
460
+ message:`${target.distribution.name || advisoryScope.base}: its packages are assessed against the distribution's published errata. A vulnerability the distribution has not fixed yet has no erratum and is not listed.`});
320
461
  for(const match of distribution.matches){const dep=systemDep(match.dep,target.id,target.distribution);cveMatches.push({...match,dep:resolvedDeps.get(dep.coordKey)||dep});}
321
462
  const imageJsAssessment=await require('./retire').assessImageJs(target,options);
322
- cveMatches.push(...imageJsAssessment.matches);
463
+ for(const item of imageJsAssessment.matches)cveMatches.push(item);
323
464
  coverage.push(imageJsAssessment.coverage);
324
465
  targetWarnings.push(...imageJsAssessment.warnings);
325
466
  options.onArtifactProgress?.({stage:'Application advisories'});
326
- const appDeps = new Map(target.deps.filter(d => d.ecosystem !== 'system' && d.ecosystem !== 'binary' && d.installEvidence?.source !== 'retire' && (!d.osPackageOwners?.length || !!d.binaryEvidence)).map(d => [d.coordKey, d]));
327
- if (appDeps.size && options.osv === false) {
467
+ const appDeps = new Map(target.deps.filter(d => d.registryIdentity !== 'cms-theme' && d.ecosystem !== 'system' && d.ecosystem !== 'binary' && d.ecosystem !== 'image-product' && d.installEvidence?.source !== 'retire' && (!d.osPackageOwners?.length || !!d.binaryEvidence)).map(d => [d.coordKey, d]));
468
+ // Distribution headers/metadata identify the upstream release, but downstream
469
+ // fixes can be backported. Keep these comparisons as evidence to investigate.
470
+ const owned = new Map(target.metadata.systemApplications ? target.deps.filter(d =>
471
+ d.osPackageOwners?.length && !d.binaryEvidence && d.provenance === 'installed' &&
472
+ ['ruby','pypi','npm','composer'].includes(d.ecosystem) && d.installEvidence && d.version
473
+ ).map(d => [d.coordKey,d]) : []);
474
+ const osvDeps = new Map([...appDeps, ...owned]);
475
+ if (osvDeps.size && options.osv === false) {
328
476
  coverage.push({ artifactTargetId: target.id, capability:'advisories',collector:'osv-application',execution:'not-applicable',result:'not-consulted',expected:false,reason:'OSV is excluded by source configuration.' });
329
- } else if (appDeps.size) {
477
+ } else if (osvDeps.size) {
330
478
  const appWarnings = [];
331
479
  try {
332
- const matches = await require('../osv').queryOsvForDeps(appDeps, { ...options, allowStaleFallback: true,
480
+ const matches = await require('../providers/osv/query').queryOsvForDeps(osvDeps, { ...options, allowStaleFallback: true, onConsulted:discoveryCoverage.consulted,
333
481
  onWarning: warning => appWarnings.push(typeof warning === 'string' ? { type: 'osv-coverage', message: warning } : warning) });
334
- cveMatches.push(...matches);
335
- const incomplete=appWarnings.some(w=>!require('../diagnostics').isInformational(w));
482
+ const upstream = matches.filter(m=>owned.has(m.dep.coordKey));
483
+ const findings = matches.filter(m=>!owned.has(m.dep.coordKey));
484
+ for(const item of require('./applications').upstreamPackageObservations(
485
+ upstream, [...cveMatches,...native.matches].filter(m=>m.dep?.artifactTargetId===target.id), distribution.observations
486
+ ))distribution.observations.push(item);
487
+ for(const item of findings)cveMatches.push(item);
488
+ const incomplete=appWarnings.some(w=>!require('../scan/diagnostics').isInformational(w));
336
489
  coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'osv-application',
337
- execution: incomplete ? 'partial' : 'completed', result: matches.length ? 'affected' : incomplete ? 'indeterminate' : 'no-match', count: appDeps.size });
490
+ execution: incomplete ? 'partial' : 'completed', result: findings.length ? 'affected' : incomplete || upstream.length ? 'indeterminate' : 'no-match', count: osvDeps.size });
338
491
  } catch (error) {
339
492
  appWarnings.push({ type: 'source-unavailable', message: `Application advisory scan failed: ${error.message}` });
340
493
  coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'osv-application', execution: 'failed', result: 'indeterminate' });
341
494
  }
342
495
  targetWarnings.push(...normalizeWarnings(appWarnings, 'advisories'));
343
496
  }
497
+ // Gems installed by an application, not by the distribution: the Ruby advisory database
498
+ // records advisories OSV does not carry for RubyGems (lib/providers/rubysec).
499
+ const gems = new Map([...appDeps].filter(([, dep]) => dep.ecosystem === 'ruby'));
500
+ if (gems.size && options.rubyAdvisories !== false) {
501
+ try {
502
+ const found = await require('../providers/rubysec/advisories').queryRubyAdvisories(gems, { cacheDir: options.cacheDir, offline: options.offline,
503
+ fetcher: options.fetcher, forceUpdate: options.forceUpdate, onConsulted: discoveryCoverage.consulted, onWarning: warning => targetWarnings.push({ ...warning, capability: 'advisories' }) });
504
+ for (const item of found) cveMatches.push(item);
505
+ coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'rubysec', execution: 'completed', result: found.length ? 'affected' : 'no-match', count: gems.size });
506
+ } catch (error) {
507
+ coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'rubysec', execution: 'failed', result: 'indeterminate', reason: error.message });
508
+ targetWarnings.push({ type: 'source-unavailable', capability: 'advisories', source: 'rubysec', message: `Ruby advisory database: ${error.message}` });
509
+ }
510
+ }
344
511
  options.onArtifactProgress?.({stage:'Publisher advisories'});
345
- const publisher=await require('./publisher-advisories').assessPublisherAdvisories(appDeps,options);
346
- cveMatches.push(...publisher.matches);
512
+ const publisher=await require('./publisher-advisories').assessPublisherAdvisories(appDeps,{...options,onPackageConsulted:discoveryCoverage.consulted});
513
+ for(const item of publisher.matches)cveMatches.push(item);
347
514
  coverage.push(...coverageRecords(publisher.coverage,target.id,'advisories'));
348
515
  targetWarnings.push(...normalizeWarnings(publisher.warnings,'advisories'));
349
- const identifiedBinaryPaths=new Set(target.deps.filter(d=>d.binaryEvidence?.source==='go-vcs-and-module-proxy').map(d=>d.binaryEvidence.binaryPath));
516
+ const products=await require('./product-advisories').assessProductAdvisories(target,options);
517
+ for(const match of products.matches)if(!resolvedDeps.has(match.dep.coordKey))resolvedDeps.set(match.dep.coordKey,match.dep);
518
+ for(const item of products.matches)cveMatches.push(item);
519
+ const conditions = products.coverage.flatMap(check => (check.undecidableIds || []).map(id => ({
520
+ id, package: check.product, version: check.version, reason: check.reason
521
+ })));
522
+ if (conditions.length) targetWarnings.push({
523
+ ...require('../scan/diagnostics').advisoryEvidenceDiagnostic(conditions), capability: 'advisories'
524
+ });
525
+ coverage.push(...coverageRecords(products.coverage,target.id,'advisories'));
526
+ const productInventory=require('./image-products').productCoverage(target,products.coverage,assessedPackages,[...cveMatches,...native.matches],distributionState);
527
+ const identifiedBinaryPaths=new Set(target.deps.filter(d=>(d.ecosystem==='binary' && d.binaryEvidence?.product && d.version) || d.binaryEvidence?.source==='go-vcs-and-module-proxy').map(d=>d.binaryEvidence.binaryPath));
350
528
  const unknownBinaries = target.deps.filter(d => d.ecosystem === 'binary' && !d.osPackageOwners?.length && !identifiedBinaryPaths.has(d.artifactPath));
351
529
  if (unknownBinaries.length) {
352
- coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'native-binaries', execution: 'partial', result: 'indeterminate', count: unknownBinaries.length, reason: 'Native binary identities cannot all be established from embedded metadata.' });
530
+ coverage.push({ artifactTargetId: target.id, capability: 'advisories', collector: 'native-binaries', execution: 'not-applicable', result: 'indeterminate', affectsCompleteness:false, count: unknownBinaries.length, reason: 'These files expose no supported package/version identity for advisory queries.' });
353
531
  targetWarnings.push({ type: 'dependency-coverage', severity:'info', capability: 'advisories', message: `${unknownBinaries.length} native binaries have no authenticated package/version identity.` });
354
532
  }
355
533
  const archiveContext=require('./applications').classifyOwnedArchiveWarnings(targetWarnings,target.packages,assessedPackages);
@@ -357,7 +535,7 @@ async function assessInventories(targets, options = {}) {
357
535
  targetWarnings=archiveContext.warnings;
358
536
  // Reclassify the collector only when none of its original inventory
359
537
  // diagnostics remain; never hide malformed archives or unresolved files.
360
- if(!targetWarnings.some(w=>w.capability==='inventory' && !require('../diagnostics').isInformational(w)))
538
+ if(!targetWarnings.some(w=>w.capability==='inventory' && !require('../scan/diagnostics').isInformational(w)))
361
539
  for(const check of coverage)if(check.collector==='installed-applications' && check.execution==='partial')check.execution='completed';
362
540
  targetWarnings.push(...archiveContext.informational.map(({warning,owner,path})=>({...warning,severity:'info',type:'os-owned-component',owner,
363
541
  message:`${path} is covered by its installed OS package ${owner.name}@${owner.version}; no independent Maven identity is declared.`})));
@@ -365,26 +543,63 @@ async function assessInventories(targets, options = {}) {
365
543
  for (const check of coverage) {
366
544
  if (check.affectsCompleteness === false || ['completed', 'not-applicable'].includes(check.execution)) continue;
367
545
  if (check.collector==='native-binaries' || check.collector==='native-comparisons' || check.collector==='go-main-identity' || check.collector==='system-osv-vendor-scope' || check.issue==='missing-source') continue;
368
- if (targetWarnings.some(w => w.capability === check.capability && !require('../diagnostics').isInformational(w))) continue;
546
+ if (targetWarnings.some(w => w.capability === check.capability && !require('../scan/diagnostics').isInformational(w))) continue;
369
547
  targetWarnings.push({ type: check.capability === 'inventory' ? 'dependency-coverage' : 'source-unavailable',
370
548
  capability: check.capability, message: `${check.collector || check.source || check.capability}: ${check.reason || check.execution}; coverage is incomplete.` });
371
549
  }
550
+ // A component owned by an OS package is assessed through that package, required below. Its
551
+ // upstream comparison on OSV is evidence to investigate, not a coverage requirement: it has
552
+ // no native CVE consultation of its own, which a proxied scan reported as a missing source.
553
+ const requiredDeps = new Map(appDeps);
554
+ for (const pkg of target.packages) {
555
+ const dep=systemDep(pkg,target.id,target.distribution);
556
+ requiredDeps.set(dep.coordKey,dep);
557
+ }
558
+ // Products identified by CPE are checked by the product/version adapter.
559
+ // An excluded adapter is a real gap for a product it could check.
560
+ for (const check of products.coverage) {
561
+ if (check.collector === 'nvd-image-product' && check.execution === 'not-applicable') {
562
+ targetWarnings.push(reliability.coverageWarning(`No applicability check for ${check.product}@${check.version}: ${check.reason}`));
563
+ }
564
+ }
565
+ if(requiredDeps.size) {
566
+ const store=require('../advisories/store').openAdvisoryStore({cacheDir:options.cacheDir});
567
+ try {
568
+ const checkedSources=nativePreparation.coverage.filter(c=>!c.issue && native.coverage?.status!=='failed').map(c=>c.source);
569
+ const gap=discoveryCoverage.assess(requiredDeps,{store,options,nativeSources:checkedSources,reviewed:options.osv!==false});
570
+ if(gap)targetWarnings.push(gap);
571
+ } finally {store.close();}
572
+ }
573
+ for(const check of coverage.filter(reliability.incompleteCheck)){
574
+ targetWarnings.push(reliability.coverageWarning(`${check.collector || check.sourceId}: ${check.reason || check.execution} (${check.capability}).`));
575
+ }
576
+ for(const warning of targetWarnings) {
577
+ if(warning.severity!=='info' && warning.affectsCompleteness!==false && (warning.capability==='advisories' ||
578
+ warning.code==='source-request-failed' || (warning.source && nativePreparation.sources.includes(warning.source))))warning.reliabilityFailure=true;
579
+ }
372
580
  warnings.push(...targetWarnings.map(w => ({ artifactTargetId: target.id, ...w })));
373
581
  artifacts.push({ id: target.id, kind: target.kind, metadata: target.metadata, evidence: target.evidence,
374
582
  originalEvidence: target.originalEvidence, distribution: target.distribution, inventoryAt: target.inventoryAt,
375
- componentCount: target.deps.length, coverage, advisoryObservations:distribution.observations, components: target.deps.map(d => ({ ecosystem: d.ecosystem, packageType: d.packageType,
583
+ componentCount: target.deps.length, coverage, productInventory, advisoryObservations:distribution.observations, components: target.deps.map(d => ({ ...(d.systemSection ? {systemSection:d.systemSection,systemApplicationIds:d.systemApplicationIds || []} : {}), ecosystem: d.ecosystem, packageType: d.packageType,
376
584
  namespace: d.namespace, name: d.name, version: d.version, sourceName:d.sourceName || null, sourceVersion:d.sourceVersion || null, packageOrigin:d.packageOrigin || null, architecture: d.architecture, artifactPath: d.artifactPath,
377
- provenance: d.provenance, imageRole:d.imageRole || null, imageSource:d.imageSource || imageComponentSource(d), installEvidence:d.installEvidence, manager:d.manager, coordKey: d.coordKey, binaryEvidence:d.binaryEvidence, osPackageOwners: d.osPackageOwners || [],
378
- purl: require('../purl').purlFor(d) })) });
585
+ imageProduct:require('./image-products').describe(d), provenance: d.provenance, imageRole:d.imageRole || null, imageSource:d.imageSource || imageComponentSource(d), installEvidence:d.installEvidence, manager:d.manager, coordKey: d.coordKey, binaryEvidence:d.binaryEvidence, osPackageOwners: d.osPackageOwners || [],
586
+ purl: require('../inventory/purl').purlFor(d) })) });
379
587
  }
380
- const combined=require('../merge-sources').mergeBySource(cveMatches,native.matches);
381
- cveMatches.splice(0,cveMatches.length,...combined);
588
+ const combined=require('../findings/merge').foldAnnouncements(require('../findings/merge').mergeBySource(cveMatches,native.matches));
589
+ const applicabilityStore=require('../advisories/store').openAdvisoryStore({cacheDir:options.cacheDir});
590
+ try{
591
+ const checked=require('../system-inventory/package-applicability').reconcileSystemFindings(combined,applicabilityStore);
592
+ cveMatches.splice(0,cveMatches.length,...checked.matches);
593
+ for(const artifact of artifacts)for(const item of checked.observations.filter(o=>o.dep.artifactTargetId===artifact.id))artifact.advisoryObservations.push(item);
594
+ }finally{applicabilityStore.close();}
382
595
  for (const artifact of artifacts) {
383
596
  options.onArtifactProgress?.({stage:'Image updates'});
384
- try { artifact.imageUpdate=await require('../image-update').resolveImageUpdate(artifact.metadata,options); }
597
+ try { artifact.imageUpdate=await require('../images/update').resolveImageUpdate(artifact.metadata,options); }
385
598
  catch (error) { artifact.imageUpdate={status:'unknown',reference:artifact.metadata?.acquisition?.reference||null,reason:`Image update lookup unavailable: ${error.message}`,verifiedFix:false}; }
386
599
  const matches = cveMatches.filter(m => m.dep?.artifactTargetId === artifact.id);
387
600
  options.onArtifactProgress?.({stage:'CVE enrichment'});
601
+ const visibleComponents = require('./report-inventory').reportedComponents(artifact,matches);
602
+ await require('./release-versions').attachReleaseVersions(artifact,visibleComponents,options);
388
603
  const enrichment = await require('./enrichment').enrichArtifactFindings(matches, options);
389
604
  const recordSources = new Set(['nvd', 'euvd', 'euvd-details']);
390
605
  artifact.coverage.push(...enrichment.coverage.map(c => ({ ...c, artifactTargetId: artifact.id,
@@ -392,12 +607,44 @@ async function assessInventories(targets, options = {}) {
392
607
  diagnostics:enrichment.warnings.filter(w => w.source === c.collector) } : {}) })));
393
608
  warnings.push(...enrichment.warnings.filter(w => !recordSources.has(w.source)).map(w => ({ ...w, artifactTargetId: artifact.id })));
394
609
  }
395
- const recordSummary = require('../cve-record-coverage').summarizeCveRecords(cveMatches,
610
+ await require('../findings/cve-descriptions').completeCveDescriptions(cveMatches,options);
611
+ const recordSummary = require('../findings/cve-record-coverage').summarizeCveRecords(cveMatches,
396
612
  { ...options, coverage: artifacts.flatMap(a => a.coverage) });
397
613
  if (recordSummary.warning) warnings.push(recordSummary.warning);
398
- require('../priority').attachPriority(cveMatches);
399
- const diagnostics=require('../diagnostics').partitionDiagnostics(warnings);
400
- return { resolvedDeps, cveMatches: require('../finding-summary').uniqueFindings(cveMatches), ...diagnostics, artifacts };
614
+ require('../findings/priority').attachPriority(cveMatches);
615
+ const diagnostics=require('../scan/diagnostics').partitionDiagnostics(warnings);
616
+ const systemTargets = artifacts.filter(a => a.metadata.systemApplications);
617
+ const applicationRelations = systemTargets.flatMap(a=>a.metadata.systemApplications.relations || []);
618
+ const relationsByDep = new Map();
619
+ for (const relation of applicationRelations) {
620
+ if (!relationsByDep.has(relation.depCoordKey)) relationsByDep.set(relation.depCoordKey,[]);
621
+ relationsByDep.get(relation.depCoordKey).push(relation);
622
+ }
623
+ for (const match of cveMatches) {
624
+ const dep = match.dep;
625
+ const relations = relationsByDep.get(dep?.coordKey);
626
+ if (relations?.length) {
627
+ const occurrence = {version:dep.version,manifestPath:dep.artifactPath,scope:dep.scope,isDev:dep.isDev};
628
+ const [attributed] = require('../applications/inventory').expandComposerFindings(
629
+ [{...match,dep:{...dep,occurrences:[occurrence]}}],'.',relations);
630
+ Object.assign(match,attributed);
631
+ }
632
+ if (dep?.systemApplicationIds?.length) {
633
+ if (!match.applicationIds?.length) match.applicationIds = dep.systemApplicationIds;
634
+ if (!match.applicationRelation) match.applicationRelation = require('../applications/layout').managerRelation(dep);
635
+ }
636
+ }
637
+ for (const target of systemTargets) {
638
+ const {applications,inventory} = target.metadata.systemApplications;
639
+ require('../applications/layout').attributeLayoutFindings(cveMatches.filter(m=>m.dep?.artifactTargetId===target.id),applications,inventory);
640
+ }
641
+ const systemApplications = systemTargets.length ? {
642
+ applicationRelations,
643
+ applications:systemTargets.flatMap(a=>a.metadata.systemApplications.applications.map(app=>({...app,artifactTargetId:a.id}))),
644
+ coverage:systemTargets.flatMap(a=>a.coverage.filter(check=>check.applicationId)),
645
+ applicationInventory:systemTargets.flatMap(a=>a.metadata.systemApplications.inventory.map(c=>({...c,artifactTargetId:a.id}))),
646
+ } : {};
647
+ return { resolvedDeps, cveMatches: require('../findings/summary').uniqueFindings(cveMatches), ...systemApplications, ...diagnostics, artifacts };
401
648
  }
402
649
 
403
650
  function incompleteCapabilities(result, required = ['inventory', 'advisories', 'sources']) {
@@ -405,7 +652,7 @@ function incompleteCapabilities(result, required = ['inventory', 'advisories', '
405
652
  for (const target of result.artifacts) {
406
653
  for (const capability of required) {
407
654
  if (capability === 'sources') {
408
- if (result.warnings.some(w => w.affectsCompleteness !== false && w.artifactTargetId === target.id && /source|osv/.test(w.type))) gaps.push({ target: target.id, capability });
655
+ if (result.warnings.some(w => w.affectsCompleteness !== false && w.artifactTargetId === target.id && (/source|osv/.test(w.type) || w.reliabilityFailure))) gaps.push({ target: target.id, capability });
409
656
  } else {
410
657
  const records = target.coverage.filter(c => c.capability === capability);
411
658
  if (!records.length || records.some(c => c.affectsCompleteness !== false && !['completed', 'not-applicable'].includes(c.execution))) gaps.push({ target: target.id, capability });
@@ -415,5 +662,5 @@ function incompleteCapabilities(result, required = ['inventory', 'advisories', '
415
662
  return gaps;
416
663
  }
417
664
 
418
- module.exports = { acquireInventories, assessInventories, inventoryTarget, sbomTarget, readSnapshot, writeSnapshot,
665
+ module.exports = { acquireInventories, assessInventories, inventoryTarget, sbomTarget, readSnapshot, writeSnapshot, relativeToRoot,
419
666
  createSnapshot, validateSnapshot, incompleteCapabilities, coverageRecords, systemDep, SNAPSHOT_SCHEMA };