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,5 +1,5 @@
1
1
  /**
2
- * lib/cve-report.js — generate self-contained HTML and Word-compatible (.doc)
2
+ * lib/reports/cve-report.js — generate self-contained HTML and Word-compatible (.doc)
3
3
  * reports from matched CVE/EOL/obsolete/outdated findings.
4
4
  *
5
5
  * Word opens HTML saved as .doc natively — we use the same HTML body
@@ -10,14 +10,15 @@
10
10
  */
11
11
  const fs = require("fs");
12
12
  const path = require("path");
13
- const { getCodec, allCodecs, ORDER } = require("./codecs");
14
- const { computePriority, sortByPriority } = require("./priority");
15
- const { buildInventory } = require("./unmanaged");
16
- const { buildEmbeddedInventory } = require("./embedded");
13
+ const { getCodec, allCodecs, ORDER } = require("../codecs");
14
+ const { computePriority, sortByPriority } = require("../findings/priority");
15
+ const { buildInventory } = require("../inventory/unmanaged");
16
+ const { buildEmbeddedInventory } = require("../inventory/embedded");
17
+ const { targetPath } = require("../artifacts/report-path");
17
18
  const { renderCharts } = require("./charts");
18
- const { renderLinkedCves, renderRiskEvidence, renderRiskAttribution, renderEuvdEvidence, renderDistributionAdvisories } = require("./artifacts/risk-report");
19
- const { findDeclarations } = require("./descriptor-refs");
20
- const { europeanReferences, euvdExploited } = require("./eu-refs");
19
+ const { renderLinkedCves, renderRiskEvidence, renderRiskAttribution, renderEuvdEvidence, renderDistributionAdvisories } = require("../artifacts/risk-report");
20
+ const { findDeclarations } = require("../inventory/descriptor-refs");
21
+ const { europeanReferences, euvdExploited } = require("../findings/eu-refs");
21
22
 
22
23
  // Canonical public repository (package.json `repository`). The report is a
23
24
  // hand-over artifact: a reader who receives only the .html/.doc has to be able
@@ -31,13 +32,13 @@ const CWE_NAMES = (() => {
31
32
  try {
32
33
  // require() (not fs.readFileSync) so bun --compile bundles the data file
33
34
  // into the standalone binary instead of reading it off disk at runtime.
34
- const raw = { ...require("../data/cwe-names.json") };
35
+ const raw = { ...require("../../data/cwe-names.json") };
35
36
  delete raw._comment;
36
37
  return raw;
37
38
  } catch { return {}; }
38
39
  })();
39
40
  const CWE_NAMES_FR = (() => {
40
- try { const raw = { ...require("../data/cwe-names-fr.json") }; delete raw._comment; return raw; }
41
+ try { const raw = { ...require("../../data/cwe-names-fr.json") }; delete raw._comment; return raw; }
41
42
  catch { return {}; }
42
43
  })();
43
44
 
@@ -80,7 +81,7 @@ function esc(s) {
80
81
  .replace(/"/g, """);
81
82
  }
82
83
 
83
- const { renderTime, localizeReportTimes } = require("./report-time");
84
+ const { renderTime, localizeReportTimes } = require("./time");
84
85
  function renderTimestamp(value) { return renderTime(value, RENDER_CTX.locale || "en"); }
85
86
  function renderTextWithTimestamps(value) {
86
87
  const text = String(value || "");
@@ -106,6 +107,7 @@ function computeStats(cveMatches) {
106
107
  if (m.cve?.kev) buckets.kev++;
107
108
  }
108
109
  buckets.total = (cveMatches || []).length;
110
+ buckets.distinctAdvisories = new Set((cveMatches || []).map(m=>m.cve.id).filter(Boolean)).size;
109
111
  return buckets;
110
112
  }
111
113
 
@@ -180,7 +182,10 @@ function priorityCell(m, published) {
180
182
  t("EPSS score {pct}% — percentile among all scored CVEs", { pct: m.cve.epssScore != null ? (m.cve.epssScore * 100).toFixed(1) : "?" }))
181
183
  : "";
182
184
  const l4 = published ? `<div class="prio-line prio-meta prio-date"><span class="prio-k">${t("Published")}:</span> ${renderTimestamp(published)}</div>` : "";
183
- return `${l1}${l2}${l3}${l4}`;
185
+ const urgency = m.cve?.distributionUrgency, status = m.cve?.distributionStatus;
186
+ // What the distribution itself says of a vulnerability it has not fixed ("Will not fix"…).
187
+ const statusLine = status ? meta(t("Distribution status"), status.source + " · " + status.state, status.release + (status.appliedTo ? " → " + status.appliedTo : "")) : "";
188
+ return `${l1}${l2}${urgency ? meta(t("Distribution urgency"), urgency.source + " · " + urgency.value, urgency.release) : ""}${statusLine}${l3}${l4}`;
184
189
  }
185
190
 
186
191
  const CSS = `
@@ -211,7 +216,7 @@ h2 { margin: 32px 0 12px; font-size: 20px; border-bottom: 2px solid #e5e7eb; pad
211
216
  .summary .card.sev-vendored { border-left: 4px solid #6366f1; }
212
217
  .summary .card.sev-warn { border-left: 4px solid #f59e0b; background: #fffbeb; }
213
218
  /* Overview charts — four equal-width (25%) cards on one row, stretched to the
214
- same height. All four donuts share one viewBox width (see lib/charts.js) so
219
+ same height. All four donuts share one viewBox width (see lib/reports/charts.js) so
215
220
  they scale identically and stay the SAME size whatever the legend length.
216
221
  The copy button overlays the top-right. */
217
222
  .charts-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 18px; align-items: stretch; }
@@ -256,6 +261,7 @@ h2 { margin: 32px 0 12px; font-size: 20px; border-bottom: 2px solid #e5e7eb; pad
256
261
  .exec-summary .exec-ver { color: #6b7280; }
257
262
  .exec-summary .exec-fix { color: #065f46; font-weight: 600; }
258
263
  .fp-intro { background: #f3f4f6; border-left: 3px solid #6b7280; padding: 10px 14px; margin: 8px 0 16px; font-size: 12px; color: #4b5563; line-height: 1.5; }
264
+ .incomplete-banner { background: #fff7ed; border-left-color: #ea580c; color: #7c2d12; font-size: 13px; }
259
265
  td.prio { white-space: normal; }
260
266
  td.prio .prio-line { display: block; line-height: 1.5; margin-bottom: 4px; white-space: nowrap; }
261
267
  td.prio .prio-line:last-child { margin-bottom: 0; }
@@ -317,8 +323,7 @@ tr.jump-patch td, tr.jump-pre td, tr.jump-unknown td { opacity: .75; }
317
323
  tr.cve-row .cpe-tag { display: inline-block; margin-top: 2px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; background: #f3f4f6; color: #6b7280; padding: 1px 5px; border-radius: 3px; }
318
324
  /* A table must never widen the PAGE. Its natural minimum width is the sum of its columns'
319
325
  longest unbreakable token — a Maven coordinate like com.fasterxml.jackson.core:jackson-databind
320
- is one such token — and every nesting level of chapter 1 removes ~30px of available width
321
- (details.report-subsection > div below), so deep tables used to push the document 495px wide
326
+ is one such token — and nested chapters reduce the available width, so deep tables used to push the document 495px wide
322
327
  at a 1265px viewport. The .doc stylesheet already hard-fits tables for Word; the HTML never
323
328
  did. Let long tokens break, cap the table at its container, and keep any residue inside the
324
329
  table's own wrapper rather than on <body>. */
@@ -464,17 +469,19 @@ details.report-subsection > summary :is(h3,h4) { margin: 0; display: flex; align
464
469
  details.report-subsection > summary :is(h3,h4)::before { content: "▾"; color: #9ca3af; font-size: 12px; transition: transform .15s ease; display: inline-block; }
465
470
  details.report-subsection:not([open]) > summary :is(h3,h4)::before { transform: rotate(-90deg); }
466
471
  details.report-subsection > summary:hover :is(h3,h4) { color: #4b5563; }
467
- /* Hierarchical indentation: every subsection's content gets a padded,
468
- bordered container. Nested subsections inherit + add to the indent so
469
- children visually nest under their parent. */
470
- details.report-subsection > div { padding-left: 22px; margin-left: 6px; border-left: 2px solid #f3f4f6; padding-top: 4px; min-width: 0; }
471
- /* Chapter 1 nests ecosystem → manifest → scope, so the inset compounds. Past the second
472
- level it only has to show containment, not restate it: 8px instead of 28px each. */
473
- details.report-subsection details.report-subsection details.report-subsection > div { padding-left: 8px; margin-left: 0; }
472
+ /* Inset the body of each chapter, including tables and text placed directly
473
+ under details. The heading stays on its parent's content edge. */
474
+ details.report-section { --chapter-indent: 12px; }
475
+ :where(details.report-section, details.report-section details):not(td details, th details) {
476
+ padding-inline-start: var(--chapter-indent);
477
+ min-width: 0;
478
+ }
479
+ :where(details.report-section, details.report-section details):not(td details, th details) > summary {
480
+ margin-inline-start: calc(0px - var(--chapter-indent));
481
+ }
482
+ details.report-subsection > div { padding-top: 4px; min-width: 0; }
474
483
  details.report-subsection details.report-subsection > summary h3 { font-size: 14px; color: #4b5563; }
475
484
  details.report-subsection details.report-subsection details.report-subsection > summary h3 { font-size: 13px; color: #6b7280; font-weight: 500; }
476
- details.report-subsection details.report-subsection > div { border-left-color: #e5e7eb; }
477
- details.report-subsection details.report-subsection details.report-subsection > div { border-left-color: #d1d5db; }
478
485
  .toolbar { display: flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; align-items: center; }
479
486
  .toolbar .btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; font-size: 12px; background: #fff; border: 1px solid #d1d5db; border-radius: 4px; cursor: pointer; color: #374151; font-family: inherit; }
480
487
  .toolbar .btn:hover { background: #f3f4f6; border-color: #9ca3af; }
@@ -518,6 +525,7 @@ tr.cve-row.open { background: #e0e7ff !important; }
518
525
  tr.cve-row td:first-child { position: relative; padding-left: 24px; }
519
526
  tr.cve-row td:first-child::before { content: "▸"; position: absolute; left: 9px; top: 9px; color: #9ca3af; transition: transform .15s ease; transform-origin: center; line-height: 1; }
520
527
  tr.cve-row.open td:first-child::before { transform: rotate(90deg); color: #6366f1; }
528
+ tr.more-row td { background: #f3f4f6; color: #4b5563; font-size: 12px; padding: 8px 12px; border-top: 2px solid #d1d5db; }
521
529
  tr.detail-row { display: none; }
522
530
  tr.detail-row.open { display: table-row; }
523
531
  tr.detail-row > td { padding: 0; border-bottom: 2px solid #c7d2fe; background: #f9fafb; }
@@ -577,7 +585,10 @@ td.prio .risk-note { white-space: normal; max-width: 190px; }
577
585
  .linked-cve-evidence .kv { margin: 8px 0; }
578
586
  details[id] { scroll-margin-top: 76px; }
579
587
  #chimages code, #chimages h3, #chimages-cves h3 { overflow-wrap: anywhere; }
580
- .image-inventory th:nth-child(5), .image-inventory td:nth-child(5) { min-width: 4.5em; white-space: nowrap; }
588
+ .release-version { min-width: 10em; overflow-wrap: anywhere; }
589
+ .release-version + .release-version { margin-top: 5px; }
590
+ .release-version small { display: block; color: #4b5563; }
591
+ .image-inventory th:nth-child(6), .image-inventory td:nth-child(6) { min-width: 4.5em; white-space: nowrap; }
581
592
  .image-totals { max-width: 720px; table-layout: fixed; margin: 16px 0; border: 1px solid #e5e7eb; }
582
593
  .image-totals th { width: 25%; white-space: normal; overflow-wrap: anywhere; }
583
594
  .image-totals .image-total-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: #1f2937; }
@@ -594,6 +605,7 @@ details[id] { scroll-margin-top: 76px; }
594
605
  .report-section-link:hover { background: #e0e7ff; border-color: #a5b4fc; color: #3730a3; }
595
606
  .report-section-link:focus-visible { outline: 2px solid #6366f1; outline-offset: 3px; }
596
607
  @media screen and (max-width: 600px) {
608
+ details.report-section { --chapter-indent: 6px; }
597
609
  html, body { overflow-x: clip; }
598
610
  .toc { position: static; }
599
611
  .toc .toc-item { flex: 1 1 25%; box-sizing: border-box; }
@@ -621,11 +633,18 @@ function setRenderCtx(ctx) {
621
633
  }
622
634
  }
623
635
 
624
- function depCell(dep, srcRoot = RENDER_CTX.srcRoot) {
636
+ function imageDependency(dep) {
637
+ return dep?.artifactTargetId && !RENDER_CTX.systemIds?.has(dep.artifactTargetId);
638
+ }
639
+
640
+ function depCell(dep, srcRoot = RENDER_CTX.srcRoot, relation) {
625
641
  let chip = "";
626
642
  let via = "";
627
- if (dep.scope === "transitive") {
628
- chip = `<span class="chip transitive">${t("transitive")} d${dep.depth || "?"}</span>`;
643
+ if (relation === "unknown") {
644
+ chip = `<span class="chip">${esc(RENDER_CTX.locale === 'fr' ? 'Relation indéterminée' : 'Undetermined relationship')}</span>`;
645
+ } else if (relation === "transitive" || (!relation && dep.scope === "transitive")) {
646
+ chip = `<span class="chip transitive">${t("transitive")}${dep.depth || !relation ? ' d'+(dep.depth || '?') : ''}</span>`;
647
+ if (dep.isDev || dep.scope === 'dev') chip += ' <span class="chip scope-dev">dev</span>';
629
648
  const paths = dep.viaPaths?.length ? dep.viaPaths : (dep.via?.length ? [dep.via] : []);
630
649
  if (paths.length) {
631
650
  const shown = paths.slice(0, 3).map(p => `<div class="via">via ${esc(p.join(" → "))}</div>`).join("");
@@ -681,7 +700,13 @@ function descriptorCount(paths) {
681
700
  function renderDefinedIn(dep, srcRoot) {
682
701
  if (dep.artifactTargetId) {
683
702
  const path = dep.artifactPath || dep.manifestPaths?.[0] || dep.pomPaths?.[0];
684
- return path ? `<div class="defined-in"><span class="defined-label">${t("Evidence in image")}</span> <code>${esc(path)}</code></div>` : "";
703
+ const line = (label,file) => file ? `<div class="defined-in"><span class="defined-label">${t(label)}</span> <code>${esc(evidencePath(file,dep))}</code></div>` : "";
704
+ const component = dep.cmsComponent;
705
+ if (component && (component.descriptorPath || component.versionEvidencePath)) {
706
+ return line(component.descriptorPath ? "Descriptor" : "Location",path) +
707
+ (component.versionEvidencePath!==path ? line("Installed version read from",component.versionEvidencePath) : "");
708
+ }
709
+ return line(imageDependency(dep) ? "Evidence in image" : "Location",path);
685
710
  }
686
711
  const paths = (dep.manifestPaths && dep.manifestPaths.length) ? dep.manifestPaths
687
712
  : (dep.pomPaths && dep.pomPaths.length) ? dep.pomPaths
@@ -735,6 +760,13 @@ function displayPath(value) {
735
760
  return String(value == null ? "" : value).split("\\").join("/");
736
761
  }
737
762
 
763
+ function evidencePath(file, owner, srcRoot) {
764
+ if (owner?.artifactTargetId) {
765
+ return owner.provenance === 'sbom' || RENDER_CTX.sbomIds?.has(owner.artifactTargetId) ? file : targetPath(file);
766
+ }
767
+ return makeRelative(file,srcRoot);
768
+ }
769
+
738
770
  function makeRelative(absPath, srcRoot) {
739
771
  if (!srcRoot || !absPath) return displayPath(absPath || "");
740
772
  const path = require("path");
@@ -942,8 +974,8 @@ function renderDetailPanel(m, opts = {}) {
942
974
  const cve = m.cve;
943
975
  const dep = m.dep;
944
976
  const sections = [];
945
- if (dep.artifactTargetId) sections.push(`<p><a href="#${require("./artifacts/report").artifactAnchor(dep.artifactTargetId)}">${t("Replace or rebuild the image — remediation details")}</a></p>`);
946
- if (dep.artifactTargetId) sections.push(section(t("Image update evidence"), require('./artifacts/remediation-report').renderImageUpdateSummary(opts.image, RENDER_CTX.locale)));
977
+ if (imageDependency(dep)) sections.push(`<p><a href="#${require("../artifacts/report").artifactAnchor(dep.artifactTargetId)}">${t("Replace or rebuild the image — remediation details")}</a></p>`);
978
+ if (imageDependency(dep)) sections.push(section(t("Image update evidence"), require('../artifacts/remediation-report').renderImageUpdateSummary(opts.image, RENDER_CTX.locale)));
947
979
 
948
980
  // 1. Description
949
981
  const primaryDescription=cve.description || (cve.nvdEvidence?.records || []).find(r=>String(r.id||'').toUpperCase()===String(cve.id||'').toUpperCase())?.description || cve.euvdDetails?.description;
@@ -951,6 +983,18 @@ function renderDetailPanel(m, opts = {}) {
951
983
  sections.push(section(t("Description"), `<div class="full-desc">${esc(primaryDescription)}</div>`));
952
984
  }
953
985
 
986
+ for (const entry of cve.cveEvidence || []) {
987
+ const proof=entry.descriptionEvidence;
988
+ if (!proof?.description || !proof.source) continue;
989
+ const label=esc(proof.source)+' · '+esc(entry.id);
990
+ const source=typeof proof.url==='string' && /^https?:\/\//i.test(proof.url)
991
+ ? `<a href="${esc(proof.url)}" target="_blank" rel="noopener noreferrer">${label}</a>` : label;
992
+ const group=proof.kind==='grouped-advisory' && proof.linkedIds?.length
993
+ ? ' · '+t("Publisher bulletin covering {n} CVEs",{n:proof.linkedIds.length}) : '';
994
+ sections.push(`<p class="muted">${source}${group}</p>`+
995
+ (proof.description===primaryDescription ? '' : `<div class="full-desc">${esc(proof.description)}</div>`));
996
+ }
997
+
954
998
  // 2. Weaknesses (CWE) — id + human name, links to mitre.org
955
999
  if (Array.isArray(cve.cwes) && cve.cwes.length) {
956
1000
  sections.push(section(t("Weaknesses (CWE)"), formatCwesVerbose(cve.cwes), { count: cve.cwes.length }));
@@ -967,7 +1011,7 @@ function renderDetailPanel(m, opts = {}) {
967
1011
  if (cve.published) kv.push(`<div><label>${t("Published")}</label><span>${renderTimestamp(cve.published)}</span></div>`);
968
1012
  if (cve.modified) kv.push(`<div><label>${t("Modified")}</label><span>${renderTimestamp(cve.modified)}</span></div>`);
969
1013
  if (cve.ghsa) kv.push(`<div><label>GHSA</label><span><a href="https://github.com/advisories/${esc(cve.ghsa)}" target="_blank">${esc(cve.ghsa)}</a></span></div>`);
970
- // European references (lib/eu-refs.js): the EUVD id + ENISA's exploited flag, the GCVE id.
1014
+ // European references (lib/findings/eu-refs.js): the EUVD id + ENISA's exploited flag, the GCVE id.
971
1015
  const euRefs = europeanReferences(cve);
972
1016
  const euvdRef = euRefs.find(r => r.source === "ENISA EUVD"), gcveRef = euRefs.find(r => r.source === "GCVE");
973
1017
  if (euvdRef || euvdExploited(cve)) {
@@ -983,8 +1027,8 @@ function renderDetailPanel(m, opts = {}) {
983
1027
  if (cve.riskEvidence && cve.riskEvidence.id !== cve.id) kv.push(`<div><label>${t("Risk evidence")}</label><span>${renderRiskAttribution(cve, RENDER_CTX.locale)}</span></div>`);
984
1028
  if (kv.length) sections.push(section(t("Metadata"), `<div class="kv">${kv.join("")}</div>`));
985
1029
  sections.push(renderDistributionAdvisories(cve, RENDER_CTX.locale));
986
- sections.push(require('./artifacts/risk-report').renderHistoricalEvidence(cve,RENDER_CTX.locale));
987
- sections.push(require('./artifacts/risk-report').renderVendorEvidence(cve,RENDER_CTX.locale));
1030
+ sections.push(require('../artifacts/risk-report').renderHistoricalEvidence(cve,RENDER_CTX.locale));
1031
+ sections.push(require('../artifacts/risk-report').renderVendorEvidence(cve,RENDER_CTX.locale));
988
1032
  sections.push(renderRiskEvidence(cve, RENDER_CTX.locale, { omitRepeated: true }));
989
1033
  sections.push(renderEuvdEvidence(cve, RENDER_CTX.locale, { omitRepeated: true }));
990
1034
  const relatedAdvisories=(Array.isArray(cve.relatedAdvisories)?cve.relatedAdvisories:[]).filter(a=>{
@@ -1050,8 +1094,8 @@ function renderDetailPanel(m, opts = {}) {
1050
1094
  // 7. Declared in — the descriptors, whatever they are. This counted "N POMs" for every
1051
1095
  // ecosystem, so an npm-only project was told its package-lock.json was a POM.
1052
1096
  if (dep.pomPaths?.length) {
1053
- const items = dep.pomPaths.slice(0, 10).map(p => `<div>${esc(makeRelative(p, RENDER_CTX.srcRoot))}</div>`).join("");
1054
- sections.push(section(dep.artifactTargetId ? t("Evidence in image") : t("Declared in"),
1097
+ const items = dep.pomPaths.slice(0, 10).map(p => `<div>${esc(evidencePath(p, dep, RENDER_CTX.srcRoot))}</div>`).join("");
1098
+ sections.push(section(imageDependency(dep) ? t("Evidence in image") : t("Declared in"),
1055
1099
  `<div class="via-list">${items}${dep.pomPaths.length > 10 ? `<div style="color:#9ca3af">${t("+{n} more", { n: dep.pomPaths.length - 10 })}</div>` : ""}</div>`,
1056
1100
  { count: descriptorCount(dep.pomPaths), open: false }));
1057
1101
  }
@@ -1126,10 +1170,10 @@ function renderCveRow(m, opts = {}) {
1126
1170
  return `<tr class="cve-row${m.cpeFiltered ? " cpe-fp" : ""}">
1127
1171
  <td class="prio">${priorityCell(m, pub)}</td>
1128
1172
  <td class="cve">${advisoryCell}${linkedCves}${conf}${m.cpeFiltered ? `<div class="cpe-tag">${t("CPE-filtered")}</div>` : ""}</td>
1129
- ${depCell(m.dep)}
1173
+ ${opts.siblingLine ? depCell(m.dep, RENDER_CTX.srcRoot, opts.systemRelation).replace(/<\/td>$/, opts.siblingLine + "</td>") : depCell(m.dep, RENDER_CTX.srcRoot, opts.systemRelation)}
1130
1174
  <td class="cwe">${cwes}</td>
1131
1175
  <td class="desc">${esc(shortDesc(m.cve.description))}</td>
1132
- ${m.dep?.artifactTargetId ? `<td class="image-remediation">${require('./artifacts/remediation-report').renderImageCveAction(m, opts.image, RENDER_CTX.locale)}</td>` : `<td class="dep fix">${esc(m.cve.fixVersion || "—")}</td>`}
1176
+ ${imageDependency(m.dep) ? `<td class="image-remediation">${require('../artifacts/remediation-report').renderImageCveAction(m, opts.image, RENDER_CTX.locale)}</td>` : `<td class="dep fix">${esc(m.cve.fixVersion || "—")}</td>`}
1133
1177
  <td>${source}</td>
1134
1178
  ${actionCell}
1135
1179
  </tr>
@@ -1159,14 +1203,57 @@ function renderActionCell(m) {
1159
1203
  return action;
1160
1204
  }
1161
1205
 
1206
+ // A report is read, not grepped: one component with thousands of advisories (a kernel
1207
+ // package carries more than 9 000) would bury every other finding and weigh hundreds of
1208
+ // megabytes. Each component lists its highest-priority findings; the rest are counted by
1209
+ // severity, and stay complete in the JSON and Excel exports.
1210
+ const { PER_COMPONENT_DETAIL_LIMIT: PER_COMPONENT_ROW_LIMIT, planDetail } = require("./detail");
1211
+ // One row per advisory of a group (a source package and the packages built from it, or a
1212
+ // single component), for the group's highest-priority advisories; the rest is counted.
1213
+ function capPerComponent(matches) {
1214
+ const { detailed, siblings, groups } = planDetail(matches, PER_COMPONENT_ROW_LIMIT);
1215
+ const overflow = groups.filter(g => g.beyond.length).map(g => {
1216
+ const rest = { dep: g.dep, source: g.source, packages: g.packages, count: g.beyond.length, kev: 0, bySeverity: {} };
1217
+ for (const m of g.beyond) {
1218
+ const severity = String(m.cve?.severity || "UNKNOWN").toUpperCase();
1219
+ rest.bySeverity[severity] = (rest.bySeverity[severity] || 0) + 1;
1220
+ if (m.cve?.kev) rest.kev++;
1221
+ }
1222
+ return rest;
1223
+ });
1224
+ return { kept: detailed, siblings, overflow };
1225
+ }
1226
+ function overflowLabel(rest) {
1227
+ if (rest.source) return `${esc(rest.dep.sourceName)}${rest.dep.sourceVersion ? " " + esc(rest.dep.sourceVersion) : ""}${rest.packages > 1 ? ` (${t("{n} packages", { n: rest.packages })})` : ""}`;
1228
+ return `${esc(depDisplayName(rest.dep))}${rest.dep.version ? " " + esc(rest.dep.version) : ""}`;
1229
+ }
1230
+ function renderOverflowRow(rest, colspan) {
1231
+ const breakdown = ["CRITICAL", "HIGH", "MEDIUM", "LOW", "UNKNOWN"].filter(s => rest.bySeverity[s])
1232
+ .map(s => `${rest.bySeverity[s]} ${s}`).join(" · ");
1233
+ return `<tr class="more-row"><td colspan="${colspan}"><strong>${overflowLabel(rest)}</strong> — ${t("{n} further finding(s) not listed ({breakdown}{kev}). The {limit} highest-priority findings of this component are shown above; all of them are listed in the JSON and Excel exports.", {
1234
+ n: rest.count, breakdown, kev: rest.kev ? ` · ${rest.kev} KEV` : "", limit: PER_COMPONENT_ROW_LIMIT })}</td></tr>`;
1235
+ }
1236
+ // The other packages of the same source carrying the same advisory, named in the row.
1237
+ const SIBLING_NAMES_SHOWN = 6;
1238
+ function siblingLine(others, match) {
1239
+ // A source that states a vulnerability once for all the packages of a source package names them itself.
1240
+ const stated = (match?.cve?.distributionStatus?.packages || []).filter(name => name !== match.dep?.name);
1241
+ if (!others?.length && !stated.length) return "";
1242
+ const names = [...new Set([...(others || []).map(m => depDisplayName(m.dep)), ...stated])];
1243
+ const shown = names.slice(0, SIBLING_NAMES_SHOWN).map(esc).join(", ");
1244
+ return `<div class="via">${t("Also in {n} other package(s) of this source: {names}", { n: names.length, names: shown + (names.length > SIBLING_NAMES_SHOWN ? "…" : "") })}</div>`;
1245
+ }
1246
+
1162
1247
  function renderCveTable(cveMatches, opts = {}) {
1163
1248
  if (!cveMatches?.length) return `<div class="empty">${t("No CVEs matched.")}</div>`;
1164
1249
  const { withAction } = opts;
1165
1250
  // Highest composite priority (KEV → EPSS-weighted CVSS) first.
1166
- const rows = sortByPriority(cveMatches).map(m => renderCveRow(m, opts)).join("\n");
1251
+ const { kept, siblings, overflow } = capPerComponent(cveMatches);
1252
+ const rows = kept.map(m => renderCveRow(m, { ...opts, siblingLine: siblingLine(siblings.get(m), m) })).join("\n") +
1253
+ overflow.map(rest => renderOverflowRow(rest, withAction ? 8 : 7)).join("\n");
1167
1254
  const actionHeader = withAction ? `<th>${t("Recommended action")}</th>` : "";
1168
1255
  const idHeader = cveMatches.every(m => /^CVE-\d{4}-\d{4,}$/i.test(String(m.cve?.id || ""))) ? t("CVE ID") : t("Advisory ID");
1169
- const images = cveMatches.every(m => m.dep?.artifactTargetId);
1256
+ const images = cveMatches.every(m => imageDependency(m.dep));
1170
1257
  return `<table data-tbl="cve"${images ? ' data-image-cves="true"' : ''}>
1171
1258
  <thead><tr><th title="${esc(t("Line 1: fix-priority band and CISA KEV flag. Line 2: CVSS severity and base score. Line 3: EPSS percentile and publication date."))}">${t("Priority / severity")}</th><th>${idHeader}</th><th>${t("Dependency")}</th><th>${t("CWE")}</th><th>${t("Description")}</th><th>${t(images ? "Image / component update" : "Advisory-specific candidate")}</th><th>${t("Source")}</th>${actionHeader}</tr></thead>
1172
1259
  <tbody>${rows}</tbody>
@@ -1175,7 +1262,7 @@ function renderCveTable(cveMatches, opts = {}) {
1175
1262
 
1176
1263
  // Per-ecosystem fix-recipe metadata, now owned by the codecs (lib/codecs/recipes.js).
1177
1264
  // Keys correspond to ecosystemType values.
1178
- const ECO_RECIPE = require("./codecs/recipes");
1265
+ const ECO_RECIPE = require("../codecs/recipes");
1179
1266
 
1180
1267
  /**
1181
1268
  * From CVE matches (split direct/transitive) + outdatedResults + resolvedDeps,
@@ -1204,6 +1291,7 @@ function buildFixRecommendations(cveMatches, outdatedResults, resolvedDeps) {
1204
1291
  maxSeverity: "UNKNOWN", cveIds: [], rootDirects: new Set(), missingFix: false,
1205
1292
  };
1206
1293
  tEntry.cveIds.push(m.cve.id);
1294
+ rememberSystemCandidate(tEntry,m);
1207
1295
  if (!m.cve.fixVersion) tEntry.missingFix = true;
1208
1296
  // Individual advisory boundaries do not certify a package upgrade. A
1209
1297
  // higher version can enter another affected interval or a different CVE.
@@ -1321,6 +1409,7 @@ function buildDirectDepsToUpdate(matches, outdatedResults) {
1321
1409
  fixVersion: null, missingFix: false,
1322
1410
  };
1323
1411
  e.cveIds.push(m.cve.id);
1412
+ rememberSystemCandidate(e,m);
1324
1413
  if (!m.cve.fixVersion) e.missingFix = true;
1325
1414
  if ((severityRank[m.cve.severity] || 0) > (severityRank[e.maxSeverity] || 0)) e.maxSeverity = m.cve.severity;
1326
1415
  byKey.set(key, e);
@@ -1337,6 +1426,19 @@ function buildDirectDepsToUpdate(matches, outdatedResults) {
1337
1426
  b.cveIds.length - a.cveIds.length);
1338
1427
  }
1339
1428
 
1429
+ function rememberSystemCandidate(entry,match) {
1430
+ if (!RENDER_CTX.systemIds?.size || !match.dep.systemSection || !match.cve.fixVersion) return;
1431
+ const item=[match.cve.id,match.dep.version,match.cve.fixVersion];
1432
+ (entry.advisoryCandidates ||= new Map()).set(JSON.stringify(item),item);
1433
+ }
1434
+
1435
+ function renderSystemCandidates(entry) {
1436
+ if (!entry.advisoryCandidates?.size) return '';
1437
+ const rows=[...entry.advisoryCandidates.values()].map(([id,installed,fixed])=>
1438
+ `<li>${esc(id)} · <code>${esc(installed)} → ${esc(fixed)}</code></li>`).join('');
1439
+ return `<details><summary>${esc(t("Advisory-specific candidates"))} (${entry.advisoryCandidates.size})</summary><ul>${rows}</ul></details>`;
1440
+ }
1441
+
1340
1442
  function renderDirectDepsToUpdateTable(entries) {
1341
1443
  const intro = `<div class="fp-intro">${t("Advisory candidates address individual advisories only. Other vulnerabilities may affect those versions. No package-wide correction or pin is generated without checking the target version against all advisories. Rescan candidate versions and review compatibility and lockfiles.")}</div>`;
1342
1444
  const rows = entries.map(e => `<tr>
@@ -1345,7 +1447,7 @@ function renderDirectDepsToUpdateTable(entries) {
1345
1447
  <td class="dep">${esc(e.currentVersion || "?")}</td>
1346
1448
  <td class="dep">${e.fixVersion ? `<span style="color:#065f46;font-weight:600">${esc(e.fixVersion)}</span>` : `<span style="color:#9ca3af">${t("— (manual triage)")}</span>`}</td>
1347
1449
  <td class="dep">${e.latest ? esc(e.latest) : `<span style="color:#9ca3af">—</span>`}</td>
1348
- <td class="confidence">${t("{n} CVE:", { n: e.cveIds.length })} ${esc(e.cveIds.slice(0, 4).join(", "))}${e.cveIds.length > 4 ? "…" : ""}</td>
1450
+ <td class="confidence">${t("{n} CVE:", { n: e.cveIds.length })} ${esc(e.cveIds.slice(0, 4).join(", "))}${e.cveIds.length > 4 ? "…" : ""}${renderSystemCandidates(e)}</td>
1349
1451
  </tr>`).join("\n");
1350
1452
  return intro + `<table>
1351
1453
  <thead><tr><th>${t("Worst sev")}</th><th>${t("Direct dependency")}</th><th>${t("Current")}</th><th>${t("Suggested version")}</th><th>${t("Maven Central latest")}</th><th>${t("CVEs")}</th></tr></thead>
@@ -1378,7 +1480,7 @@ function renderRecommendationsForEco(slice, meta) {
1378
1480
  <td>${badge(tr.maxSeverity)}</td>
1379
1481
  <td class="dep">${esc(tr.ecosystem === "npm" ? "npm:" : `${tr.groupId}:`)}<br>${esc(tr.artifactId)}<br><span style="color:#6b7280">${esc(tr.currentVersion)}</span></td>
1380
1482
  <td class="dep">${tr.packageFixVerified === true && tr.fixVersion ? esc(tr.fixVersion) : `<span style="color:#9ca3af">${t("— (manual triage)")}</span>`}</td>
1381
- <td class="confidence">${t("{n} CVE:", { n: tr.cveIds.length })} ${esc(tr.cveIds.slice(0, 4).join(", "))}${tr.cveIds.length > 4 ? "…" : ""}</td>
1483
+ <td class="confidence">${t("{n} CVE:", { n: tr.cveIds.length })} ${esc(tr.cveIds.slice(0, 4).join(", "))}${tr.cveIds.length > 4 ? "…" : ""}${renderSystemCandidates(tr)}</td>
1382
1484
  <td class="dep">${[...tr.rootDirects].slice(0, 3).map(r => esc(r)).join("<br>")}${tr.rootDirects.size > 3 ? `<div class="confidence">${t("+{n} more", { n: tr.rootDirects.size - 3 })}</div>` : ""}</td>
1383
1485
  </tr>`).join("\n");
1384
1486
  html += `<table>
@@ -1435,7 +1537,7 @@ function renderDepOrigin(dep, srcRoot) {
1435
1537
  // A <dependencyManagement> pin that the graph reaches: the version is set in YOUR pom,
1436
1538
  // which is where it gets bumped.
1437
1539
  const pinned = (dep.managedIn && dep.managedIn.length)
1438
- ? `<div class="defined-in"><span class="defined-label">${t("version pinned (dependencyManagement) in:")}</span> ${dep.managedIn.map(p => { const rel = makeRelative(p, srcRoot); return `<code title="${esc(rel)}">${esc(RENDER_CTX.moduleNames?.get?.(p) || rel)}</code>`; }).join(", ")}</div>`
1540
+ ? `<div class="defined-in"><span class="defined-label">${t("version pinned (dependencyManagement) in:")}</span> ${dep.managedIn.map(p => { const rel = evidencePath(p, dep, srcRoot); return `<code title="${esc(rel)}">${esc(RENDER_CTX.moduleNames?.get?.(p) || rel)}</code>`; }).join(", ")}</div>`
1439
1541
  : "";
1440
1542
  return `<div class="defined-in"><span class="defined-label">${t("pulled in via:")}</span> ${chain} → ${tail}${alt}</div>${pinned}`;
1441
1543
  }
@@ -1447,7 +1549,7 @@ function renderDepOrigin(dep, srcRoot) {
1447
1549
  function renderEolSource(e) {
1448
1550
  const slug = e.productSlug || "";
1449
1551
  const link = slug ? `endoflife.date/${esc(slug)}` : "endoflife.date";
1450
- const rule = e.via ? `<br><span style="color:#6b7280">${t("matched via {rule} = {key}", { rule: esc(e.via), key: `<code>${esc(e.viaKey || "")}</code>` })}</span>` : "";
1552
+ const rule = e.via ? `<br><span style="color:#6b7280">${t("matched via {rule} = {key}", { rule: esc(e.via), key: `<code>${esc((e.dep?.manifestPaths?.includes(e.viaKey) ? evidencePath(e.viaKey,e.dep) : e.viaKey) || "")}</code>` })}</span>` : "";
1451
1553
  return `<span>${link}</span>${rule}`;
1452
1554
  }
1453
1555
 
@@ -1455,7 +1557,7 @@ function renderEolSource(e) {
1455
1557
  // (active support ended, security fixes still provided — shown only with --eol-support)
1456
1558
  // must never read as "EOL <future date>".
1457
1559
  function eolDateCell(e) {
1458
- return e.status === "unsupported" ? t("support ended {date}", { date: e.support || "?" }) : (e.eol || "");
1560
+ return e.status === "unsupported" ? t("regular support ended {date}", { date: e.support || "?" }) : (e.eol || "");
1459
1561
  }
1460
1562
  function eolNotesCell(e) {
1461
1563
  // Paid support past the open-source end of life does not clear the finding (its fixes
@@ -1509,7 +1611,7 @@ function eolComponentDeps(e) {
1509
1611
  // manifests — the group's manifests, the best available answer.
1510
1612
  const paths = (c.scope === "transitive" || (!c.manifestPaths && c.via && c.via.length)) ? []
1511
1613
  : (c.manifestPaths || d.manifestPaths || []);
1512
- return { label: c.name, version: c.version, dep, paths };
1614
+ return { label: c.name, version: c.version, dep:{...dep,artifactTargetId:d.artifactTargetId}, paths };
1513
1615
  });
1514
1616
  }
1515
1617
 
@@ -1528,10 +1630,10 @@ function declarationRows(label, version, dep, paths, cache) {
1528
1630
  return rows;
1529
1631
  }
1530
1632
  for (const p of paths) {
1531
- const rel = makeRelative(p, RENDER_CTX.srcRoot);
1633
+ const rel = evidencePath(p, dep, RENDER_CTX.srcRoot);
1532
1634
  const module = RENDER_CTX.moduleNames?.get?.(p);
1533
1635
  const mod = module && module !== rel ? `<div class="mod">${esc(module)}</div>` : "";
1534
- const hits = findDeclarations(p, dep, { cache });
1636
+ const hits = dep.artifactTargetId ? [] : findDeclarations(p, dep, { cache });
1535
1637
  if (!hits.length) {
1536
1638
  rows.push(`<tr><td class="dep">${esc(label)}</td><td>${esc(version || "?")}</td><td class="dep"><code>${esc(rel)}</code>${mod}</td><td class="decl"><span style="color:#9ca3af">${/(^|[\\/])pom\.xml$/i.test(p) && cache.get(p) != null ? t("no declaration in this POM — inherited from a parent or a reactor module") : t("declaration line not located")}</span></td></tr>`);
1537
1639
  continue;
@@ -1605,7 +1707,7 @@ function renderEolTable(eolResults) {
1605
1707
  <tr class="detail-row"><td colspan="6">${renderEolDetail(e)}</td></tr>`).join("\n")}</tbody>
1606
1708
  </table>`;
1607
1709
  const sub = (label, hint, list) => list.length
1608
- ? `<h4 class="eol-split">${esc(label)} (${list.length}) <span style="font-weight:normal;color:#6b7280">— ${esc(hint)}</span></h4>${table(list)}`
1710
+ ? minorSection(`${esc(label)} (${list.length}) <span style="font-weight:normal;color:#6b7280">— ${esc(hint)}</span>`,table(list),{level:4,collapsed:true})
1609
1711
  : "";
1610
1712
  const eolRows = eolResults.filter(e => e.status !== "unsupported");
1611
1713
  const unsRows = eolResults.filter(e => e.status === "unsupported");
@@ -1646,7 +1748,7 @@ function renderOutdatedTable(out) {
1646
1748
  });
1647
1749
  const rows = ranked.map(({ o, jump }) => `<tr class="jump-${esc(jump.kind)}">
1648
1750
  <td><span class="jump-badge jump-${esc(jump.kind)}">${esc(jump.label)}</span></td>
1649
- <td class="dep">${esc(depDisplayName(o.dep))}${renderDefinedIn(o.dep, RENDER_CTX.srcRoot)}</td>
1751
+ <td class="dep">${o.dep.cmsComponent ? esc(o.dep.cmsComponent.kind+' · '+o.dep.cmsComponent.name)+'<br><small>'+esc(depDisplayName(o.dep))+'</small>' : esc(depDisplayName(o.dep))}${renderDefinedIn(o.dep, RENDER_CTX.srcRoot)}</td>
1650
1752
  <td class="dep">${esc(o.dep.version || "?")}</td>
1651
1753
  <td class="dep">${esc(o.latest || "?")}</td>
1652
1754
  <td>${renderTimestamp(o.releaseDate || "")}</td>
@@ -1683,14 +1785,16 @@ function summaryCards(stats, eol, obs, out, extra = {}) {
1683
1785
  { v: stats.medium, l: t("Medium"), cls: "sev-medium" },
1684
1786
  { v: stats.low, l: t("Low"), cls: "sev-low" },
1685
1787
  ...(stats.kev ? [{ v: stats.kev, l: t("KEV exploited"), cls: "sev-kev" }] : []),
1686
- { v: stats.total, l: t("Total CVEs") },
1788
+ { v: stats.total, l: extra.system ? t("Production finding occurrences") : t("Total CVEs") },
1789
+ ...(extra.system ? [{ v: stats.distinctAdvisories, l: t("Distinct production advisories") }] : []),
1687
1790
  ...(extra.hasImages ? [
1688
1791
  { v: extra.imageCount, l: t("Image findings") },
1689
1792
  ...(extra.sourceCount ? [{ v: extra.sourceCount, l: t("Source findings") }] : []),
1690
1793
  ...(extra.sourceCount ? [{ v: extra.sourceStats.direct, l: t("in Direct") }, { v: extra.sourceStats.transitive, l: t("in Transitive") }] : []),
1691
1794
  ] : extra.hasSourceProject === false ? [] : [{ v: stats.direct, l: t("in Direct") }, { v: stats.transitive, l: t("in Transitive") }]),
1692
1795
  { v: extra.vendored ?? 0, l: t("Vendored JS"), cls: "sev-vendored" },
1693
- { v: eol?.length || 0, l: t("EOL") },
1796
+ { v: extra.system ? (eol || []).filter(e=>e.status !== "unsupported").length : eol?.length || 0, l: t("EOL") },
1797
+ ...(extra.system && eol?.some(e=>e.status === "unsupported") ? [{v:eol.filter(e=>e.status === "unsupported").length,l:t("Security maintenance")}] : []),
1694
1798
  { v: obs?.length || 0, l: t("Obsolete") },
1695
1799
  { v: out?.length || 0, l: t("Outdated") },
1696
1800
  ...(extra.licenseFlagged ? [{ v: extra.licenseFlagged, l: t("Licenses to review"), cls: "sev-medium" }] : []),
@@ -1717,7 +1821,7 @@ function mergeMatches(matches) {
1717
1821
  continue;
1718
1822
  }
1719
1823
  const existing = byKey.get(key);
1720
- existing.cve = { ...existing.cve, ...require('./advisory-fixes').mergeAdvisoryFixes(existing.cve,m.cve),
1824
+ existing.cve = { ...existing.cve, ...require('../advisories/fixes').mergeAdvisoryFixes(existing.cve,m.cve),
1721
1825
  aliases: [...new Set([...(existing.cve.aliases || []), ...(m.cve.aliases || [])])] };
1722
1826
  // Union of via paths
1723
1827
  const incoming = m.dep.viaPaths || (m.dep.via ? [m.dep.via] : []);
@@ -1772,7 +1876,7 @@ function renderApplicationSummary(applications = [], inventory = [], coverage =
1772
1876
  // The observed product version: the core for a CMS, the framework for Symfony/Laravel.
1773
1877
  const componentById = new Map(inventory.map(c => [c.id, c]));
1774
1878
  const versionByApp = new Map();
1775
- for (const kind of ["core", "framework"]) for (const c of inventory)
1879
+ for (const kind of ["core", "framework", "project"]) for (const c of inventory)
1776
1880
  if (c.kind === kind && c.applicationId && c.version && !versionByApp.has(c.applicationId)) versionByApp.set(c.applicationId, c.version);
1777
1881
  const rows = applications.slice().sort((a, b) => `${a.type || ""}/${a.root || ""}`.localeCompare(`${b.type || ""}/${b.root || ""}`)).map(app => {
1778
1882
  const appMatches = matches.filter(m => (m.applicationIds || []).includes(app.id));
@@ -1817,7 +1921,7 @@ function renderApplicationSummary(applications = [], inventory = [], coverage =
1817
1921
  : appMatches.length ? ""
1818
1922
  : !advisoryChecks.length ? t("No advisory check recorded.")
1819
1923
  : t("No matching advisory in the consulted data.");
1820
- return `<tr><td>${esc(app.type || "?")}</td><td><code>${esc(app.root || app.id)}</code></td>` +
1924
+ return `<tr><td>${esc(app.type || "?")}</td><td><code>${esc(evidencePath(app.root,app) || app.id)}</code></td>` +
1821
1925
  `<td>${esc(versionByApp.get(app.id) || "—")}</td>` +
1822
1926
  `<td>${direct}</td><td>${indirect}</td><td>${unknown}</td>` +
1823
1927
  `<td>${priority}</td><td>${coverageCell ? esc(coverageCell) : "—"}</td><td>${note}</td></tr>`;
@@ -1885,90 +1989,147 @@ function renderApplicationWarnings(warnings = []) {
1885
1989
  return minorSection(`${t("Warnings")} (${count})`, `<div class="warnings app-warnings">${blocks}</div>`);
1886
1990
  }
1887
1991
 
1888
- function renderApplicationCves(matches, applications = [], inventory = [], relations = [], warnings = []) {
1889
- const appById = new Map(applications.map(a => [a.id, a]));
1890
- const componentById = new Map(inventory.map(c => [c.id, c]));
1891
- const groups = new Map();
1892
- for (const m of matches) {
1893
- // One detail row per exposed instance: the same physical occurrence keeps its own
1894
- // origins in each application's section (plan §6.3), while global counters stay a
1895
- // union of findings.
1896
- for (const appId of (m.applicationIds?.length ? m.applicationIds : ["unknown"])) {
1897
- const { owners, relation } = perAppExposure(m, appId, relations, componentById);
1898
- const ownerKey = owners.length ? owners.map(owner => owner.id).sort().join("\0") : "unknown";
1899
- const key = `${appId}\0${ownerKey}`;
1900
- if (!groups.has(key)) groups.set(key, { appId, owners, relation, matches: [] });
1901
- groups.get(key).matches.push(m);
1992
+ // The unit of presentation is an installed instance. Module ownership annotates
1993
+ // the common tables; only explicitly private extensions have their own chapter.
1994
+ function renderInstanceFindings(app, items, checks, pairs, relations, warnings) {
1995
+ const {isExtension, extensionLayout, managerRelation, moduleSelf} = require('../applications/layout');
1996
+ const byId = new Map(items.map(c=>[c.id,c]));
1997
+ const layout = extensionLayout([app],items);
1998
+ const coreDir = new Map([['drupal','core'],['spip','plugins-dist'],['typo3','typo3/sysext']]).get(app.type);
1999
+ const corePrefix = coreDir && path.posix.join(app.documentRoot || app.root,coreDir)+'/';
2000
+ const privateModule = c => isExtension(c) && c.visibility === 'private' && !c.isCore &&
2001
+ !(corePrefix && c.path?.startsWith(corePrefix));
2002
+ const modules = items.filter(isExtension);
2003
+ const buckets = () => ({direct:[],indirect:[],unknown:[],devDirect:[],devIndirect:[],devUnknown:[]});
2004
+ const root = buckets(), publicDirect = new Map(), publicIndirect = new Map();
2005
+ const privateById = new Map(modules.filter(privateModule).map(c=>[c.id,buckets()]));
2006
+ const label = c => [c.kind,c.name || c.coord || evidencePath(c.path,app),c.version].filter(Boolean).join(' ');
2007
+ function store(bucket,m,dev,relation) {
2008
+ const key = ['direct','indirect'].includes(relation) ? relation : 'unknown';
2009
+ bucket[dev ? 'dev'+key[0].toUpperCase()+key.slice(1) : key].push(m);
2010
+ }
2011
+ function addPublic(groups,owners,m) {
2012
+ const key = JSON.stringify(owners.map(c=>c.id || c.path).sort());
2013
+ if (!groups.has(key)) groups.set(key,{owners,list:[]});
2014
+ groups.get(key).list.push(m);
2015
+ }
2016
+ for (const {m,dev} of pairs) {
2017
+ const exposure = perAppExposure(m,app.id,relations,byId);
2018
+ const dep = m.dep;
2019
+ const file = dep.artifactPath || dep.manifestPaths?.[0];
2020
+ const relative = file && makeRelative(file,RENDER_CTX.srcRoot);
2021
+ const physical = relative && layout.lookup(app,relative);
2022
+ let owners = exposure.owners.filter(isExtension);
2023
+ if (!owners.length && physical?.component) owners=[physical.component];
2024
+ if (!owners.length && physical?.path) owners=[{kind:t("Module path"),path:physical.path}];
2025
+ if (!owners.length) {
2026
+ const declared = managerRelation(dep);
2027
+ const rootDescriptor = relative && path.posix.dirname(relative)===app.root;
2028
+ const relation = rootDescriptor && dep.provenance!=='application' && declared!=='unknown'
2029
+ ? declared : exposure.relation || declared;
2030
+ store(root,m,dev,relation);
2031
+ continue;
1902
2032
  }
1903
- }
1904
- const byApp = new Map();
1905
- for (const group of groups.values()) {
1906
- if (!byApp.has(group.appId)) byApp.set(group.appId, []);
1907
- byApp.get(group.appId).push(group);
1908
- }
1909
- return [...byApp].sort(([a], [b]) => a.localeCompare(b)).map(([appId, ownerGroups]) => {
1910
- const app = appById.get(appId);
1911
- const appLabel = `${app?.type || "Application"} · ${app?.root || appId}`;
1912
- const sortedGroups = ownerGroups.sort((a, b) => {
1913
- const name = g => g.owners.map(o => o.name || o.coord || o.id).join(", ") || "Unknown origin";
1914
- return name(a).localeCompare(name(b));
1915
- });
1916
- const renderGroup = group => {
1917
- const ownerLabel = group.owners.length ? group.owners.map(o => `${o.kind || "component"} ${o.name || o.coord || o.id}${o.version ? ` ${o.version}` : ""}${o.visibility === "private" ? ` (${t("private")})` : ""}`).join(", ") : t("Unknown origin");
1918
- const otherApps = [...new Set(group.matches.flatMap(m => (m.applicationIds || [])
1919
- .filter(id => id !== group.appId)))];
1920
- const exposure = otherApps.length ? `<div class="fp-intro">${t("Also exposed in")}: ${otherApps.map(id => {
1921
- const app = appById.get(id);
1922
- return `<code>${esc(app?.root || id)}</code>`;
1923
- }).join(", ")}</div>` : "";
1924
- const direct = group.matches.filter(m => perAppExposure(m, group.appId, relations, componentById).relation === "direct");
1925
- const indirect = group.matches.filter(m => perAppExposure(m, group.appId, relations, componentById).relation === "indirect");
1926
- const unknown = group.matches.filter(m => !["direct", "indirect"].includes(perAppExposure(m, group.appId, relations, componentById).relation));
1927
- return minorSection(`${esc(ownerLabel)} (${group.matches.length})`,
1928
- exposure + (direct.length ? `<h4>${t("Direct")} (${direct.length})</h4>${renderCveTable(direct)}` : "") +
1929
- (indirect.length ? `<h4>${t("Indirect")} (${indirect.length})</h4>${renderCveTable(indirect)}` : "") +
1930
- (unknown.length ? `<h4>${t("Unknown origin")} (${unknown.length})</h4>${renderCveTable(unknown)}` : ""));
1931
- };
1932
- const privateGroups = sortedGroups.filter(g => g.owners.some(o => o.visibility === "private"));
1933
- const otherGroups = sortedGroups.filter(g => !g.owners.some(o => o.visibility === "private"));
1934
- const privateCount = privateGroups.reduce((n, g) => n + g.matches.length, 0);
1935
- const groupsHtml = (privateGroups.length ? minorSection(`${t("Private / custom components")} (${privateCount})`, privateGroups.map(renderGroup).join("")) : "") +
1936
- otherGroups.map(renderGroup).join("");
1937
- return minorSection(`${esc(appLabel)} (${ownerGroups.reduce((n, g) => n + g.matches.length, 0)})`,
1938
- renderApplicationWarnings(warnings.filter(w => w.applicationId === appId)) + groupsHtml);
1939
- }).join("");
2033
+ const publicOwners = {direct:[],indirect:[]};
2034
+ for (const c of owners) {
2035
+ const relevant = relations.filter(r=>r.applicationId===app.id && r.ownerComponentId===c.id &&
2036
+ r.depCoordKey===dep.coordKey && r.version===dep.version && dep.manifestPaths?.includes(r.manifestPath));
2037
+ const self = moduleSelf(dep,c) || (relevant.length ? relevant.some(r=>r.applicationRelation==='direct') :
2038
+ exposure.relation==='direct' && exposure.owners.some(o=>o.id===c.id));
2039
+ if (privateById.has(c.id)) {
2040
+ const atModule = c.path && relative && path.posix.dirname(relative)===c.path;
2041
+ store(privateById.get(c.id),m,dev,self ? 'direct' : atModule ? managerRelation(dep) : 'indirect');
2042
+ } else publicOwners[self ? 'direct' : 'indirect'].push(c);
2043
+ }
2044
+ if (publicOwners.direct.length) addPublic(publicDirect,publicOwners.direct,m);
2045
+ if (publicOwners.indirect.length) addPublic(publicIndirect,publicOwners.indirect,m);
2046
+ }
2047
+ const title = (text,n) => t(text)+' ('+n+')';
2048
+ const section = (name,list,relation) => minorSection(title(name,list.length),renderCveTable(list,{systemRelation:relation}));
2049
+ const unknown = list => list.length ? section("Unknown origin",list,'unknown') : '';
2050
+ function scopeSections(b) {
2051
+ return section("Direct dependencies",b.direct,'direct') + section("Transitive dependencies",b.indirect,'transitive') + unknown(b.unknown) +
2052
+ minorSection(title("Dev dependencies",b.devDirect.length+b.devIndirect.length+b.devUnknown.length),
2053
+ section("Direct",b.devDirect,'direct')+section("Indirect",b.devIndirect,'transitive')+unknown(b.devUnknown));
2054
+ }
2055
+ function publicSection(name,groups,relation) {
2056
+ const names = g => g.owners.map(label).sort().join(', ');
2057
+ const blocks=[...groups.values()].sort((a,b)=>names(a).localeCompare(names(b)));
2058
+ const content=blocks.map(g=>{
2059
+ const paths=g.owners.map(c=>c.path).filter(Boolean).map(p=>'<code>'+esc(evidencePath(p,app))+'</code>').join(', ');
2060
+ return `<p class="fp-intro"><strong>${esc(names(g))} (${g.list.length})</strong> ${paths}</p>`+
2061
+ renderCveTable(g.list,{systemRelation:relation});
2062
+ }).join('');
2063
+ return minorSection(title(name,new Set(blocks.flatMap(g=>g.list)).size),content || renderCveTable([]));
2064
+ }
2065
+ const paths = (app.evidence || []).map(e=>e.path).filter(Boolean);
2066
+ const intro = `<p><strong>${t("Root")}</strong> <code>${esc(evidencePath(app.root,app) || app.id)}</code></p>` +
2067
+ (paths.length ? '<p>'+[...new Set(paths)].map(p=>'<code>'+esc(evidencePath(p,app))+'</code>').join('<br>')+'</p>' : '') +
2068
+ `<h4>${t("Instance synthesis")} (1)</h4>` +
2069
+ renderApplicationSummary([app],items,checks,pairs.map(p=>p.m),relations);
2070
+ const also = [...new Set(pairs.flatMap(({m})=>m.applicationIds || []).filter(id=>id!==app.id))];
2071
+ const shared = also.length ? `<div class="fp-intro">${t("Also exposed in")}: ${also.map(id=>'<code>'+esc(id)+'</code>').join(', ')}</div>` : '';
2072
+ if (app.type==='project') return intro+scopeSections(root)+shared;
2073
+ const moduleInventory = minorSection(title("Module inventory",modules.length),renderComponentInventory([app],modules),{collapsed:true});
2074
+ const moduleSection = minorSection(title(["symfony","laravel"].includes(app.type) ? "Framework extensions" : "CMS modules and themes",modules.length),
2075
+ publicSection("Direct module and theme advisories",publicDirect,'direct')+
2076
+ publicSection("Indirect findings by module",publicIndirect,'transitive')+moduleInventory);
2077
+ const privateSections = modules.filter(privateModule).map(c=>minorSection(esc(label(c))+' ('+t("private")+')',
2078
+ (c.path ? '<p><code>'+esc(evidencePath(c.path,app))+'</code></p>' : '')+scopeSections(privateById.get(c.id)))).join('');
2079
+ return intro + shared + scopeSections(root) + moduleSection +
2080
+ minorSection(title("Private / custom components",privateById.size),privateSections || '<div class="empty">'+t("No private components inventoried.")+'</div>') + renderApplicationWarnings(warnings);
2081
+ }
2082
+
2083
+ function renderApplicationSection({applications, applicationInventory, coverage, applicationMatches, applicationDevMatches, applicationRelations, prodAppWarnings, devAppWarnings, instanceId}) {
2084
+ const pairs=[...applicationMatches.map(m=>({m,dev:!!m.dep.isDev})),...applicationDevMatches.map(m=>({m,dev:true}))];
2085
+ const instances = new Map(applications.map(a=>[a.id,a]));
2086
+ for (const {m} of pairs) for (const id of m.applicationIds || []) if (!instances.has(id))
2087
+ instances.set(id,{id,type:'Application',root:id});
2088
+ const warnings=[...new Set([...prodAppWarnings,...devAppWarnings])];
2089
+ const summary=require('../findings/summary').summarizeFindings(pairs.map(p=>p.m));
2090
+ const intro = summary.applicationUnique
2091
+ ? t("{n} unique physical finding(s); {exposures} application exposure(s).",{n:summary.applicationUnique,exposures:Object.values(summary.byApplication).reduce((n,v)=>n+v,0)})
2092
+ : t("No application CVE on the inventoried instances — synthesis and coverage below.");
2093
+ return `<div class="fp-intro">${intro}</div>`+[...instances.values()].map(app=>{
2094
+ const body=renderInstanceFindings(app,applicationInventory.filter(c=>c.applicationId===app.id),coverage.filter(c=>c.applicationId===app.id),
2095
+ pairs.filter(({m})=>m.applicationIds?.includes(app.id)),applicationRelations,warnings.filter(w=>w.applicationId===app.id));
2096
+ return instanceId ? body : minorSection(esc(app.type+' · '+app.root),body);
2097
+ }).join('');
1940
2098
  }
1941
2099
 
1942
- function renderApplicationInventory(applications = [], inventory = [], coverage = [], warnings = []) {
1943
- const appById = new Map(applications.map(a => [a.id, a]));
1944
- const componentById = new Map(inventory.map(c => [c.id, c]));
2100
+ function renderComponentInventory(applications,inventory) {
2101
+ const appById = new Map(applications.map(a=>[a.id,a]));
1945
2102
  const componentRows = inventory.map(c => {
1946
2103
  const app = appById.get(c.applicationId);
1947
- return `<tr><td>${esc(app?.type || c.applicationId)} · <code>${esc(app?.root || "?")}</code></td>` +
2104
+ const locked = c.versionConflict?.locked ? ' (composer.lock '+esc(c.versionConflict.locked)+')' : '';
2105
+ return `<tr><td>${esc(app?.type || c.applicationId)} · <code>${esc(evidencePath(app?.root,app) || "?")}</code></td>` +
1948
2106
  `<td>${esc(c.kind || "?")} · ${esc(c.name || c.coord || c.machineName || "?")}</td>` +
1949
- `<td>${esc(c.version || "unknown")}</td><td>${esc(c.visibility || "unknown")}</td>` +
1950
- `<td><code>${esc(c.path || "?")}</code></td></tr>`;
2107
+ `<td>${esc(c.version || "unknown")}${locked}</td><td>${esc(c.visibility || "unknown")}</td>` +
2108
+ `<td><code>${esc(evidencePath(c.path,app || c) || "?")}</code></td></tr>`;
1951
2109
  }).join("");
1952
- // Every coverage row names the component it is about: 14 identical "not evaluated"
1953
- // rows are 14 different themes, and an operator must be able to tell them apart.
2110
+ return (componentRows ? `<table><thead><tr><th>${t("Application")}</th><th>${t("Component")}</th><th>${t("Version")}</th><th>${t("Visibility")}</th><th>${t("Path")}</th></tr></thead><tbody>${componentRows}</tbody></table>` : `<div class="empty">${t("No application components inventoried.")}</div>`);
2111
+ }
2112
+
2113
+ function renderApplicationInventory(applications = [], inventory = [], coverage = [], warnings = [], visibleInventory = inventory) {
2114
+ const componentById = new Map(inventory.map(c => [c.id, c]));
1954
2115
  const coverageRows = coverage.map(c => {
1955
2116
  const component = c.occurrenceId ? componentById.get(c.occurrenceId) : null;
2117
+ const systemApp = RENDER_CTX.systemApps.get(c.applicationId);
2118
+ const instance = systemApp ? systemApp.type+' · '+targetPath(systemApp.root) : c.applicationId;
1956
2119
  const componentCell = component
1957
2120
  ? `${esc(component.kind || "component")} · ${esc(component.name || component.coord || component.id)}<br/>` +
1958
- `<code>${esc(component.path || "?")}</code><br/><code>${esc(c.occurrenceId)}</code>`
2121
+ `<code>${esc(evidencePath(component.path,component) || "?")}</code>${systemApp ? "" : "<br/><code>"+esc(c.occurrenceId)+"</code>"}`
1959
2122
  : c.occurrenceId ? `<code>${esc(c.occurrenceId)}</code>` : "—";
1960
- return `<tr><td>${esc(c.applicationId)}</td><td>${esc(capabilityLabel(c.capability))}` +
2123
+ return `<tr><td>${esc(instance)}</td><td>${esc(capabilityLabel(c.capability))}` +
1961
2124
  (c.sourceId ? ` · ${esc(c.sourceId)}` : "") + `</td><td>${componentCell}</td>` +
1962
2125
  `<td>${esc(executionLabel(c.execution))}</td><td>${esc(resultLabel(c.result))}</td>` +
1963
2126
  `<td>${esc(String(c.executed || 0))}/${esc(String(c.expected || 0))}</td><td>${esc(c.diagnostic || "—")}</td></tr>`;
1964
2127
  }).join("");
1965
2128
  const warningSections = applications.filter(app => warnings.some(w => w.applicationId === app.id))
1966
- .map(app => minorSection(`${esc(app.type || "Application")} · ${esc(app.root || app.id)}`,
2129
+ .map(app => minorSection(`${esc(app.type || "Application")} · ${esc(evidencePath(app.root,app) || app.id)}`,
1967
2130
  renderApplicationWarnings(warnings.filter(w => w.applicationId === app.id)))).join("");
1968
- return warningSections + `<h3>${t("Application components")} (${inventory.length})</h3>` +
1969
- (componentRows ? `<table><thead><tr><th>${t("Application")}</th><th>${t("Component")}</th><th>${t("Version")}</th><th>${t("Visibility")}</th><th>${t("Path")}</th></tr></thead><tbody>${componentRows}</tbody></table>` : `<div class="empty">${t("No application components inventoried.")}</div>`) +
1970
- `<h3>${t("Application coverage")} (${coverage.length})</h3>` +
1971
- (coverageRows ? `<table><thead><tr><th>${t("Application")}</th><th>${t("Capability / source")}</th><th>${t("Component")}</th><th>${t("Execution")}</th><th>${t("Result")}</th><th>${t("Checked")}</th><th>${t("Diagnostic")}</th></tr></thead><tbody>${coverageRows}</tbody></table>` : `<div class="empty">${t("No application checks recorded.")}</div>`);
2131
+ return warningSections + minorSection(`${t("Application components")} (${visibleInventory.length})`,renderComponentInventory(applications,visibleInventory),{collapsed:true}) +
2132
+ minorSection(`${t("Application coverage")} (${coverage.length})`,coverageRows ? `<table><thead><tr><th>${t("Application")}</th><th>${t("Capability / source")}</th><th>${t("Component")}</th><th>${t("Execution")}</th><th>${t("Result")}</th><th>${t("Checked")}</th><th>${t("Diagnostic")}</th></tr></thead><tbody>${coverageRows}</tbody></table>` : `<div class="empty">${t("No application checks recorded.")}</div>`,{collapsed:true});
1972
2133
  }
1973
2134
 
1974
2135
  function attachRootUpdates(cveMatches, outdatedResults, resolvedDeps) {
@@ -1984,8 +2145,7 @@ function attachRootUpdates(cveMatches, outdatedResults, resolvedDeps) {
1984
2145
  }
1985
2146
  }
1986
2147
 
1987
- // Every chapter / sub-chapter renders EXPANDED by default (the user wants the whole
1988
- // report open on load). The `open` opt is accepted for call-site compatibility but
2148
+ // Sections open on load except for explicitly collapsed component inventories. The `open` opt is accepted for call-site compatibility but
1989
2149
  // intentionally ignored — collapse is still available via the toolbar / clicking a
1990
2150
  // header. (Per-CVE detail rows are NOT <details>, so they stay collapsed-by-default.)
1991
2151
  function majorSection(title, contentHtml, opts = {}) {
@@ -2000,8 +2160,9 @@ function majorSection(title, contentHtml, opts = {}) {
2000
2160
  function minorSection(title, contentHtml, opts = {}) {
2001
2161
  const { id } = opts;
2002
2162
  const idAttr = id ? ` id="${esc(id)}"` : "";
2003
- return `<details class="report-subsection" open${idAttr}>
2004
- <summary><h3>${title}</h3></summary>
2163
+ const tag = opts.level === 4 ? "h4" : "h3";
2164
+ return `<details class="report-subsection"${opts.collapsed ? "" : " open"}${idAttr}>
2165
+ <summary><${tag}>${title}</${tag}></summary>
2005
2166
  <div>${contentHtml}</div>
2006
2167
  </details>`;
2007
2168
  }
@@ -2014,7 +2175,7 @@ function numberedSubsections(chapter, entries) {
2014
2175
  html: present.map((e, i) => {
2015
2176
  const number = `${chapter}.${i + 1}`;
2016
2177
  return minorSection(`${number} ${e.title}`, typeof e.content === "function" ? e.content(number) : e.content,
2017
- { id: e.id });
2178
+ { id: e.id, collapsed:e.collapsed });
2018
2179
  }).join(""),
2019
2180
  toc: present.map(e => ({ id: e.id, label: e.nav })),
2020
2181
  };
@@ -2186,7 +2347,7 @@ function execWeakness(m) {
2186
2347
  return m.cve.id || t("an unspecified weakness");
2187
2348
  }
2188
2349
 
2189
- function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, topImageMatches, nativeBinaryCount = 0, hasImages = false, interactive = false }) {
2350
+ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats, eolResults, obsoleteResults, outdatedResults, warnings, totalDeps, topCriticalMatches, topImageMatches, nativeBinaryCount = 0, system = false, hasImages = false, interactive = false }) {
2190
2351
  const unsN = (eolResults || []).filter(e => e.status === "unsupported").length;
2191
2352
  const eolN = (eolResults?.length || 0) - unsN; // true end-of-life only
2192
2353
  const obsN = obsoleteResults?.length || 0;
@@ -2203,7 +2364,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2203
2364
 
2204
2365
  const top = topCriticalMatches || [];
2205
2366
  const imageTop = topImageMatches || [];
2206
- const topEol = pickTopEol(eolResults, 2);
2367
+ const topEol = pickTopEol(system ? eolResults?.filter(e=>e.status !== "unsupported") : eolResults, 2);
2207
2368
 
2208
2369
  const cweChipHtml = (id, name) => `<span class="exec-cwe" title="${esc(id)}${name ? ": " + esc(name) : ""}"><span class="exec-cwe-id">${esc(id)}</span>${name ? `<span class="exec-cwe-name">${esc(name)}</span>` : ""}</span>`;
2209
2370
 
@@ -2219,7 +2380,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2219
2380
  ? `<span class="exec-scope-tag" title="${esc(t("Pulled in transitively — fewer than {n} direct production findings, so the worst transitive ones fill the rest", { n: top.length }))}">${t("transitive")}</span>` : "";
2220
2381
  return `<li>
2221
2382
  ${badge((m.cve.severity || "HIGH").toUpperCase())}
2222
- <a class="exec-cve-link" href="#${m.dep?.artifactTargetId ? "chimages-cves" : m.applicationIds?.length ? "chapps" : "ch1"}">${esc(m.cve.id)}</a>
2383
+ <a class="exec-cve-link" href="#${esc(m.reportAnchor || (m.dep?.artifactTargetId ? "chimages-cves" : m.applicationIds?.length ? "chapps" : "ch1"))}">${esc(m.cve.id)}</a>
2223
2384
  <code>${esc(depDisplayName(m.dep))}</code>
2224
2385
  <span class="exec-ver">${esc(m.dep.version || "?")}</span>
2225
2386
  ${m.cve.fixVersion ? `<span class="exec-fix">${t("Advisory candidate")}: ${esc(m.cve.fixVersion)}</span>` : ""}
@@ -2228,15 +2389,15 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2228
2389
  </li>`;
2229
2390
  }).join("")}</ul>
2230
2391
  </div>` : "";
2231
- const topBlock = renderTop(top, hasImages ? t("Top {n} most critical · production findings", { n: top.length }) : t("Top {n} most critical · direct production dependencies", { n: top.length }));
2392
+ const topBlock = renderTop(top, hasImages || system ? t("Top {n} most critical · production findings", { n: top.length }) : t("Top {n} most critical · direct production dependencies", { n: top.length }));
2232
2393
  const imageHeading = t("Top {n} most critical · images to update", { n: imageTop.length });
2233
2394
  const imageLine = group => {
2234
2395
  const artifact = group.artifact, update = artifact.imageUpdate;
2235
2396
  const target = update?.status === 'available' && update.targetTag && update.targetReference ? update.targetReference : null;
2236
- return { title: require('./artifacts/report').artifactTitle(artifact, projectInfo?.artifacts || []), target, matches: group.matches };
2397
+ return { title: require('../artifacts/report').artifactTitle(artifact, projectInfo?.artifacts || []), target, matches: group.matches };
2237
2398
  };
2238
2399
  const imageLines = imageTop.map(imageLine);
2239
- const imageTopBlock = imageLines.length ? `<div class="exec-top"><div class="exec-top-title">${esc(imageHeading)}</div><ul class="exec-top-list">${imageLines.map((group, i) => `<li><a class="exec-cve-link" href="#${require('./artifacts/report').artifactAnchor(imageTop[i].artifact.id)}">${esc(group.title)}</a>${group.target ? ` <span class="exec-fix">${t('Image update candidate')}: <code>${esc(group.target)}</code></span>` : ''}<span>${group.matches.map(m => `${badge((m.cve.severity || 'UNKNOWN').toUpperCase())} <a class="exec-cve-link exec-image-cve" href="#chimages-cves">${esc(m.cve.id)}</a> ${(m.cve.cwes || []).map(c => cweChipHtml(c, cweName(c))).join('')}`).join(' · ')}</span></li>`).join('')}</ul></div>` : '';
2400
+ const imageTopBlock = imageLines.length ? `<div class="exec-top"><div class="exec-top-title">${esc(imageHeading)}</div><ul class="exec-top-list">${imageLines.map((group, i) => `<li><a class="exec-cve-link" href="#${require('../artifacts/report').artifactAnchor(imageTop[i].artifact.id)}">${esc(group.title)}</a>${group.target ? ` <span class="exec-fix">${t('Image update candidate')}: <code>${esc(group.target)}</code></span>` : ''}<span>${group.matches.map(m => `${badge((m.cve.severity || 'UNKNOWN').toUpperCase())} <a class="exec-cve-link exec-image-cve" href="#chimages-cves">${esc(m.cve.id)}</a> ${(m.cve.cwes || []).map(c => cweChipHtml(c, cweName(c))).join('')}`).join(' · ')}</span></li>`).join('')}</ul></div>` : '';
2240
2401
 
2241
2402
  // ---- Block 2: the 2 most-overdue end-of-life frameworks ----
2242
2403
  const eolWhen = e => e.status === "unsupported"
@@ -2254,11 +2415,11 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2254
2415
 
2255
2416
  // ---- Block 3: totals, including the findings highlighted above ----
2256
2417
  const restParts = [];
2257
- if (prodStats.total) restParts.push(`<strong>${prodStats.total}</strong> ${t(hasImages ? "CVE findings" : "production CVE")} (critical=${prodStats.critical}, high=${prodStats.high}, medium=${prodStats.medium}, low=${prodStats.low})`);
2258
- if (devStats.total) restParts.push(`<strong>${devStats.total}</strong> ${t("dev/test CVE")}`);
2418
+ if (prodStats.total) restParts.push(`<strong>${prodStats.total}</strong> ${system ? t("Production finding occurrences") + " · " + prodStats.distinctAdvisories + " " + t("Distinct production advisories") : t(hasImages ? "CVE findings" : "production CVE")} (critical=${prodStats.critical}, high=${prodStats.high}, medium=${prodStats.medium}, low=${prodStats.low})`);
2419
+ if (devStats.total) restParts.push(`<strong>${devStats.total}</strong> ${t(system ? "Development finding occurrences" : "dev/test CVE")}`);
2259
2420
  if (retireStats.total) restParts.push(`<strong>${retireStats.total}</strong> ${t("vulnerable vendored-JS")}`);
2260
2421
  if (eolN) restParts.push(`<strong>${eolN}</strong> ${eolN > 1 ? t("EOL frameworks") : t("EOL framework")}`);
2261
- if (unsN) restParts.push(`<strong>${unsN}</strong> ${t("out of active support")}`);
2422
+ if (unsN) restParts.push(`<strong>${unsN}</strong> ${t(system ? "Security maintenance" : "out of active support")}`);
2262
2423
  // The count is handed over even though the English word does not inflect: it is the
2263
2424
  // grammatical number, and the French entry is a [singular, plural] pair.
2264
2425
  if (obsN) restParts.push(`<strong>${obsN}</strong> ${t("obsolete", { n: obsN })}`);
@@ -2291,7 +2452,7 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2291
2452
  const restText = stripTags(restParts.join(" · ")) || t("no findings");
2292
2453
  // NB: the loops below must not name their item `t` — it would shadow the translator.
2293
2454
  // The count is a placeholder, not a prefix: "Top 2 les plus critiques" is not French.
2294
- const critHeading = n => hasImages ? t("Top {n} most critical · production findings", { n }) : t("Top {n} most critical (direct production dependencies):", { n });
2455
+ const critHeading = n => hasImages || system ? t("Top {n} most critical · production findings", { n }) : t("Top {n} most critical (direct production dependencies):", { n });
2295
2456
  const eolHeading = n => n > 1 ? t("Top {n} end-of-life frameworks:", { n }) : t("Top end-of-life framework:");
2296
2457
  const critSentence = x => t('The library "{lib}" version "{ver}" is vulnerable to "{weakness}" ( {crit} )',
2297
2458
  { lib: x.lib, ver: x.ver, weakness: x.weakness, crit: x.crit });
@@ -2357,23 +2518,23 @@ function renderExecutiveSummary({ projectInfo, prodStats, devStats, retireStats,
2357
2518
  }
2358
2519
 
2359
2520
  function warningMessage(w) {
2360
- if (w.type === "image-unpinned") return esc(t(require('./image-references').UNPINNED_IMAGE_MESSAGE));
2521
+ if (w.type === "image-unpinned") return esc(t(require('../images/references').UNPINNED_IMAGE_MESSAGE));
2361
2522
  if (w.type === "image-source-unavailable") return esc(t("Some images or their advisory data are unavailable from public sources. See the affected images and reasons below."));
2362
- if (w.type === "cve-enrichment-summary") return esc(require('./cve-record-coverage').formatCveRecordWarning(w, RENDER_CTX.locale));
2523
+ if (w.type === "cve-enrichment-summary") return esc(require('../findings/cve-record-coverage').formatCveRecordWarning(w, RENDER_CTX.locale));
2363
2524
  if (w.type === "commercial-build") {
2364
2525
  const until = w.until && w.until !== "true" ? t(" (until {date})", { date: esc(w.until) }) : "";
2365
2526
  return t("{coord} {version} is not on Maven Central and is newer than the last public {product} {cycle} release ({lastPublic}): a vendor build under paid support{until}.",
2366
2527
  { coord: `<code>${esc(w.coord)}</code>`, version: `<code>${esc(w.version)}</code>`, product: esc(w.product), cycle: esc(w.cycle), lastPublic: esc(w.lastPublic), until });
2367
2528
  }
2368
2529
  return w.type === 'cms-coverage' && w.capability
2369
- ? `${esc(w.applicationId || "application")} — ${esc(capabilityLabel(w.capability))}` +
2530
+ ? `${esc(w.applicationLabel || w.applicationId || "application")} — ${esc(capabilityLabel(w.capability))}` +
2370
2531
  `${w.sourceId ? ` (${esc(w.sourceId)})` : ""}: ${esc(executionLabel(w.execution))} — ` +
2371
2532
  `${esc(t("{n} component(s) not evaluated", { n: w.count || 0 }))} (${esc(w.diagnostic || w.code || "CMS_INCOMPLETE")}). ` +
2372
2533
  `${esc(diagnosticAction(w.diagnostic || w.code || "CMS_INCOMPLETE"))}`
2373
2534
  : renderTextWithTimestamps(w.message || "");
2374
2535
  }
2375
2536
 
2376
- const freshnessNotice = require('./report-notices').legacyFreshness;
2537
+ const freshnessNotice = require('./notices').legacyFreshness;
2377
2538
  function renderFreshnessNotices(notices) {
2378
2539
  if (!notices.length) return '';
2379
2540
  const pills = notices.filter(n => n.source).map(n => `<span class="freshness-pill" title="${esc(n.message)}"><strong>${esc(n.source)}</strong> · ${n.at ? renderTimestamp(n.at) : esc(t('unknown date'))}</span>`).join(' ');
@@ -2387,15 +2548,16 @@ function renderWarnings(warnings) {
2387
2548
  // intentionally broken CMS test fixture — are grouped into one navigable block per
2388
2549
  // type. Every manifest stays listed with its own detail, and the JSON export keeps one
2389
2550
  // entry per manifest, so the grouping hides noise without hiding coverage loss.
2390
- const {groupReportWarnings,warningScope} = require('./report-notices');
2391
- const prepared = groupReportWarnings(warnings);
2551
+ const {groupReportWarnings,warningScope} = require('./notices');
2552
+ const prepared = groupReportWarnings(warnings,RENDER_CTX.systemIds);
2392
2553
  const renderBlock = w => {
2393
2554
  const meta = WARNING_HEADINGS[w.type] || { icon: "⚠️", title: w.type };
2394
2555
  const itemLimit = w._groupedDiagnostics ? (w.items||[]).length : w.type === "private-libs" ? 200 : 50;
2395
- const warningItems = [...(w.items || []), ...(w.artifactTargetId ? [{id:w.artifactTargetId,artifactTargetId:w.artifactTargetId}] : [])];
2556
+ const warningItems = [...(w.items || []), ...(w.artifactTargetId && !RENDER_CTX.systemIds.has(w.artifactTargetId) ? [{id:w.artifactTargetId,artifactTargetId:w.artifactTargetId}] : [])];
2396
2557
  const details = renderWarningItems(warningItems, itemLimit);
2397
- const items = w._groupedDiagnostics && details ? `<details class="warning-details"><summary>${esc(t('Details'))} (${w.items.length})</summary>${details}</details>` : details;
2398
- const manifest = w.manifestPath ? `<div class="warn-path"><code>${esc(makeRelative(w.manifestPath, RENDER_CTX.srcRoot))}</code></div>` : "";
2558
+ const items = w.items?.length && details ? `<details class="warning-details"><summary>${esc(t('Details'))} (${w.items.length})</summary>${details}</details>` : details;
2559
+ const file = w.manifestPath || w.path;
2560
+ const manifest = file ? `<div class="warn-path"><code>${esc(evidencePath(file,w,RENDER_CTX.srcRoot))}</code></div>` : "";
2399
2561
  // Structured CMS coverage groups (one per application/capability/source/diagnostic
2400
2562
  // cause) render their reason, their action and their component list in the
2401
2563
  // report's language instead of a raw per-check English message.
@@ -2409,12 +2571,13 @@ function renderWarnings(warnings) {
2409
2571
  };
2410
2572
  const groups = [
2411
2573
  {scope:'project', label:t('Project scan warnings')},
2574
+ {scope:'system', label:t('Host system warnings')},
2412
2575
  {scope:'image', label:t('Image scan warnings')},
2413
2576
  {scope:'global', label:t('Shared source warnings')},
2414
2577
  ];
2415
2578
  const sections = groups.map(({scope,label}) => {
2416
- const entries=prepared.filter(w => warningScope(w)===scope);
2417
- return entries.length ? `<section class="warning-scope warning-scope-${scope}"><h3>${esc(label)}</h3>${entries.map(renderBlock).join('')}</section>` : '';
2579
+ const entries=prepared.filter(w => warningScope(w,RENDER_CTX.systemIds)===scope);
2580
+ return entries.length ? `<section class="warning-scope warning-scope-${scope}">${minorSection(esc(label),entries.map(renderBlock).join(''))}</section>` : '';
2418
2581
  }).join('');
2419
2582
  return `<div class="warnings warnings-chapter">${sections}</div>`;
2420
2583
  }
@@ -2431,16 +2594,20 @@ function renderWarningItems(items, itemLimit) {
2431
2594
  const lis = shown.map(it => {
2432
2595
  if (typeof it === "string") return `<li><code>${esc(it)}</code></li>`;
2433
2596
  const artifact = it.artifactTargetId && RENDER_CTX.artifacts?.find(a=>a.id===it.artifactTargetId);
2434
- const id = artifact ? require("./artifacts/report").artifactTitle(artifact, RENDER_CTX.artifacts) : it.pathItem ? makeRelative(it.id || "", RENDER_CTX.srcRoot) : it.id || "";
2597
+ const system = RENDER_CTX.systemIds.has(it.artifactTargetId);
2598
+ let id = it.pathItem ? evidencePath(it.id,it,RENDER_CTX.srcRoot) : it.id;
2599
+ if (artifact && !system) id = require("../artifacts/report").artifactTitle(artifact,RENDER_CTX.artifacts);
2600
+ else if (system && id===it.artifactTargetId) id=artifact.metadata.partition || '';
2435
2601
  const detail = it.detail ? `<div class="warn-defined">${esc(it.detail)}</div>` : "";
2436
- const paths = (it.manifestPaths || []).slice(0, 6);
2602
+ const allPaths = (it.manifestPaths || []).filter(p=>!system || p!==id);
2603
+ const paths = allPaths.slice(0,6);
2437
2604
  const pathsHtml = paths.length
2438
- ? `<div class="warn-defined">${t("defined in:")} ${paths.map(p => `<code class="path">${esc(makeRelative(p, RENDER_CTX.srcRoot))}</code>`).join(", ")}${it.manifestPaths.length > paths.length ? ` <span class="warn-defined-more">${t("+{n} more", { n: it.manifestPaths.length - paths.length })}</span>` : ""}</div>`
2605
+ ? `<div class="warn-defined">${t("defined in:")} ${paths.map(p => `<code class="path">${esc(evidencePath(p,{artifactTargetId:it.artifactTargetId || it.declaredInTargetId},RENDER_CTX.srcRoot))}</code>`).join(", ")}${allPaths.length > paths.length ? ` <span class="warn-defined-more">${t("+{n} more", { n: allPaths.length - paths.length })}</span>` : ""}</div>`
2439
2606
  : "";
2440
- return `<li><code>${esc(id)}</code>${pathsHtml}${detail}</li>`;
2607
+ return id || pathsHtml || detail ? `<li>${id ? "<code>"+esc(id)+"</code>" : ""}${pathsHtml}${detail}</li>` : "";
2441
2608
  }).join("");
2442
2609
  const overflow = items.length > itemLimit ? `<li class="more">${t("…and {n} more", { n: items.length - itemLimit })}</li>` : "";
2443
- return `<ul class="warn-items">${lis}${overflow}</ul>`;
2610
+ return lis || overflow ? `<ul class="warn-items">${lis}${overflow}</ul>` : "";
2444
2611
  }
2445
2612
 
2446
2613
  const LICENSE_CAT_META = {
@@ -2469,8 +2636,8 @@ function renderLicenseChapter(licenseResults) {
2469
2636
  </tr>`;
2470
2637
  }).join("");
2471
2638
  return `<div class="lic-group ${meta.cls}">
2472
- <h3 class="lic-h">${esc(t(meta.label))} <span class="lic-n">${byCategory[cat].length}</span></h3>
2473
- <table><thead><tr><th>${t("Dependency")}</th><th>${t("License(s)")}</th><th>${t("Source")}</th></tr></thead><tbody>${rows}</tbody></table>
2639
+ ${minorSection(`${esc(t(meta.label))} <span class="lic-n">${byCategory[cat].length}</span>`,
2640
+ `<table><thead><tr><th>${t("Dependency")}</th><th>${t("License(s)")}</th><th>${t("Source")}</th></tr></thead><tbody>${rows}</tbody></table>`,{collapsed:true})}
2474
2641
  </div>`;
2475
2642
  }).join("");
2476
2643
  const flaggedN = licenseResults.flagged?.length || 0;
@@ -2480,12 +2647,38 @@ function renderLicenseChapter(licenseResults) {
2480
2647
  return intro + blocks;
2481
2648
  }
2482
2649
 
2650
+ // Format target diagnostics before grouping. Old snapshots sometimes stored the
2651
+ // archive path only in the diagnostic message, without a separate path field.
2652
+ function targetWarning(w) {
2653
+ if (!w || (!w.artifactTargetId && !w.items?.some(it=>it?.declaredInTargetId || it?.artifactTargetId))) return w;
2654
+ const application = RENDER_CTX.systemApps.get(w.applicationId);
2655
+ const applicationLabel = application && application.type+' · '+targetPath(application.root);
2656
+ const message = w.artifactTargetId ? require('../artifacts/report-path').targetWarningMessage(w,file=>evidencePath(file,w),applicationLabel) : w.message;
2657
+ return {...w,message,applicationLabel,...(w.path && {path:evidencePath(w.path,w)}),
2658
+ ...(w.manifestPath && {manifestPath:evidencePath(w.manifestPath,w)}),
2659
+ ...(w.items && {items:w.items.map(it=>{
2660
+ if (it?.id===w.applicationId && applicationLabel) it={...it,id:applicationLabel};
2661
+ if (!it?.manifestPaths?.length) return it;
2662
+ const owner = {artifactTargetId:it.declaredInTargetId || it.artifactTargetId || w.artifactTargetId};
2663
+ if (!owner.artifactTargetId) return it;
2664
+ const paths = it.manifestPaths.map(file=>evidencePath(file,owner));
2665
+ const first = it.manifestPaths[0];
2666
+ const detail = it.detail && (it.detail===first || it.detail.startsWith(first+':') || it.detail.startsWith(first+' ('))
2667
+ ? paths[0]+it.detail.slice(first.length) : it.detail;
2668
+ return {...it,manifestPaths:paths,detail};
2669
+ })})};
2670
+ }
2671
+
2483
2672
  function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches, vendoredJsInventory, certFindings, eolResults, obsoleteResults, outdatedResults, licenseResults, excludedDirs = [], resolvedDeps, projectInfo, warnings, parsedManifests = [], diff = null, applications = [], applicationInventory = [], applicationRelations = [], coverage = [], wrapTables = true, locale = "en" }) {
2484
- setRenderCtx({ srcRoot: projectInfo?.src || null, artifacts:projectInfo?.artifacts || [], locale });
2673
+ const artifacts = projectInfo?.artifacts || [];
2674
+ const systemIds = new Set(artifacts.filter(a => a.metadata?.systemApplications).map(a => a.id));
2675
+ const systemApps = new Map(artifacts.flatMap(a=>(a.metadata?.systemApplications?.applications || []).map(app=>[app.id,app])));
2676
+ setRenderCtx({ srcRoot: projectInfo?.src || null, artifacts, systemIds, systemApps, sbomIds:new Set(artifacts.filter(a=>a.kind==="sbom").map(a=>a.id)), locale });
2677
+ if (artifacts.length && warnings) warnings = warnings.map(targetWarning);
2485
2678
  // Module names for BOTH the "most vulnerable components" chart and every cell's
2486
2679
  // "defined in" label. Resolved here, before a single table is rendered, because
2487
2680
  // renderDefinedIn reads them from the render context.
2488
- const { resolveModuleNames } = require("./module-names");
2681
+ const { resolveModuleNames } = require("../inventory/module-names");
2489
2682
  const moduleNames = resolveModuleNames(parsedManifests, { srcRoot: projectInfo?.src || null });
2490
2683
  setRenderCtx({ moduleNames, resolvedDeps: resolvedDeps || null });
2491
2684
  // Dedupe rows so a single (dep, cve) shows once with all via paths merged.
@@ -2494,9 +2687,15 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2494
2687
  embeddedMatches = mergeMatches(embeddedMatches || []);
2495
2688
  // Preserve distribution verdicts for inventory/update evidence; the CVE chapter
2496
2689
  // presents the explicitly identified CVEs, with their advisory provenance.
2497
- const rawImageMatches = mergeMatches([...cveMatches, ...devCveMatches, ...embeddedMatches].filter(m => m.dep?.artifactTargetId && !m.cpeFiltered));
2498
- const { projectImageCves } = require("./artifacts/cve-view");
2499
- const imageView = matches => [...matches.filter(m => !m.dep?.artifactTargetId), ...projectImageCves(matches.filter(m => m.dep?.artifactTargetId))];
2690
+ const system = systemIds.size ? require('../artifacts/system-report').buildSystemSections({
2691
+ projectInfo, matches:mergeMatches([...cveMatches, ...devCveMatches, ...embeddedMatches]), locale, systemIds, warnings, applicationRelations,
2692
+ }, {esc, minorSection, renderCveTable, renderInstanceFindings}) : null;
2693
+ const imageArtifacts = system ? system.images : artifacts;
2694
+ const imageInfo = system ? {...projectInfo, artifacts:imageArtifacts} : projectInfo;
2695
+ const isContainer = m => m.dep?.artifactTargetId && !systemIds.has(m.dep.artifactTargetId);
2696
+ const rawImageMatches = mergeMatches([...cveMatches, ...devCveMatches, ...embeddedMatches].filter(m => isContainer(m) && !m.cpeFiltered));
2697
+ const { projectImageCves } = require("../artifacts/cve-view");
2698
+ const imageView = matches => [...matches.filter(m => !isContainer(m)), ...projectImageCves(matches.filter(isContainer))];
2500
2699
  cveMatches = imageView(cveMatches);
2501
2700
  devCveMatches = imageView(devCveMatches);
2502
2701
  embeddedMatches = imageView(embeddedMatches);
@@ -2520,28 +2719,29 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2520
2719
  const retireStats = computeStats(retireMatches);
2521
2720
 
2522
2721
  // Recos are built from prod matches only (dev/test issues aren't a release blocker).
2523
- const sourceMatches = prodMatchesActive.filter(m => !m.dep?.artifactTargetId);
2722
+ const sourceMatches = system ? system.projectMatches.filter(m=>!m.dep.isDev) : prodMatchesActive.filter(m => !m.dep?.artifactTargetId);
2524
2723
  const recos = buildFixRecommendations(sourceMatches, outdatedResults, resolvedDeps);
2525
- const imageMatches = mergeMatches([...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(m => m.dep?.artifactTargetId));
2724
+ const imageMatches = mergeMatches([...prodMatchesActive, ...devMatchesActive, ...embMatchesActive].filter(isContainer));
2526
2725
  // Image inventory findings are presented together regardless of the input
2527
2726
  // lane. Count each of those occurrences once in the overview as well.
2528
- const overviewProdStats = computeStats([...sourceMatches, ...imageMatches]);
2529
- const overviewDevStats = computeStats(devMatchesActive.filter(m => !m.dep?.artifactTargetId));
2530
- const { renderImageCves, renderArtifactEvidence, artifactGroups, artifactAnchor, artifactTitle } = require("./artifacts/report");
2531
- const hasImages = Boolean(projectInfo?.artifacts?.length || projectInfo?.imageReferences?.length || rawImageMatches.length);
2532
- const hasScannedImages = Boolean(projectInfo?.artifacts?.length || rawImageMatches.length);
2533
- const hasSourceProject = !!(parsedManifests.length || applications.length || applicationInventory.length || [...(resolvedDeps?.values?.() || [])].some(d => d.provenance !== 'binary' && !d.artifactTargetId && d.manifestPaths?.length) || sourceMatches.some(m => m.dep?.provenance !== 'binary' && m.dep?.manifestPaths?.length));
2534
- const chapterOffset = hasImages ? 1 : 0;
2535
- const sourceDeps = new Map([...(resolvedDeps || [])].filter(([, d]) => !d.artifactTargetId));
2727
+ const overviewProdStats = computeStats([...sourceMatches, ...(system?.hostFindings || []), ...imageMatches]);
2728
+ const devSourceMatches = system ? system.projectMatches.filter(m=>m.dep.isDev) : devMatchesActive.filter(m=>!m.dep?.artifactTargetId);
2729
+ const overviewDevStats = computeStats(devSourceMatches);
2730
+ const { renderImageCves, renderArtifactEvidence, artifactGroups, artifactAnchor, artifactTitle } = require("../artifacts/report");
2731
+ const hasImages = system ? system.inspectImages : Boolean(projectInfo?.artifacts?.length || projectInfo?.imageReferences?.length || rawImageMatches.length);
2732
+ const hasScannedImages = Boolean(imageArtifacts.length || rawImageMatches.length);
2733
+ const hasSourceProject = system ? system.chartApps.length > 0 || sourceMatches.length > 0 : !!(sourceMatches.length || parsedManifests.length || applications.length || applicationInventory.length || [...(resolvedDeps?.values?.() || [])].some(d => d.provenance !== 'binary' && !d.artifactTargetId && d.manifestPaths?.length) || sourceMatches.some(m => m.dep?.provenance !== 'binary' && m.dep?.manifestPaths?.length));
2734
+ const chapterOffset = hasImages && !system ? 1 : 0;
2735
+ const sourceDeps = new Map([...(resolvedDeps || [])].filter(([, d]) => !d.artifactTargetId || systemIds.has(d.artifactTargetId)));
2536
2736
 
2537
2737
  const applicationMatches = prodMatchesActive.filter(m => !m.dep?.artifactTargetId && m.applicationIds?.length);
2538
2738
  const genericMatches = prodMatchesActive.filter(m => !m.dep?.artifactTargetId && !m.applicationIds?.length);
2539
2739
  const applicationDevMatches = devMatchesActive.filter(m => !m.dep?.artifactTargetId && m.applicationIds?.length);
2540
2740
  const genericDevMatches = devMatchesActive.filter(m => !m.dep?.artifactTargetId && !m.applicationIds?.length);
2541
2741
  const knownAppIds = new Set(applications.map(app => app.id));
2542
- const classified = require('./report-notices').partitionReportNotices(warnings || []);
2742
+ const classified = require('./notices').partitionReportNotices(warnings || []);
2543
2743
  const applicationWarnings = classified.warnings.filter(w => w.type === "cms-coverage" && knownAppIds.has(w.applicationId));
2544
- const generalWarnings = require('./report-notices').groupReportWarnings(classified.warnings.filter(w => !applicationWarnings.includes(w)));
2744
+ const generalWarnings = require('./notices').groupReportWarnings(classified.warnings.filter(w => !applicationWarnings.includes(w)),systemIds);
2545
2745
  const freshnessNotices = [...(projectInfo?.provenance?.freshnessNotices || []), ...classified.freshness];
2546
2746
  const informationalNotices = [...(projectInfo?.provenance?.notices || []), ...classified.notices];
2547
2747
  const prodAppIds = new Set(applicationMatches.flatMap(m => m.applicationIds || []));
@@ -2549,21 +2749,25 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2549
2749
  const prodAppWarnings = applicationWarnings.filter(w => prodAppIds.has(w.applicationId));
2550
2750
  const devAppWarnings = applicationWarnings.filter(w => !prodAppIds.has(w.applicationId) && devAppIds.has(w.applicationId));
2551
2751
  const inventoryAppWarnings = applicationWarnings.filter(w => !prodAppIds.has(w.applicationId) && !devAppIds.has(w.applicationId));
2552
- const { summarizeFindings } = require("./finding-summary");
2752
+ const { summarizeFindings } = require("../findings/summary");
2553
2753
  const appFindingSummary = summarizeFindings([...applicationMatches, ...applicationDevMatches]);
2554
- const applicationExposureCount = Object.values(appFindingSummary.byApplication).reduce((a, b) => a + b, 0);
2555
2754
  const vendoredContent = renderRetireTable(retireMatches);
2556
2755
  const licenseContent = renderLicenseChapter(licenseResults);
2557
2756
  const licenseTotal = licenseResults?.assessed?.length || 0;
2558
2757
  const licenseFlagged = licenseResults?.flagged?.length || 0;
2559
- const embeddedInventory = buildEmbeddedInventory(sourceDeps, embMatchesActive.filter(m => !m.dep?.artifactTargetId));
2560
- const embeddedContent = renderEmbeddedChapter(embeddedInventory, embMatchesActive.filter(m => !m.dep?.artifactTargetId), projectInfo?.src);
2758
+ const embeddedSourceMatches = system ? prodMatchesActive.filter(m=>systemIds.has(m.dep?.artifactTargetId) && m.dep.provenance === 'embedded')
2759
+ : embMatchesActive.filter(m => !m.dep?.artifactTargetId);
2760
+ const embeddedInventory = buildEmbeddedInventory(sourceDeps, embeddedSourceMatches);
2761
+ const embeddedContent = renderEmbeddedChapter(embeddedInventory, embeddedSourceMatches, projectInfo?.src);
2561
2762
  const unmanagedInventory = buildInventory(sourceDeps);
2562
2763
  const unmanagedContent = renderUnmanagedInventory(unmanagedInventory, projectInfo?.src);
2563
2764
  const vendoredJsInv = vendoredJsInventory || [];
2564
- const vendoredJsContent = renderVendoredJsInventory(vendoredJsInv, projectInfo?.src);
2765
+ const vendoredJsContent = system && !vendoredJsInv.length && !artifacts.some(a=>a.coverage?.some(c=>c.collector==="image-retire" && c.capability==="inventory" && c.execution==="completed"))
2766
+ ? `<div class="empty">${t("No RetireJS signature inventory was collected for this system.")}</div>` : renderVendoredJsInventory(vendoredJsInv, projectInfo?.src);
2565
2767
  const certInv = certFindings || [];
2566
- const certContent = renderCertificatesChapter(certInv, projectInfo?.src);
2768
+ const certContent = (system && artifacts.some(a=>systemIds.has(a.id) && !Array.isArray(a.metadata.projectCertificates)) ?
2769
+ `<div class="fp-intro">${t("Certificate and key metadata was not collected for every target.")}</div>` : "") +
2770
+ (certInv.length || !system || artifacts.some(a=>Array.isArray(a.metadata.projectCertificates)) ? renderCertificatesChapter(certInv, projectInfo?.src) : "");
2567
2771
  const fpContent = renderFalsePositives([...prodMatchesFP, ...devMatchesFP, ...embMatchesFP]);
2568
2772
 
2569
2773
  const toolbar = `<div class="toolbar">
@@ -2582,14 +2786,20 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2582
2786
  projectInfo, prodStats: overviewProdStats, devStats: overviewDevStats, retireStats,
2583
2787
  eolResults, obsoleteResults, outdatedResults,
2584
2788
  warnings: generalWarnings, totalDeps: resolvedDeps?.size || 0,
2585
- topCriticalMatches: hasSourceProject ? pickTopCriticalMatches(sourceMatches, 3) : [],
2586
- topImageMatches: pickTopImages(projectInfo, imageMatches, 3),
2587
- nativeBinaryCount, hasImages: hasScannedImages,
2789
+ topCriticalMatches: pickTopCriticalMatches([
2790
+ ...sourceMatches, ...(system?.hostFindings || []).filter(m=>!m.dep?.isDev).map(m=>({...m,reportAnchor:'chhost'}))
2791
+ ], 3),
2792
+ topImageMatches: pickTopImages(imageInfo, imageMatches, 3),
2793
+ nativeBinaryCount, system: !!system, hasImages: hasScannedImages,
2588
2794
  interactive: wrapTables, // copy button + scripts only in the HTML output
2589
2795
  });
2590
2796
 
2591
2797
  // ---- Chapters are grouped under "root" chapters (a two-level hierarchy) ----
2592
- const scanned = buildScannedManifests(sourceDeps, projectInfo?.src, parsedManifests);
2798
+ const scanned = system ? artifacts.filter(a=>systemIds.has(a.id)).flatMap(a=>{
2799
+ const paths = new Set(a.metadata.projectDescriptors || []);
2800
+ const deps = new Map([...sourceDeps].filter(([,d])=>d.artifactTargetId===a.id && paths.has(d.artifactPath)));
2801
+ return buildScannedManifests(deps,null,[...paths].map(path=>({path}))).map(row=>({...row,path:targetPath(row.path)}));
2802
+ }) : buildScannedManifests(sourceDeps, projectInfo?.src, parsedManifests);
2593
2803
  const fpTotal = prodMatchesFP.length + devMatchesFP.length + embMatchesFP.length;
2594
2804
  const eolTotal = eolResults?.length || 0;
2595
2805
  const unsTotal = (eolResults || []).filter(e => e.status === "unsupported").length;
@@ -2606,10 +2816,10 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2606
2816
  const certPrivTotal = certInv.filter(c => c.kind === "private-key").length;
2607
2817
  const excTotal = excludedDirs?.length || 0;
2608
2818
  // CVE root header breakdown: direct vs indirect (transitive) production vulns + the dev count.
2609
- const prodDirect = prodMatchesActive.filter(m => !m.dep?.artifactTargetId && m.dep?.scope !== "transitive").length;
2610
- const prodIndirect = prodMatchesActive.filter(m => !m.dep?.artifactTargetId && m.dep?.scope === "transitive").length;
2611
- const devDirect = devMatchesActive.filter(m => !m.dep?.artifactTargetId && m.dep?.scope !== "transitive").length;
2612
- const devIndirect = devMatchesActive.filter(m => !m.dep?.artifactTargetId && m.dep?.scope === "transitive").length;
2819
+ const prodDirect = (system ? sourceMatches : prodMatchesActive).filter(m => !m.dep?.artifactTargetId && m.dep?.scope !== "transitive").length;
2820
+ const prodIndirect = (system ? sourceMatches : prodMatchesActive).filter(m => !m.dep?.artifactTargetId && m.dep?.scope === "transitive").length;
2821
+ const devDirect = devSourceMatches.filter(m => !m.dep?.artifactTargetId && m.dep?.scope !== "transitive").length;
2822
+ const devIndirect = devSourceMatches.filter(m => !m.dep?.artifactTargetId && m.dep?.scope === "transitive").length;
2613
2823
 
2614
2824
  // The application view is the first CVE section whenever an application was
2615
2825
  // inventoried (a zero-finding instance still shows its synthesis and coverage —
@@ -2618,16 +2828,9 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2618
2828
  // CVE tables appear only when populated; the count in the title stays the
2619
2829
  // findings count.
2620
2830
  const hasApplicationView = applications.length > 0 || appFindingSummary.applicationUnique > 0;
2621
- const applicationSection = hasApplicationView ?
2622
- (appFindingSummary.applicationUnique
2623
- ? `<div class="fp-intro">${t("{n} unique physical finding(s); {exposures} application exposure(s).", { n: appFindingSummary.applicationUnique, exposures: applicationExposureCount })}</div>`
2624
- : `<div class="fp-intro">${t("No application CVE on the inventoried instances — synthesis and coverage below.")}</div>`) +
2625
- `<div class="fp-intro">${t("Application directness uses proven component ownership; overview charts use package-manager scope. A shared physical occurrence is counted once.")}</div>` +
2626
- (applications.length ? `<h3>${t("Instance synthesis")} (${applications.length})</h3>` +
2627
- renderApplicationSummary(applications, applicationInventory, coverage, [...applicationMatches, ...applicationDevMatches], applicationRelations) : "") +
2628
- (applicationMatches.length ? `<h3>${t("Production")} (${applicationMatches.length})</h3>${renderApplicationCves(applicationMatches, applications, applicationInventory, applicationRelations, prodAppWarnings)}` : "") +
2629
- (applicationDevMatches.length ? `<h3>${t("Dev dependencies")} (${applicationDevMatches.length})</h3>${renderApplicationCves(applicationDevMatches, applications, applicationInventory, applicationRelations, devAppWarnings)}` : "") : "";
2630
- const cveSections = numberedSubsections(1, [
2831
+ const applicationSection = !system && hasApplicationView ? renderApplicationSection({applications, applicationInventory, coverage,
2832
+ applicationMatches, applicationDevMatches, applicationRelations, prodAppWarnings, devAppWarnings}) : "";
2833
+ const cveSections = system?.cveSections || numberedSubsections(1, [
2631
2834
  { show: hasApplicationView, id: "chapps", title: `${t("CMS & Frameworks")} (${appFindingSummary.applicationUnique})`, nav: `${t("CMS & Frameworks")} (${appFindingSummary.applicationUnique})`, content: applicationSection },
2632
2835
  { show: genericMatches.length > 0, id: "ch1", title: `${t("Production")} (${genericMatches.length})`, nav: `${t("Prod")} (${genericMatches.length})`, content: n => renderCveBySectionByEco(genericMatches, n, projectInfo?.src) },
2633
2836
  { show: retireMatches.length > 0, id: "ch2", title: `${t("Vendored JS vulns")} — retire.js (${retireMatches.length})`, nav: `${t("Vendored JS")} (${retireMatches.length})`, content: vendoredContent },
@@ -2636,6 +2839,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2636
2839
  { show: hasImages, id: "chimages-cves", title: `${t("Images")} (${imageMatches.length})`, nav: `${t("Images")} (${imageMatches.length})`, content: () => renderImageCves(projectInfo, imageMatches, locale, { renderCveTable, minorSection }) },
2637
2840
  ]);
2638
2841
  const cveCounts = [
2842
+ ...(system?.hostFindings.length ? [`${locale === "fr" ? "Hôte" : "Host"}: ${system.hostFindings.length}`] : []),
2639
2843
  prodDirect ? t("{n} direct prod", { n: prodDirect }) : "",
2640
2844
  prodIndirect ? t("{n} indirect prod", { n: prodIndirect }) : "",
2641
2845
  devDirect ? t("{n} direct dev/test", { n: devDirect }) : "",
@@ -2650,21 +2854,30 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2650
2854
  const cveRoot = majorSection(`1. ${t("CVE")} (${cveCounts.join(", ") || emptyCveLabel})`,
2651
2855
  cveSections.html || `<div class="empty">${t("No CVE matches.")}</div>`, { id: "chcve" });
2652
2856
 
2653
- const imageRoot = hasImages ? majorSection(`2. ${t("Images & OS")}`, renderArtifactEvidence(projectInfo, locale, rawImageMatches), { id: "chimages" }) : "";
2857
+ const imageRoot = hasImages && !system ? majorSection(`2. ${t("Images & OS")}`, renderArtifactEvidence(projectInfo, locale, rawImageMatches), { id: "chimages" }) : "";
2654
2858
  const binSections = numberedSubsections(2 + chapterOffset, [
2655
- { show: embTotal > 0, id: "ch1e", title: `${t("Embedded binaries")} — JAR/WAR/EAR (${embTotal})`, nav: `${t("Embedded")} (${embTotal})`, content: embeddedContent },
2656
- { show: unmTotal > 0, id: "ch1c", title: `${t("Unmanaged / vendored native binaries")} (${unmTotal})`, nav: `${t("Native")} (${unmTotal})`, content: unmanagedContent },
2657
- { show: vjsTotal > 0, id: "ch1d", title: `${t("Unmanaged / vendored JavaScript")} (${vjsTotal})`, nav: `${t("Vendored JS")} (${vjsTotal})`, content: vendoredJsContent },
2658
- { show: certTotal > 0, id: "ch1f", title: `${t("Certificates &amp; key material")} (${certTotal}${certPrivTotal ? ", " + plural(certPrivTotal, "{n} private key", "{n} private keys") : ""})`, nav: `${t("Crypto")} (${certTotal})`, content: certContent },
2859
+ { show: !!system || embTotal > 0, id: "ch1e", title: `${t("Embedded binaries")} — JAR/WAR/EAR (${embTotal})`, nav: `${t("Embedded")} (${embTotal})`, content: embeddedContent },
2860
+ { show: !!system || unmTotal > 0, id: "ch1c", title: `${t("Unmanaged / vendored native binaries")} (${unmTotal})`, nav: `${t("Native")} (${unmTotal})`, content: unmanagedContent },
2861
+ { show: !!system || vjsTotal > 0, id: "ch1d", title: `${t("Unmanaged / vendored JavaScript")} (${vjsTotal})`, nav: `${t("Vendored JS")} (${vjsTotal})`, content: vendoredJsContent },
2862
+ { show: !!system || certTotal > 0, id: "ch1f", title: `${t("Certificates &amp; key material")} (${certTotal}${certPrivTotal ? ", " + plural(certPrivTotal, "{n} private key", "{n} private keys") : ""})`, nav: `${t("Crypto")} (${certTotal})`, content: certContent },
2659
2863
  ]);
2660
2864
  const binRoot = majorSection(`${2 + chapterOffset}. ${t("Unmanaged / unversioned components")} (${t("{emb} embedded, {nat} native, {vjs} vendored JS, {crypto} crypto", { emb: embTotal, nat: unmTotal, vjs: vjsTotal, crypto: certTotal })})`,
2661
2865
  binSections.html || `<div class="empty">${t("No unmanaged binaries, vendored JavaScript or committed crypto material found.")}</div>`, { id: "chbin" });
2662
2866
 
2663
2867
  const eolTitle = unsTotal ? `${t("End-of-Life / out-of-support frameworks")} (${eolCount})` : `${t("End-of-Life frameworks")} (${eolTotal})`;
2868
+ const eolChecks = system ? artifacts.flatMap(a=>a.coverage || []).filter(c=>c.collector==="endoflife.date") : [];
2869
+ const eolNotices = system && (!eolChecks.length || eolChecks.some(c=>c.execution==="partial"))
2870
+ ? `<div class="fp-intro">${t("Lifecycle coverage is incomplete. See the source checks in scan context.")}</div>` : "";
2871
+ const registryNotice = system && projectInfo.provenance?.mode === "offline"
2872
+ ? `<div class="fp-intro">${t("Offline analysis covers packages with registry metadata in the auditor’s cache.")}</div>` : "";
2873
+ const extensionChecks = artifacts.flatMap(a=>a.coverage || []).filter(c=>c.collector==="cms-extension-versions");
2874
+ const checkedExtensions = extensionChecks.reduce((sum,c)=>sum+c.executed,0);
2875
+ const totalExtensions = extensionChecks.reduce((sum,c)=>sum+c.expected,0);
2876
+ const moduleNotice = totalExtensions ? `<div class="fp-intro">${t("Catalogue version compared for {checked} of {total} installed extensions.",{checked:checkedExtensions,total:totalExtensions})}</div>` : "";
2664
2877
  const maintSections = numberedSubsections(3 + chapterOffset, [
2665
- { show: eolTotal > 0, id: "ch4", title: eolTitle, nav: `${t("EOL")} (${eolTotal})`, content: () => renderEolTable(eolResults) },
2666
- { show: obsTotal > 0, id: "ch5", title: `${t("Obsolete / deprecated")} (${obsTotal})`, nav: `${t("Obsolete")} (${obsTotal})`, content: () => renderObsoleteTable(obsoleteResults) },
2667
- { show: outTotal > 0, id: "ch6", title: `${t("Outdated")} (${outTotal})`, nav: `${t("Outdated")} (${outTotal})`, content: () => renderOutdatedTable(outdatedResults) },
2878
+ { show: !!system || eolTotal > 0, id: "ch4", title: eolTitle, nav: `${t("EOL")} (${eolTotal})`, content: () => eolNotices + renderEolTable(eolResults) },
2879
+ { show: !!system || obsTotal > 0, id: "ch5", title: `${t("Obsolete / deprecated")} (${obsTotal})`, nav: `${t("Obsolete")} (${obsTotal})`, content: () => registryNotice + renderObsoleteTable(obsoleteResults) },
2880
+ { show: !!system || outTotal > 0, id: "ch6", title: `${t("Outdated")} (${outTotal})`, nav: `${t("Outdated")} (${outTotal})`, content: () => registryNotice + moduleNotice + (system ? `<p>${esc(t("Direct dependency and CMS extension updates. End-of-life and obsolete components appear in their respective chapters."))}</p>` : "") + renderOutdatedTable(outdatedResults) },
2668
2881
  ]);
2669
2882
  const maintRoot = majorSection(`${3 + chapterOffset}. ${t("Maintenance / EOL")} (${eolCount}, ${t("{n} obsolete", { n: obsTotal })}, ${t("{n} outdated", { n: outTotal })})`,
2670
2883
  maintSections.html || `<div class="empty">${t("No end-of-life frameworks detected.")}</div>`, { id: "chmaint" });
@@ -2674,11 +2887,18 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2674
2887
  const fixRoot = majorSection(`${5 + chapterOffset}. ${t("Fix Recommendations")}`, imageFixLink +
2675
2888
  (hasImages && !sourceMatches.length && !outdatedResults?.length ? "" : renderFixRecommendations(recos, sourceMatches, outdatedResults, 5 + chapterOffset)), { id: "ch8" });
2676
2889
 
2890
+ const affectedOwners = new Set(system?.projectMatches.flatMap(m=>m.ownerComponentIds || []));
2891
+ const affectedPackages = new Set(system?.projectMatches.flatMap(m=>(m.applicationIds || []).map(id=>
2892
+ JSON.stringify([id,[m.dep.namespace,m.dep.name].filter(Boolean).join('/'),m.dep.version]))));
2893
+ const auditInventory = system ? applicationInventory.filter(c=>affectedOwners.has(c.id) ||
2894
+ affectedPackages.has(JSON.stringify([c.applicationId,c.coord,c.version]))) : applicationInventory;
2677
2895
  const scanSections = numberedSubsections(6 + chapterOffset, [
2678
- { show: scanned.length > 0, id: "chsrc", title: `${t("Scanned dependency descriptors")} (${scanned.length})`, nav: `${t("Descriptors")} (${scanned.length})`, content: () => renderScannedManifests(scanned) },
2679
- { show: excTotal > 0, id: "chexcl", title: `${t("Ignored directories")} (${excTotal})`, nav: `${t("Ignored dirs")} (${excTotal})`, content: () => renderExcludedDirs(excludedDirs) },
2896
+ { show: system && fpTotal > 0, id:"ch9", title:`${t("Likely false positives — CPE-filtered")} (${fpTotal})`, nav:t("Likely FP"), content:fpContent },
2897
+ { show: !!system || scanned.length > 0, id: "chsrc", title: `${t("Scanned dependency descriptors")} (${scanned.length})`, nav: `${t("Descriptors")} (${scanned.length})`, content: () => renderScannedManifests(scanned) },
2898
+ { show: !!system || excTotal > 0, id: "chexcl", title: `${t("Ignored directories")} (${excTotal})`, nav: `${t("Ignored dirs")} (${excTotal})`, content: () => renderExcludedDirs(excludedDirs) },
2680
2899
  { show: true, id: "chmethod", title: t("Methodology, data sources & limitations"), nav: t("Methodology"), content: () => renderMethodologyChapter(projectInfo, {freshnessNotices, informationalNotices}) },
2681
- { show: applications.length > 0 || applicationInventory.length > 0 || coverage.length > 0, id: "chappinv", title: t("Application inventory & coverage"), nav: t("Application inventory & coverage"), content: () => renderApplicationInventory(applications, applicationInventory, coverage, inventoryAppWarnings) },
2900
+ { show: !!system || applications.length > 0 || applicationInventory.length > 0 || coverage.length > 0, id: "chappinv", collapsed:true, title: t("Application inventory & coverage"), nav: t("Application inventory & coverage"), content: () => renderApplicationInventory(applications, applicationInventory, coverage, inventoryAppWarnings, auditInventory) + (system?.checks || "") },
2901
+
2682
2902
  ]);
2683
2903
  const scanRoot = majorSection(`${6 + chapterOffset}. ${t("Scan context & limitations")}`, scanSections.html, { id: "chscan" });
2684
2904
 
@@ -2686,8 +2906,8 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2686
2906
  const toc = renderToc([
2687
2907
  ...(generalWarnings.length ? [{ id: "ch0", label: `0. ${t("Warnings")}` }] : []),
2688
2908
  ...(diff && diff.summary ? [{ id: "chdiff", label: `Δ ${t("Baseline diff")}` }] : []),
2689
- { id: "chcve", label: `1. ${t("CVE")} (${prodStats.total + devStats.total + retireStats.total})`, sub: cveSections.toc },
2690
- ...(hasImages ? [{ id: "chimages", label: `2. ${t("Images & OS")}`, sub: artifactGroups(projectInfo, imageMatches).map(({ artifact }) => ({ id: artifactAnchor(artifact.id), label: artifactTitle(artifact, projectInfo.artifacts || []) })) }] : []),
2909
+ { id: "chcve", label: `1. ${t("CVE")} (${system ? overviewProdStats.total + overviewDevStats.total : prodStats.total + devStats.total + retireStats.total})`, sub: cveSections.toc },
2910
+ ...(hasImages && !system ? [{ id: "chimages", label: `2. ${t("Images & OS")}`, sub: artifactGroups(projectInfo, imageMatches).map(({ artifact }) => ({ id: artifactAnchor(artifact.id), label: artifactTitle(artifact, projectInfo.artifacts || []) })) }] : []),
2691
2911
  { id: "chbin", label: `${2 + chapterOffset}. ${t("Unmanaged components")} (${embTotal + unmTotal + vjsTotal + certTotal})`, sub: binSections.toc },
2692
2912
  { id: "chmaint", label: `${3 + chapterOffset}. ${t("Maintenance/EOL")} (${eolTotal + obsTotal + outTotal})`, sub: maintSections.toc },
2693
2913
  { id: "ch7", label: `${4 + chapterOffset}. ${t("Licenses")} (${licenseTotal}${licenseFlagged ? `, ${licenseFlagged}⚠` : ""})` },
@@ -2701,21 +2921,25 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2701
2921
  // its path relative to the scan root. Single-descriptor scans keep the scope chart.
2702
2922
  // moduleNames was resolved at the top of buildBody — every table is rendered by then.
2703
2923
  const chartsRow = renderCharts(
2704
- { prodMatches: [...sourceMatches, ...imageMatches], artifacts: projectInfo.artifacts || [], hasImages: hasScannedImages, hasSourceProject, moduleNames, descriptorCount: moduleNames.size,
2705
- applications, applicationInventory, coverage },
2924
+ { prodMatches: [...sourceMatches, ...devSourceMatches, ...imageMatches], includeAllProjectFindings:true,
2925
+ hostMatches:system?.hostFindings, artifacts: imageArtifacts, hasImages: system ? system.inspectImages : hasScannedImages, hasSourceProject, moduleNames, descriptorCount: moduleNames.size,
2926
+ applications: system?.chartApps || applications, applicationInventory, coverage },
2706
2927
  { interactive: wrapTables, t, cweName: id => cweTitle(id).name });
2707
2928
 
2929
+ const artifactTarget = (system || projectInfo.src === '(artifact inventory)') &&
2930
+ [...new Set(artifacts.map(require('../artifacts/system-report').auditTargetName))].filter(Boolean).join(', ');
2708
2931
  const body = `
2709
2932
  <header class="report-header">
2710
2933
  <h1>${t("VigieVuln Report")}</h1>
2711
2934
  <div class="report-subtitle">${t("Multi-ecosystem dependency security audit")}</div>
2712
2935
  <div class="meta">
2713
- ${t("Project:")} <strong>${esc(projectInfo.name)}</strong><br>
2936
+ ${artifactTarget ? t("Audit target") : t("Project:")} <strong>${esc(artifactTarget || projectInfo.name)}</strong><br>
2714
2937
  ${t("Generated:")} ${projectInfo.generatedAt ? renderTimestamp(projectInfo.generatedAt) : ""}${` · <a class="tool-link" href="${REPO_URL}" target="_blank" rel="noopener" title="${esc(t("vigievuln on GitHub — docs, changelog, issues"))}">VigieVuln${projectInfo.toolVersion ? ` ${esc(projectInfo.toolVersion)}` : ""}</a>`}${projectInfo.cveDataDate ? ` · ${t("CVE data:")} ${renderTimestamp(projectInfo.cveDataDate)}` : ""}
2715
2938
  </div>
2716
2939
  </header>
2940
+ ${(warnings || []).some(require("../scan/reliability").isBlocking) ? `<div class="fp-intro incomplete-banner" role="alert"><strong>${t("Incomplete coverage.")}</strong> ${t("Some checks could not be completed, so vulnerabilities may be missing from this report. Chapter 0 lists each gap.")}</div>` : ""}
2717
2941
  ${exec}
2718
- ${summaryCards(overviewProdStats, eolResults, obsoleteResults, outdatedResults, { warnings: generalWarnings, vendored: retireMatches.length, licenseFlagged, hasImages: hasScannedImages, hasSourceProject, imageCount: imageMatches.length, sourceCount: hasSourceProject ? sourceMatches.length : 0, sourceStats: computeStats(sourceMatches) })}
2942
+ ${summaryCards(overviewProdStats, eolResults, obsoleteResults, outdatedResults, { system: !!system, warnings: generalWarnings, vendored: retireMatches.length, licenseFlagged, hasImages: hasScannedImages, hasSourceProject, imageCount: imageMatches.length, sourceCount: hasSourceProject ? sourceMatches.length : 0, sourceStats: computeStats(sourceMatches) })}
2719
2943
  ${chartsRow}
2720
2944
  ${toc}
2721
2945
  ${toolbar}
@@ -2729,6 +2953,7 @@ function buildBody({ cveMatches, devCveMatches, embeddedMatches, retireMatches,
2729
2953
  ${licRoot}
2730
2954
  ${fixRoot}
2731
2955
  ${scanRoot}
2956
+ <div class="disclaimer" role="note" style="margin-top:28px;padding:12px 16px;border-top:1px solid #d1d5db;color:#4b5563;font-size:12px;line-height:1.5"><strong>${t("Disclaimer")}.</strong> ${t(require("./notices").DISCLAIMER)}</div>
2732
2957
  `;
2733
2958
  return wrapTables ? wrapTablesWithCopyButtons(body) : body;
2734
2959
  }
@@ -2775,7 +3000,7 @@ function pickTopCriticalMatches(prodMatches, n) {
2775
3000
 
2776
3001
  // Rank distinct images by their worst severity, then composite finding priority.
2777
3002
  function pickTopImages(projectInfo, matches, limit) {
2778
- const {artifactGroups}=require('./artifacts/report');
3003
+ const {artifactGroups}=require('../artifacts/report');
2779
3004
  const severity={CRITICAL:5,HIGH:4,MEDIUM:3,LOW:2,NONE:1,UNKNOWN:0};
2780
3005
  const compare=(a,b)=>(severity[(b.cve?.severity || 'UNKNOWN').toUpperCase()] || 0)-(severity[(a.cve?.severity || 'UNKNOWN').toUpperCase()] || 0) || byCvePriority(a,b);
2781
3006
  return artifactGroups(projectInfo,matches).map(group=>{
@@ -2864,7 +3089,7 @@ function renderEmbeddedChapter(inventory, embeddedMatches, srcRoot) {
2864
3089
  const cveDetail = matchesByArchive.has(archive)
2865
3090
  ? `<div class="defined-in" style="margin-top:8px"><span class="defined-label">${t("CVE detail:")}</span></div>` + renderCveTable(matchesByArchive.get(archive))
2866
3091
  : "";
2867
- return minorSection(`📦 <code class="path">${esc(displayPath(archive))}</code> (${list.length})`, invTable + cveDetail, { open: list.length <= 30 });
3092
+ return minorSection(`📦 <code class="path">${esc(evidencePath(archive,list[0]))}</code> (${list.length})`, invTable + cveDetail, { open: list.length <= 30 });
2868
3093
  }).join("\n");
2869
3094
  return intro + blocks;
2870
3095
  }
@@ -2879,8 +3104,7 @@ function renderUnmanagedInventory(inventory, srcRoot) {
2879
3104
  if (!inventory.length) return `<div class="empty">${t("No committed native binaries found.")}</div>`;
2880
3105
  const intro = `<div class="fp-intro"><strong>${t("Analysis limitation:")}</strong> ${t("The binaries in this chapter are not automatically correlated with CVEs. Their metadata may be incomplete, ambiguous or modified, and therefore cannot always reliably identify the exact product and build. Available information is shown to help with manual verification.")}<br><br>${t("Committed native binaries (<code>.dll</code>/<code>.exe</code>/<code>.so</code>/<code>.dylib</code>) — not governed by any package manager. Identified by checksum (deps.dev + CIRCL). <strong>should-be-managed</strong> = a published package committed as a blob; <strong>name≠checksum</strong> = the filename disagrees with what the hash resolves to; <strong>not recognised by any source</strong> = neither deps.dev nor CIRCL knows this exact file (vendored/custom build — verify its origin manually). Identification is by checksum only; a file absent from both databases stays unidentified even when its name is suggestive (e.g. <code>openssl.exe</code>).")}</div>`;
2881
3106
  const rows = inventory.map(e => {
2882
- let rel = e.path;
2883
- if (srcRoot) { try { rel = path.relative(srcRoot, e.path); } catch { /* keep abs */ } }
3107
+ const rel = evidencePath(e.path,e,srcRoot);
2884
3108
  const id = e.identity
2885
3109
  ? `${esc(e.identity.ecosystem ? e.identity.ecosystem + ":" : "")}${esc(e.identity.name || "")}${e.identity.version ? "@" + esc(e.identity.version) : ""} <span style="color:#6b7280">(${esc(e.identity.source || "")})</span>`
2886
3110
  : `<span style="color:#6b7280">${t("unknown")}</span>`;
@@ -2915,7 +3139,7 @@ function renderVendoredJsInventory(inventory, srcRoot) {
2915
3139
  const sevPill = e.vulnerable
2916
3140
  ? pill(`${plural(e.vulnCount, "{n} vuln", "{n} vulns")}${e.maxSeverity ? " · " + e.maxSeverity : ""}`, "#b91c1c")
2917
3141
  : pill(t("no known vuln"), "#15803d");
2918
- return `<tr><td>${esc(e.component || "?")}</td><td>${esc(e.version || "?")}</td><td class="dep"><code class="path">${esc(e.file || "")}</code></td><td><span style="color:#6b7280">${esc(e.detection || "")}</span></td><td>${sevPill}</td></tr>`;
3142
+ return `<tr><td>${esc(e.component || "?")}</td><td>${esc(e.version || "?")}</td><td class="dep"><code class="path">${esc(evidencePath(e.file,e) || "")}</code></td><td><span style="color:#6b7280">${esc(e.detection || "")}</span></td><td>${sevPill}</td></tr>`;
2919
3143
  }).join("\n");
2920
3144
  return intro + `<table><thead><tr><th>${t("Library")}</th><th>${t("Version")}</th><th>${t("File")}</th><th>${t("Detection")}</th><th>${t("Status")}</th></tr></thead><tbody>${rows}</tbody></table>`;
2921
3145
  }
@@ -2950,8 +3174,7 @@ function renderCertificatesChapter(inventory, srcRoot) {
2950
3174
  : c.kind === "keystore" ? pill(t("keystore"), "#b45309")
2951
3175
  : pill(t("certificate"), "#475569");
2952
3176
  const rows = inventory.map(c => {
2953
- let rel = c.path;
2954
- if (srcRoot) { try { rel = path.relative(srcRoot, c.path); } catch { /* keep abs */ } }
3177
+ const rel = evidencePath(c.path,c,srcRoot);
2955
3178
  const algo = `${esc(c.algorithm || "?")}${c.bits ? " " + esc(String(c.bits)) : ""}`;
2956
3179
  let detail;
2957
3180
  if (c.kind === "certificate") {
@@ -2971,14 +3194,15 @@ function renderExcludedDirs(excludedDirs) {
2971
3194
  const byDefault = excludedDirs.filter(e => e.type === "default").length;
2972
3195
  const byGlob = excludedDirs.filter(e => e.type === "exclude-path").length;
2973
3196
  const globTxt = byGlob ? t(", <strong>{n}</strong> by <code>--exclude-path</code>", { n: byGlob }) : "";
2974
- const intro = `<div class="fp-intro">${t("Directories the scan <strong>did not walk</strong> — pruned by the built-in default-exclude set (package stores, build output, VCS/IDE metadata) at any depth and by your <code>--exclude-path</code> rules, anchored to <code>--src</code>. Paths are relative to the scan root. <strong>{n}</strong> pruned by default rules", { n: byDefault })}${globTxt}${t(". Nothing under these paths was read, so any dependency, vendored JS or binary inside them is <strong>not</strong> covered — re-run with <code>--no-default-excludes</code> or drop an <code>--exclude-path</code> rule to include one.")}</div>`;
3197
+ const fromTarget = excludedDirs.every(e=>e.artifactTargetId);
3198
+ const intro = fromTarget ? `<div class="fp-intro">${t("Directories excluded from the target filesystem")} (${excludedDirs.length})</div>` : `<div class="fp-intro">${t("Directories the scan <strong>did not walk</strong> — pruned by the built-in default-exclude set (package stores, build output, VCS/IDE metadata) at any depth and by your <code>--exclude-path</code> rules, anchored to <code>--src</code>. Paths are relative to the scan root. <strong>{n}</strong> pruned by default rules", { n: byDefault })}${globTxt}${t(". Nothing under these paths was read, so any dependency, vendored JS or binary inside them is <strong>not</strong> covered — re-run with <code>--no-default-excludes</code> or drop an <code>--exclude-path</code> rule to include one.")}</div>`;
2975
3199
  const rows = excludedDirs.map(e => {
2976
3200
  const tag = e.type === "exclude-path"
2977
3201
  ? pill("--exclude-path", "#b45309")
2978
3202
  : pill(t("default"), "#6b7280");
2979
- return `<tr><td class="dep"><code class="path">${esc(e.dir || "")}</code></td><td>${tag}</td><td><span style="color:#6b7280">${esc(e.reason || "")}</span></td></tr>`;
3203
+ return `<tr><td class="dep"><code class="path">${esc(evidencePath(e.dir,e) || "")}</code></td><td>${tag}</td><td><span style="color:#6b7280">${esc(e.reason || "")}</span></td></tr>`;
2980
3204
  }).join("\n");
2981
- return intro + `<table><thead><tr><th>${t("Directory (relative to --src)")}</th><th>${t("Rule")}</th><th>${t("Matched")}</th></tr></thead><tbody>${rows}</tbody></table>`;
3205
+ return intro + `<table><thead><tr><th>${fromTarget ? t("Path") : t("Directory (relative to --src)")}</th><th>${t("Rule")}</th><th>${t("Matched")}</th></tr></thead><tbody>${rows}</tbody></table>`;
2982
3206
  }
2983
3207
 
2984
3208
  // What vigievuln does NOT assess — stated explicitly so the audit's scope and
@@ -3017,20 +3241,21 @@ function renderMethodologyChapter(projectInfo, {freshnessNotices = [], informati
3017
3241
  if (prov) {
3018
3242
  const rows = (prov.dataSources || []).map(s => {
3019
3243
  const [txt, bg] = STATUS_PILL[s.status] || [s.status, "#6b7280"];
3020
- return `<tr><td>${esc(s.label)}</td><td>${pill(t(txt), bg)}</td><td>${s.asOf ? renderTimestamp(s.asOf) : "—"}</td><td><span style="color:#6b7280">${renderTextWithTimestamps(provenanceDetail(s.detail))}</span></td></tr>`;
3244
+ const detail = s.checks ? Object.entries(s.checks).map(([state,count])=>esc(executionLabel(state))+" ("+esc(count)+")").join(", ") : renderTextWithTimestamps(provenanceDetail(s.detail));
3245
+ return `<tr><td>${esc(s.label)}</td><td>${pill(t(txt), bg)}</td><td>${s.asOf ? renderTimestamp(s.asOf) : "—"}</td><td><span style="color:#6b7280">${detail}</span></td></tr>`;
3021
3246
  }).join("\n");
3022
3247
  sourcesTable = `<table><thead><tr><th>${t("Data source")}</th><th>${t("State")}</th><th>${t("As of")}</th><th>${t("Detail")}</th></tr></thead><tbody>${rows}</tbody></table>`;
3023
3248
  const c = prov.configuration || {};
3024
3249
  const rt = prov.runtime || {};
3025
3250
  // A boolean is rendered as a word, so it gets translated like one; a value that is
3026
3251
  // already data (a level name, a file path, a version) is left exactly as it came.
3027
- const kv = (k, v) => `<span class="meta-kv"><strong>${esc(t(k))}:</strong> ${esc(typeof v === "boolean" ? t(String(v)) : String(v))}</span>`;
3252
+ const kv = (k, v) => v == null ? "" : `<span class="meta-kv"><strong>${esc(t(k))}:</strong> ${esc(typeof v === "boolean" ? t(String(v)) : String(v))}</span>`;
3028
3253
  cfgHtml = `<div class="fp-intro" style="margin-top:14px">
3029
- ${kv("mode", prov.mode)} ${kv("ecosystems", c.ecosystems)} ${kv("transitive", c.transitive ? t("on (depth {n})", { n: c.transitiveDepth || "?" }) : t("off"))}
3254
+ ${kv("mode", prov.mode)} ${kv("ecosystems", c.ecosystems)} ${kv("transitive", c.transitive == null ? null : c.transitive ? t("on (depth {n})", { n: c.transitiveDepth || "?" }) : t("off"))}
3030
3255
  ${c.sourceProfile != null ? kv("source profile", c.sourceProfile) : ""} ${c.cveProject != null ? kv("CVEProject", c.cveProject) : ""} ${c.osvDb != null ? kv("OSV local DB", c.osvDb) : ""} ${c.gcve != null ? kv("GCVE advisories", c.gcve) : ""}
3031
3256
  ${kv("OSV", c.osv)} ${c.advisoryQueryTtlHours != null ? kv("Advisory query TTL (hours)", c.advisoryQueryTtlHours) : ""} ${kv("NVD", c.nvd)} ${kv("EPSS", c.epss)} ${kv("KEV", c.kev)} ${kv("licenses", c.licenses)} ${kv("typosquat", c.typosquat)}
3032
3257
  ${kv("fail-on", c.failOn)}${c.ignoreFile ? " " + kv("ignore", c.ignoreFile) : ""}${c.vexFile ? " " + kv("vex", c.vexFile) : ""}
3033
- ${kv("runtime", `${rt.node || "?"} · ${rt.platform || "?"}/${rt.arch || "?"}`)}
3258
+ ${prov.runtime ? kv("runtime", `${rt.node || "?"} · ${rt.platform || "?"}/${rt.arch || "?"}`) : ""}
3034
3259
  </div>`;
3035
3260
  }
3036
3261
  const intro = `<div class="fp-intro">${t("How this report was produced and what it does <strong>not</strong> cover — stated for audit transparency and reproducibility. The data-source table shows the freshness of every feed used; the configuration line records the run's findings-affecting options. An <code>--offline</code> re-run against the same cache (ship it with <code>--export-cache</code>) reproduces these findings.")}</div>`;
@@ -3048,7 +3273,7 @@ function renderMethodologyChapter(projectInfo, {freshnessNotices = [], informati
3048
3273
  const depthNote = prov?.mavenDepthLimitReached ? `<p>${esc(t("The configured Maven transitive depth was reached; deeper dependencies were not explored."))}</p>` : '';
3049
3274
  const limitations = `<div class="defined-in" style="margin-top:14px"><span class="defined-label">${t("Limitations — vigievuln does not assess:")}</span></div><ul class="methodology-limits">${LIMITATIONS.map(l => `<li>${t(l)}</li>`).join("")}</ul>`;
3050
3275
  const observations = informationalNotices.length ? `<div class="defined-in"><span class="defined-label">${t("Scan context")}</span></div><ul class="methodology-limits">${informationalNotices.map(note => `<li>${renderTextWithTimestamps(typeof note === 'string' ? note : note.message || '')}${typeof note==='object' && note.items?.length ? renderWarningItems(note.items,50) : ''}</li>`).join('')}</ul>` : '';
3051
- return intro + sourcesTable + cfgHtml + renderFreshnessNotices(freshnessNotices) + observations + depthNote + sourceNotes + limitations;
3276
+ return intro + minorSection(t("Data sources"),sourcesTable,{collapsed:true}) + cfgHtml + renderFreshnessNotices(freshnessNotices) + observations + depthNote + sourceNotes + limitations;
3052
3277
  }
3053
3278
 
3054
3279
  // Differential-audit chapter (vs --baseline): what changed since the prior findings JSON.