vigievuln 1.3.3 → 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 (293) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +34 -19
  3. package/completions/vigievuln.bash +14 -3
  4. package/completions/vigievuln.zsh +11 -8
  5. package/lib/README.md +51 -0
  6. package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
  7. package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
  8. package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
  9. package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
  10. package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
  11. package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
  12. package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
  13. package/lib/{native-advisories.js → advisories/native.js} +15 -13
  14. package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
  15. package/lib/{advisory-store.js → advisories/store.js} +2 -2
  16. package/lib/{application-exports.js → applications/exports.js} +1 -1
  17. package/lib/{application-inventory.js → applications/inventory.js} +3 -1
  18. package/lib/applications/layout.js +199 -0
  19. package/lib/{application-providers → applications}/live-snapshot.js +10 -10
  20. package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
  21. package/lib/applications/plugins/ghost.js +36 -0
  22. package/lib/{application-plugins → applications/plugins}/index.js +1 -1
  23. package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
  24. package/lib/applications/plugins/redmine.js +24 -0
  25. package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
  26. package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
  27. package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
  28. package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
  29. package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
  30. package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
  31. package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
  32. package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
  33. package/lib/artifacts/access-warnings.js +24 -0
  34. package/lib/artifacts/applications.js +39 -8
  35. package/lib/artifacts/component-scope.js +11 -2
  36. package/lib/artifacts/cve-view.js +8 -5
  37. package/lib/artifacts/disk-wasm.mjs +3 -0
  38. package/lib/artifacts/disk.js +188 -0
  39. package/lib/artifacts/enrichment.js +31 -17
  40. package/lib/artifacts/go-main-identity.js +135 -36
  41. package/lib/artifacts/go-publisher-advisories.js +4 -3
  42. package/lib/artifacts/image-products.js +5 -4
  43. package/lib/artifacts/index.js +36 -13
  44. package/lib/artifacts/inventory-scope.js +53 -3
  45. package/lib/artifacts/product-advisories.js +51 -46
  46. package/lib/artifacts/product-catalog.js +6 -1
  47. package/lib/artifacts/release-catalogues.js +149 -0
  48. package/lib/artifacts/release-versions.js +101 -0
  49. package/lib/artifacts/remediation-report.js +1 -1
  50. package/lib/artifacts/report-inventory.js +15 -2
  51. package/lib/artifacts/report-path.js +29 -0
  52. package/lib/artifacts/report.js +66 -36
  53. package/lib/artifacts/retire.js +3 -3
  54. package/lib/artifacts/risk-report.js +12 -8
  55. package/lib/artifacts/sbom.js +33 -4
  56. package/lib/artifacts/scan.js +295 -67
  57. package/lib/artifacts/system-apps.js +98 -0
  58. package/lib/artifacts/system-maintenance.js +101 -0
  59. package/lib/artifacts/system-module-updates.js +104 -0
  60. package/lib/artifacts/system-report.js +232 -0
  61. package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
  62. package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
  63. package/lib/{cache-db.js → cache/db.js} +1 -1
  64. package/lib/{dump-format.js → cache/dump-format.js} +2 -2
  65. package/lib/{json-cache.js → cache/json.js} +1 -1
  66. package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
  67. package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
  68. package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
  69. package/lib/{cache-repository.js → cache/repository.js} +1 -1
  70. package/lib/{resource-cache → cache/resource}/engine.js +20 -14
  71. package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
  72. package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
  73. package/lib/{resource-cache → cache/resource}/validate.js +20 -6
  74. package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
  75. package/lib/certs/scan.js +17 -11
  76. package/lib/cli-collect.js +262 -0
  77. package/lib/cli-command-routing.js +30 -13
  78. package/lib/cli-groups.js +1 -1
  79. package/lib/cli-image.js +157 -46
  80. package/lib/cli-project-commands.js +10 -10
  81. package/lib/cli-setup.js +8 -8
  82. package/lib/cli-watch.js +3 -3
  83. package/lib/codecs/binary/scan.js +11 -3
  84. package/lib/codecs/binary.codec.js +1 -1
  85. package/lib/codecs/composer/platform.js +2 -2
  86. package/lib/codecs/composer/registry.js +12 -18
  87. package/lib/codecs/composer.codec.js +6 -5
  88. package/lib/codecs/go/parse.js +1 -1
  89. package/lib/codecs/go/registry.js +7 -7
  90. package/lib/codecs/go.codec.js +2 -2
  91. package/lib/codecs/gradle/parse.js +1 -1
  92. package/lib/codecs/gradle/versionless.js +2 -2
  93. package/lib/codecs/gradle.codec.js +7 -7
  94. package/lib/codecs/index.js +1 -1
  95. package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
  96. package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
  97. package/lib/codecs/maven/jar-scan.js +4 -4
  98. package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
  99. package/lib/{core.js → codecs/maven/pom.js} +22 -11
  100. package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
  101. package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
  102. package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
  103. package/lib/codecs/maven.codec.js +18 -14
  104. package/lib/codecs/npm/collect.js +55 -8
  105. package/lib/codecs/npm/manifest-kind.js +16 -0
  106. package/lib/codecs/npm/parse.js +23 -7
  107. package/lib/codecs/npm/registry.js +28 -14
  108. package/lib/codecs/npm.codec.js +5 -5
  109. package/lib/codecs/nuget/registry.js +7 -7
  110. package/lib/codecs/nuget.codec.js +4 -4
  111. package/lib/codecs/pypi/registry.js +7 -7
  112. package/lib/codecs/pypi.codec.js +4 -4
  113. package/lib/codecs/recipes.js +2 -2
  114. package/lib/codecs/ruby/registry.js +7 -7
  115. package/lib/codecs/ruby.codec.js +2 -2
  116. package/lib/config.js +1 -1
  117. package/lib/{attribution.js → findings/attribution.js} +3 -3
  118. package/lib/findings/cve-descriptions.js +144 -0
  119. package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
  120. package/lib/{diff.js → findings/diff.js} +0 -0
  121. package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
  122. package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
  123. package/lib/{gate.js → findings/gate.js} +1 -1
  124. package/lib/{malware.js → findings/malware.js} +30 -7
  125. package/lib/{merge-sources.js → findings/merge.js} +57 -9
  126. package/lib/{priority.js → findings/priority.js} +3 -3
  127. package/lib/findings/risk-evidence.js +24 -0
  128. package/lib/findings/severity.js +16 -0
  129. package/lib/{finding-summary.js → findings/summary.js} +5 -2
  130. package/lib/{suppress.js → findings/suppress.js} +2 -2
  131. package/lib/images/local-docker.js +72 -0
  132. package/lib/{image-network.js → images/network.js} +26 -16
  133. package/lib/{image-references.js → images/references.js} +29 -11
  134. package/lib/{image-registry.js → images/registry.js} +18 -9
  135. package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
  136. package/lib/images/temp-roots.js +23 -0
  137. package/lib/{image-update.js → images/update.js} +3 -3
  138. package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
  139. package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
  140. package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
  141. package/lib/{embedded.js → inventory/embedded.js} +4 -3
  142. package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
  143. package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
  144. package/lib/{module-names.js → inventory/module-names.js} +1 -1
  145. package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
  146. package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
  147. package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
  148. package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
  149. package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
  150. package/lib/{purl.js → inventory/purl.js} +2 -2
  151. package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
  152. package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
  153. package/lib/{outdated.js → maintenance/outdated.js} +20 -20
  154. package/lib/options-env.js +1 -1
  155. package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
  156. package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
  157. package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
  158. package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
  159. package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
  160. package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
  161. package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
  162. package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
  163. package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
  164. package/lib/providers/{debian.js → debian/index.js} +1 -0
  165. package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
  166. package/lib/providers/{drupal.js → drupal/index.js} +4 -0
  167. package/lib/providers/{eol.js → eol/index.js} +1 -1
  168. package/lib/{epss.js → providers/epss/enrich.js} +16 -13
  169. package/lib/providers/{epss.js → epss/index.js} +2 -2
  170. package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
  171. package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
  172. package/lib/providers/{freexian.js → freexian/index.js} +3 -3
  173. package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
  174. package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
  175. package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
  176. package/lib/{gcve.js → providers/gcve/id.js} +1 -1
  177. package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
  178. package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
  179. package/lib/providers/{github.js → github/index.js} +3 -1
  180. package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
  181. package/lib/providers/{go.js → go/index.js} +1 -1
  182. package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
  183. package/lib/providers/{hashid.js → hashid/index.js} +1 -1
  184. package/lib/providers/index.js +18 -13
  185. package/lib/{kev.js → providers/kev/enrich.js} +12 -9
  186. package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
  187. package/lib/providers/{maven.js → maven/index.js} +5 -3
  188. package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
  189. package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
  190. package/lib/providers/mit-kerberos/index.js +6 -0
  191. package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
  192. package/lib/providers/{npm.js → npm/index.js} +1 -1
  193. package/lib/providers/{nuget.js → nuget/index.js} +1 -1
  194. package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
  195. package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
  196. package/lib/providers/{nvd.js → nvd/index.js} +3 -3
  197. package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
  198. package/lib/{osv-db.js → providers/osv/db.js} +18 -16
  199. package/lib/providers/{osv.js → osv/index.js} +1 -1
  200. package/lib/{osv.js → providers/osv/query.js} +150 -80
  201. package/lib/providers/package-releases/index.js +26 -0
  202. package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
  203. package/lib/providers/{packagist.js → packagist/index.js} +1 -1
  204. package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
  205. package/lib/providers/{pypi.js → pypi/index.js} +1 -1
  206. package/lib/providers/redhat/bzip2.js +167 -0
  207. package/lib/providers/redhat/errata.js +75 -0
  208. package/lib/providers/redhat/index.js +10 -0
  209. package/lib/providers/redhat/oval.js +70 -0
  210. package/lib/providers/redhat/unfixed.js +127 -0
  211. package/lib/{registries.js → providers/registries.js} +4 -4
  212. package/lib/{retire.js → providers/retire/scan.js} +18 -18
  213. package/lib/providers/{ruby.js → ruby/index.js} +1 -1
  214. package/lib/providers/rubysec/advisories.js +177 -0
  215. package/lib/providers/rubysec/index.js +9 -0
  216. package/lib/{snyk.js → providers/snyk/client.js} +2 -2
  217. package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
  218. package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
  219. package/lib/providers/wolfi/index.js +10 -0
  220. package/lib/providers/wolfi/secdb.js +47 -0
  221. package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
  222. package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
  223. package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
  224. package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
  225. package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
  226. package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
  227. package/lib/providers/wpvulnerability/assess.js +181 -0
  228. package/lib/providers/wpvulnerability/index.js +12 -0
  229. package/lib/{charts.js → reports/charts.js} +25 -18
  230. package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
  231. package/lib/{cve-report.js → reports/cve-report.js} +453 -228
  232. package/lib/reports/detail.js +55 -0
  233. package/lib/{i18n.js → reports/i18n.js} +38 -2
  234. package/lib/{report-integrity.js → reports/integrity.js} +1 -1
  235. package/lib/{json-export.js → reports/json-export.js} +95 -24
  236. package/lib/{report-notices.js → reports/notices.js} +11 -6
  237. package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
  238. package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
  239. package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
  240. package/lib/scan/coverage.js +114 -0
  241. package/lib/{provenance.js → scan/provenance.js} +12 -5
  242. package/lib/scan/reliability.js +157 -0
  243. package/lib/{source-health.js → scan/source-health.js} +52 -20
  244. package/lib/{source-profile.js → scan/source-profile.js} +3 -3
  245. package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
  246. package/lib/{project-client.js → service/project-client.js} +20 -2
  247. package/lib/source-input.js +58 -0
  248. package/lib/system-inventory/advisories.js +89 -16
  249. package/lib/system-inventory/collect.js +33 -10
  250. package/lib/system-inventory/distribution-sources.js +32 -15
  251. package/lib/system-inventory/package-applicability.js +51 -0
  252. package/lib/system-inventory/targeted.js +8 -5
  253. package/lib/ui.js +11 -0
  254. package/package.json +49 -2
  255. package/vigievuln.js +483 -352
  256. package/lib/cache-archive.js +0 -676
  257. package/lib/osv-legacy.js +0 -57
  258. package/lib/risk-evidence.js +0 -18
  259. package/lib/scan-coverage.js +0 -61
  260. /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
  261. /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
  262. /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
  263. /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
  264. /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
  265. /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
  266. /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
  267. /package/lib/{cache-directory.js → cache/directory.js} +0 -0
  268. /package/lib/{cache-policy.js → cache/policy.js} +0 -0
  269. /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
  270. /package/lib/{cache-startup.js → cache/startup.js} +0 -0
  271. /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
  272. /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
  273. /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
  274. /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
  275. /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
  276. /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
  277. /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
  278. /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
  279. /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
  280. /package/lib/providers/{kev.js → kev/index.js} +0 -0
  281. /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
  282. /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
  283. /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
  284. /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
  285. /package/lib/providers/{retire.js → retire/index.js} +0 -0
  286. /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
  287. /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
  288. /package/lib/{report-time.js → reports/time.js} +0 -0
  289. /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
  290. /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
  291. /package/lib/{account-client.js → service/account-client.js} +0 -0
  292. /package/lib/{account-session.js → service/account-session.js} +0 -0
  293. /package/lib/{account-terms.js → service/account-terms.js} +0 -0
@@ -1,19 +1,20 @@
1
1
  'use strict';
2
2
  const crypto = require('node:crypto');
3
- const {renderTime}=require('../report-time');
3
+ const {targetPath} = require('./report-path');
4
+ const {renderTime}=require('../reports/time');
4
5
  const { projectImageCves } = require('./cve-view');
5
6
  const esc = value => String(value ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
6
7
  const tr = locale => (en, fr) => locale === 'fr' ? fr : en;
7
8
  const artifactAnchor = id => 'image-' + crypto.createHash('sha256').update(String(id)).digest('hex').slice(0, 12);
8
9
  const title = a => a?.imageUpdate?.reference || a?.metadata?.reference || a?.metadata?.acquisition?.reference || a?.metadata?.source || a?.id || '';
9
- const location = r => `${r?.path || ''}${r?.line != null ? ':' + r.line : ''}`;
10
+ const location = r => `${(r?.declaredInTargetId ? targetPath(r.path) : r?.path) || ''}${r?.line != null ? ':' + r.line : ''}`;
10
11
  const platform = value => typeof value === 'string' ? value : [value?.os, value?.architecture, value?.variant].filter(Boolean).join('/');
11
12
  function artifactTitle(artifact, artifacts = []) {
12
13
  const label=title(artifact);
13
14
  // Always expose content identity, including archive names reused across scans.
14
15
  const meta=artifact.metadata||{}, p=platform(meta.platform), digest=meta.digest||meta.acquisition?.resolvedDigest||meta.configDigest||'';
15
16
  const short=digest ? String(digest).slice(0,19) : String(artifact.id||'').slice(-12);
16
- return [p,short].filter(Boolean).join(' · ')+' — '+label;
17
+ return [p,short].filter(Boolean).join(' · ')+' — '+[label,meta.partition].filter(Boolean).join(' · ');
17
18
  }
18
19
  const visible = matches => (matches || []).filter(m => !m.suppressed && !m.cpeFiltered);
19
20
  const linkedCves = cve => [...new Set([cve?.id,...(cve?.aliases||[]),...(cve?.upstream||[])].filter(id=>typeof id==='string' && /^CVE-\d{4}-\d{4,}$/i.test(id)).map(id=>id.toUpperCase()))];
@@ -71,11 +72,13 @@ function renderAdvisoryObservations(artifact,locale){
71
72
  if(!groups.size)return '';
72
73
  const rows=[...groups.values()].map(item=>{
73
74
  const url=safeUrl(item.sourceUrl||item.evidence?.advisoryURL)||(/^CVE-\d{4}-\d{4,}$/.test(item.id||'')?`https://www.vigievuln.fr/cve/${encodeURIComponent(item.id)}`:null);
74
- const status=item.status==='possible'?t('Possibly affected','Potentiellement affecté'):item.status==='not-affected'?t('Not affected according to source','Non affecté selon la source'):item.status==='fixed'?t('Fixed according to source','Corrigé selon la source'):t('Not established','Non établi');
75
+ const status=item.status==='source-package-only'?t('Source package association only','Association au paquet source uniquement'):item.status==='possible'?t('Possibly affected','Potentiellement affecté'):item.status==='not-affected'?t('Not affected according to source','Non affecté selon la source'):item.status==='fixed'?t('Fixed according to source','Corrigé selon la source'):t('Not established','Non établi');
75
76
  const evidence=item.evidence||{},comparison=evidence.comparison;
76
- const reason=item.source==='freexian-tracker' && evidence.releaseStatus ? t('The tracker release status applies to a different archive source version; applicability to the installed version is undetermined.','Le statut du suivi concerne une autre version source de l’archive ; son applicabilité à la version installée reste indéterminée.') : evidence.versionRange ? t('Upstream version range cannot be evaluated.','La plage de versions amont ne peut pas être évaluée.') : evidence.statuses ? t('No usable tracker package/version verdict.','Le suivi ne fournit pas de verdict exploitable pour ce paquet et cette version.') : evidence.origin ? t('Package vendor provenance does not establish Debian origin.','La provenance du paquet ne permet pas d’établir une origine Debian.') : item.reason==='release status lacks an installed-version bound'?t('No version bound for this release.','Pas de borne de version pour cette distribution.'):item.reason==='package has explicitly different vendor provenance'?t('Package supplied by another vendor.','Paquet fourni par un autre éditeur.'):item.reason==='unrecognized or conflicting release status'?t('Unrecognised or conflicting distribution status.','Statut de distribution non reconnu ou contradictoire.'):item.reason||'';
77
+ const reason=item.source==='osv-upstream' ? t('The installed upstream version matches this advisory. Verify downstream patches for the distribution package.','La version amont installée correspond à cet avis. Vérifier les correctifs rétroportés du paquet de la distribution.') : item.source==='freexian-tracker' && evidence.releaseStatus ? t('The tracker release status applies to a different archive source version; applicability to the installed version is undetermined.','Le statut du suivi concerne une autre version source de l’archive ; son applicabilité à la version installée reste indéterminée.') : evidence.versionRange ? t('Upstream version range cannot be evaluated.','La plage de versions amont ne peut pas être évaluée.') : evidence.statuses ? t('No usable tracker package/version verdict.','Le suivi ne fournit pas de verdict exploitable pour ce paquet et cette version.') : evidence.origin ? t('Package vendor provenance does not establish Debian origin.','La provenance du paquet ne permet pas d’établir une origine Debian.') : item.reason==='release status lacks an installed-version bound'?t('No version bound for this release.','Pas de borne de version pour cette distribution.'):item.reason==='package has explicitly different vendor provenance'?t('Package supplied by another vendor.','Paquet fourni par un autre éditeur.'):item.reason==='unrecognized or conflicting release status'?t('Unrecognised or conflicting distribution status.','Statut de distribution non reconnu ou contradictoire.'):item.reason||'';
77
78
  const states=(item.states||[]).map(s=>`${s.repo}: ${s.fixed?t('fixed','corrigé'):t('possibly vulnerable','potentiellement vulnérable')}`).join('; ');
78
79
  let detail=esc(states||reason||t('The source does not establish the status of this exact version.','La source ne permet pas de conclure pour cette version exacte.'));
80
+ if(item.source==='osv-upstream' && evidence.upstreamFixVersion)
81
+ detail+=' '+t('Upstream fixed version','Version corrigée en amont')+' : <code>'+esc(evidence.upstreamFixVersion)+'</code>.';
79
82
  if(comparison && evidence.releaseApplicability==='unknown'){
80
83
  const rule=comparison.operator==='<'?`${esc(comparison.installedVersion)} &lt; ${esc(comparison.threshold)}`:t('No fixed version in the current source package rule.','Aucune version corrective dans la règle actuelle du paquet source.');
81
84
  const context=(evidence.contextReleases||[]).map(c=>`${esc((c.releases||[]).join(', '))}: ${esc(c.note||'')}`).join('<br>');
@@ -96,31 +99,54 @@ function renderImageCves(projectInfo = {}, matches = [], locale = 'en', helpers
96
99
  const explanation=`<p>${t('The CVE section shows linked CVE identifiers per image. Distribution advisories without linked CVEs remain in the image inventory section.','La section CVE présente les identifiants CVE liés à chaque image. Les avis de distribution sans CVE liée restent dans la section d’inventaire de l’image.')}</p>`;
97
100
  const noFindings=t('No findings recorded; consult scan coverage before drawing conclusions.', 'Aucun résultat enregistré ; consultez la couverture de l’analyse avant de conclure.');
98
101
  if(!groups.length)return explanation+`<p>${noFindings} ${t('Reference-only images have not been scanned.','Les images uniquement déclarées n’ont pas été analysées.')}</p>`;
99
- return explanation+groups.map(({artifact,matches:rows})=>{
102
+ return (helpers.merged ? '' : explanation)+groups.map(group=>{
103
+ const artifact=group.artifact;
104
+ // The component inventory uses the original advisories and their fix versions.
105
+ const rows=helpers.merged ? projectImageCves(group.matches) : group.matches;
100
106
  const anchor=artifactAnchor(artifact.id),heading=`${esc(artifactTitle(artifact,artifacts))} (${rows.length})`;
107
+ const id=helpers.merged ? anchor : anchor+'-cves';
108
+ const inventoryLink=helpers.merged ? '' : `<p class="image-section-nav"><a class="report-section-link" href="#${anchor}">${t('Image inventory and coverage','Inventaire et couverture de l’image')}<span aria-hidden="true">→</span></a></p>`;
101
109
  const detail=rows.length && typeof render==='function' ? groupImageSources(rows,m=>m.dep,locale).map(group=>
102
110
  `<details class="report-subsection" open data-image-source="${esc(group.category)}"><summary><h4>${esc(group.label)} (${group.items.length})</h4></summary><div>${render(group.items,{image:artifact})}</div></details>`).join('') : `<p>${noFindings}</p>`;
103
- const content=`${renderImageSummary(artifact,locale)}<p class="image-section-nav"><a class="report-section-link" href="#${anchor}">${t('Image inventory and coverage','Inventaire et couverture de l’image')}<span aria-hidden="true">→</span></a></p>${detail}`;
104
- return typeof minor==='function' ? minor(heading,content,{id:anchor+'-cves'}) : `<details class="report-subsection" open id="${anchor}-cves"><summary><h3>${heading}</h3></summary><div>${content}</div></details>`;
111
+ const appendix=helpers.merged ? renderComponentInventory(group,locale,stats(group).updates) : '';
112
+ const body=helpers.merged ? renderProductCoverage(artifact,locale)+`<div id="${anchor}-cves">${detail}</div>`+appendix : inventoryLink+detail;
113
+ const content=renderImageSummary(artifact,locale)+body;
114
+ return typeof minor==='function' ? minor(heading,content,{id}) : `<details class="report-subsection" open id="${id}"><summary><h3>${heading}</h3></summary><div>${content}</div></details>`;
105
115
  }).join('');
106
116
  }
117
+ function productCheckLabel(state,locale) {
118
+ const t=tr(locale);
119
+ return {affected:t('Advisory found','Avis trouvé'),'no-match':t('No matching NVD CPE','Aucune correspondance CPE dans NVD'),
120
+ 'distribution-no-match':t('No matching distribution advisory','Aucun avis correspondant dans la distribution'),'distribution-incomplete':t('Package version could not be checked against distribution advisories','Version du paquet non vérifiée dans les avis de la distribution'), 'distribution-cache-missing':t('Distribution advisory catalogue absent from the offline cache','Catalogue des avis de la distribution absent du cache hors ligne'),disabled:t('Source disabled','Source désactivée'),
121
+ 'go-module':t('See Go module coverage','Voir la couverture du module Go'),indeterminate:t('Not established','Non établi')}[state] || t('Not established','Non établi');
122
+ }
123
+ function renderLatestVersions(versions,locale) {
124
+ const t=tr(locale);
125
+ return [['distribution',t('Distribution','Distribution')],['upstream',t('Upstream','Amont')]].flatMap(([key,label])=>{
126
+ const release=versions?.[key];
127
+ if(!release?.version || !release.source)return [];
128
+ const url=safeUrl(release.url);
129
+ const source=url ? `<a href="${esc(url)}">${esc(release.source)}</a>` : esc(release.source);
130
+ const stamp=new Date(release.asOf);
131
+ const date=Number.isFinite(release.asOf) && Number.isFinite(stamp.getTime()) ? stamp.toISOString().slice(0,10) : '';
132
+ const scope=release.sourcePackage ? t('Source package','Paquet source')+' '+esc(release.sourcePackage)+' · ' : '';
133
+ return [`<div class="release-version"><strong>${label}</strong> ${esc(release.version)}<small>${scope}${source}${date?' · '+date:''}</small></div>`];
134
+ }).join('') || '—';
135
+ }
107
136
  function renderProductCoverage(artifact,locale) {
108
137
  const inventory=artifact.productInventory;
109
138
  if (!inventory) return '';
110
139
  const t=tr(locale);
111
- const states={affected:t('Advisory found','Avis trouvé'),'no-match':t('No matching NVD CPE','Aucune correspondance CPE dans NVD'),
112
- 'distribution-no-match':t('No matching distribution advisory','Aucun avis correspondant dans la distribution'),'distribution-incomplete':t('Distribution coverage incomplete','Couverture de la distribution incomplète'),disabled:t('Source disabled','Source désactivée'),
113
- 'go-module':t('See Go module coverage','Voir la couverture du module Go'),indeterminate:t('Not established','Non établi')};
114
140
  const reasons={'version-unknown':t('Version unknown','Version inconnue'),'no-upstream-check':t('No applicable upstream check','Aucun contrôle amont applicable')};
115
141
  const methods={'jsc-build-markers':t('JavaScriptCore build markers','Marqueurs de compilation JavaScriptCore'),'embedded-version-banner':t('Compiled version banner','Bannière de version compilée'),'bun-module-graph':t('Bun module graph','Graphe de modules Bun'),
116
142
  'node-release-and-inspector':t('Node.js release and inspector','Version de distribution et inspecteur Node.js'),
117
143
  'pe-version-info':'PE VERSIONINFO','pe-rcdata-version-info':'PE RCDATA / VERSIONINFO','system-package':t('Installed OS package','Paquet système installé'),
118
144
  'jdk-release':t('JDK release file','Fichier de version du JDK'),'tcl-build-config':'tclConfig.sh'};
119
- const rows=inventory.entries.map(e=>`<tr><td>${esc(e.label)}</td><td>${esc(e.path||e.name)}${e.resourceOffset!=null?' · PE @'+esc(e.resourceOffset):''}</td><td>${esc(e.version || t('Unknown','Inconnue'))}</td><td>${esc(methods[e.versionSource] || e.versionSource || t('Name only','Nom seul'))}${e.evidencePath&&e.evidencePath!==e.path?' · '+esc(e.evidencePath):''}</td><td>${esc(states[e.advisoryCheck])}${e.reason?'<br>'+esc(reasons[e.reason]||e.reason):''}</td></tr>`).join('');
120
- const table=rows?`<table><thead><tr>${[t('Product','Produit'),t('Location','Emplacement'),t('Version','Version'),t('Evidence','Preuve'),t('CVE check','Contrôle CVE')].map(v=>'<th>'+v+'</th>').join('')}</tr></thead><tbody>${rows}</tbody></table>`:t('No catalogued product identified.','Aucun produit du catalogue identifié.');
121
- const links=inventory.links?.length?`<details><summary>${t('Runtime library references','Bibliothèques de runtime référencées')} (${inventory.links.length})</summary><ul>${inventory.links.map(l=>`<li><code>${esc(l.requiredBy)}</code> → <code>${esc(l.library)}</code> · ${l.fileObserved?t('library inventoried','bibliothèque inventoriée'):t('referenced only, file not observed','référence seule, fichier non observé')}</li>`).join('')}</ul></details>`:'';
145
+ const rows=inventory.entries.map(e=>`<tr><td>${esc(e.label)}</td><td>${esc((artifact.kind==='sbom' ? e.path : targetPath(e.path)) || e.name)}${e.resourceOffset!=null?' · PE @'+esc(e.resourceOffset):''}</td><td>${esc(e.version || t('Unknown','Inconnue'))}</td><td>${renderLatestVersions(e.releaseVersions,locale)}</td><td>${esc(methods[e.versionSource] || e.versionSource || t('Name only','Nom seul'))}${e.evidencePath&&e.evidencePath!==e.path?' · '+esc(artifact.kind==='sbom' ? e.evidencePath : targetPath(e.evidencePath)):''}</td><td>${esc(productCheckLabel(e.advisoryCheck,locale))}${e.reason?'<br>'+esc(reasons[e.reason]||e.reason):''}</td></tr>`).join('');
146
+ const table=rows?`<table><thead><tr>${[t('Product','Produit'),t('Location','Emplacement'),t('Installed','Installé'),t('Latest version','Dernière version'),t('Evidence','Preuve'),t('CVE check','Contrôle CVE')].map(v=>'<th>'+v+'</th>').join('')}</tr></thead><tbody>${rows}</tbody></table>`:t('No catalogued product identified.','Aucun produit du catalogue identifié.');
147
+ const links=inventory.links?.length?`<details><summary>${t('Runtime library references','Bibliothèques de runtime référencées')} (${inventory.links.length})</summary><ul>${inventory.links.map(l=>`<li><code>${esc(targetPath(l.requiredBy))}</code> → <code>${esc(l.library)}</code> · ${l.fileObserved?t('library inventoried','bibliothèque inventoriée'):t('referenced only, file not observed','référence seule, fichier non observé')}</li>`).join('')}</ul></details>`:'';
122
148
  const unknown=inventory.unidentified||[];
123
- const unknownFiles=unknown.length?`<details><summary>${t('Unidentified native files','Fichiers natifs non identifiés')} (${unknown.length})</summary><ul>${unknown.slice(0,100).map(f=>`<li><code>${esc(f.path)}</code> · ${esc(f.format)}</li>`).join('')}</ul>${unknown.length>100?t('First 100 shown. The JSON report contains the full list.','Les 100 premiers sont affichés. Le rapport JSON contient la liste complète.'):''}</details>`:'';
149
+ const unknownFiles=unknown.length?`<details><summary>${t('Unidentified native files','Fichiers natifs non identifiés')} (${unknown.length})</summary><ul>${unknown.slice(0,100).map(f=>`<li><code>${esc(targetPath(f.path))}</code> · ${esc(f.format)}</li>`).join('')}</ul>${unknown.length>100?t('First 100 shown. The JSON report contains the full list.','Les 100 premiers sont affichés. Le rapport JSON contient la liste complète.'):''}</details>`:'';
124
150
  const scope=inventory.scope==='older-inventory'?t('Older inventory. Reacquire the image to inspect executable fingerprints.','Inventaire ancien. Réanalyser le contenu de l’image pour lire les empreintes.'):
125
151
  inventory.scope==='publisher-sbom'?t('Based on publisher SBOM declarations. Executables were not inspected.','Selon les déclarations du SBOM éditeur. Les exécutables n’ont pas été inspectés.'):'';
126
152
  return `<details open><summary>${t('Interpreter and service detection','Détection des interpréteurs et des services')}</summary>${scope?'<p>'+scope+'</p>':''}${table}${links}${unknownFiles}<details><summary>${t('Catalogued products without observed evidence','Produits du catalogue sans preuve observée')} (${inventory.unobserved.length})</summary>${esc(inventory.unobserved.join(', '))}</details><p>${t('Static inventory. Network exposure and execution are unknown. An unobserved product may still be present.','Inventaire statique. L’exécution et l’exposition réseau restent inconnues. Un produit sans preuve observée peut être présent.')}</p></details>`;
@@ -133,7 +159,7 @@ function groupImageSources(items,depOf,locale) {
133
159
  const dep=depOf(item),source=dep.imageSource || require('./component-scope').imageComponentSource(dep);
134
160
  const product=require('./product-catalog').imageProduct(dep);
135
161
  const category=product?.category || (order.includes(source.category)?source.category:'other');
136
- const suffix=['system','global'].includes(category)?managers[source.manager] || source.manager:category==='project'?source.root:'';
162
+ const suffix=['system','global'].includes(category)?managers[source.manager] || source.manager:category==='project'?targetPath(source.root):'';
137
163
  const key=JSON.stringify([category,suffix]);
138
164
  if(!groups.has(key))groups.set(key,{category,label:labels[category]+(suffix?' — '+suffix:''),items:[]});
139
165
  groups.get(key).items.push(item);
@@ -179,27 +205,17 @@ function renderReferences(projectInfo, artifacts, locale) {
179
205
  }).join('');
180
206
  return `<details class="report-subsection" open><summary><h3>${t('Declared image references','Références d’images déclarées')}</h3></summary><table><thead><tr><th>${t('File','Fichier')}</th><th>${t('Declaration','Déclaration')}</th><th>${t('Platform','Plateforme')}</th><th>${t('Role','Rôle')}</th><th>${t('Status','État')}</th></tr></thead><tbody>${rows}</tbody></table></details>`;
181
207
  }
182
- function renderArtifactEvidence(projectInfo = {}, locale = 'en', matches = []) {
183
- const t=tr(locale),groups=artifactGroups(projectInfo,matches),artifacts=groups.map(g=>g.artifact);
184
- if(!groups.length && !(projectInfo.imageReferences||[]).length)return '';
185
- const referenceNotice=projectInfo.provenance?.mode==='offline' && projectInfo.imageReferences?.length ? `<p>${t('Air-gap mode: Dockerfiles remain in the isolated environment and are not transferred; images they define cannot therefore be built during online preparation.','Mode air gap : les Dockerfiles restent dans l’environnement isolé et ne sont pas transférés ; les images qu’ils définissent ne peuvent donc pas être construites pendant la préparation en ligne.')}</p>`:'';
186
- const overviewRows=groups.map(group=>{const a=group.artifact,s=stats(group),sev=Object.entries(s.severity).filter(([,v])=>v>0).map(([k,v])=>`${esc(k)}: ${v}`).join(' · ');return `<tr><td><a href="#${artifactAnchor(a.id)}">${esc(artifactTitle(a,artifacts))}</a></td><td>${Number(a.componentCount??a.components?.length??0)}</td><td>${s.components}</td><td>${s.findings}</td><td>${s.cveFindings}</td><td>${s.advisories}</td><td>${s.cves}</td><td>${sev}</td><td>${s.updates.length}</td></tr>`;}).join('');
187
- const overview=overviewRows?`<table><thead><tr><th>${t('Image','Image')}</th><th>${t('Components','Composants')}</th><th>${t('Affected packages','Paquets affectés')}</th><th>${t('Raw findings','Résultats bruts')}</th><th>${t('CVE rows','Lignes CVE')}</th><th>${t('Advisories','Avis')}</th><th>${t('Unique CVEs','CVE distinctes')}</th><th>${t('CVE row severities','Sévérités des lignes CVE')}</th><th>${t('Update candidates','Corrections proposées')}</th></tr></thead><tbody>${overviewRows}</tbody></table>`:'';
188
- const cards=groups.map(group=>{
189
- const a=group.artifact,meta=a.metadata||{},acq=meta.acquisition||{},s=stats(group),anchor=artifactAnchor(a.id);
190
- const definitions=(meta.definitions||[]).filter(d=>d.path && (['manifest-digest','index-digest','registry-reference-resolution'].includes(d.binding) || d.match==='exact-digest'));
191
- const sourceAction=definitions.length ? t('If applicable, update these verified source declarations:', 'Si nécessaire, mettez à jour ces déclarations source vérifiées :')+' '+definitions.map(d=>`<code>${esc(location(d))}</code>`).join(', ') : t('No matching source declaration is available; identify the build or deployment definition before changing it.', 'Aucune déclaration source associée n’est disponible ; identifiez la définition de build ou de déploiement avant de la modifier.');
192
- const imageAction=visible(group.matches).length ? `<p><strong>${t('Recommended image action','Action recommandée sur l’image')}:</strong> ${t('For a publisher-provided image, obtain and deploy a corrected image from its publisher. If you build the image, rebuild it from a corrected base and packages, republish it and deploy the replacement.','Pour une image fournie par un éditeur, procurez-vous et déployez une image corrigée auprès de cet éditeur. Si vous construisez l’image, reconstruisez-la à partir d’une base et de paquets corrigés, publiez-la de nouveau et déployez son remplacement.')} ${sourceAction} ${t('Scan the replacement image to verify the fixes and its coverage.','Analysez l’image de remplacement pour vérifier les corrections et la couverture.')} ${['available','current'].includes(a.imageUpdate?.status)?'':t('No replacement tag or digest has been verified from this evidence.','Aucun tag ni empreinte de remplacement n’a été vérifié à partir de ces éléments.')}</p>` : `<p><strong>${t('Recommended image action','Action recommandée sur l’image')}:</strong> ${t('No correction is proposed from the recorded findings; consult scan coverage before deciding the image is safe.','Aucune correction n’est proposée à partir des résultats enregistrés ; consultez la couverture avant de considérer l’image comme sûre.')}</p>`;
193
- const rows=(a.coverage||[]).map(c=>`<tr><td>${esc(c.capability||'')}</td><td>${esc(c.collector||c.source||'')}</td><td>${esc(c.execution||c.status||'unknown')}</td><td>${esc(c.reason||c.message||c.result||'')}</td></tr>`).join('');
208
+ function renderComponentInventory(group,locale,updates) {
209
+ const a=group.artifact,meta=a.metadata||{},anchor=artifactAnchor(a.id),t=tr(locale);
194
210
  const updateIndex=new Map();
195
- for(const update of s.updates){const key=componentIdentity(update.dep),list=updateIndex.get(key)||[];list.push(update);updateIndex.set(key,list);}
211
+ for(const update of updates){const key=componentIdentity(update.dep),list=updateIndex.get(key)||[];list.push(update);updateIndex.set(key,list);}
196
212
  const findingIndex=new Map();
197
213
  for(const match of visible(group.matches)){const key=componentIdentity(match.dep||{}),list=findingIndex.get(key)||[];list.push(match);findingIndex.set(key,list);}
198
214
  const affectedKeys=new Set(findingIndex.keys());
199
- const inventory=reportedComponents(a,group.matches),inventoryKeys=new Set(inventory.map(componentIdentity));
215
+ const inventory=reportedComponents(a,group.matches).filter(c=>!meta.systemApplications || c.systemSection !== 'dependency'),inventoryKeys=new Set(inventory.map(componentIdentity));
200
216
  // Older or partial inventories can omit a component that is still supported
201
217
  // by a finding. Keep its correction, and identify the source of this row.
202
- for(const [key,findings] of findingIndex)if(!inventoryKeys.has(key)){inventory.push({...findings[0].dep,_fromFinding:true});inventoryKeys.add(key);}
218
+ for(const [key,findings] of findingIndex)if(!inventoryKeys.has(key) && !(meta.systemApplications && findings[0].dep?.systemSection === 'dependency')){inventory.push({...findings[0].dep,_fromFinding:true});inventoryKeys.add(key);}
203
219
  inventory.sort((left,right)=>Number(affectedKeys.has(componentIdentity(right)))-Number(affectedKeys.has(componentIdentity(left))));
204
220
  const componentRows=items=>items.map(c=>{
205
221
  const key=componentIdentity(c),updates=updateIndex.get(key)||[],findings=findingIndex.get(key)||[];
@@ -208,10 +224,24 @@ function renderArtifactEvidence(projectInfo = {}, locale = 'en', matches = []) {
208
224
  const links=advisories.map(id=>/^CVE-\d{4}-\d{4,}$/i.test(id)
209
225
  ? `<a href="#${anchor}-cves">${esc(id)}</a>`
210
226
  : `<a href="${advisoryUrl(id)}">${esc(id)}</a>`).join(', ');
211
- return `<tr><td><code>${esc(c.namespace?c.namespace+'/'+c.name:c.name||c.artifactId||c.coord||'')}</code><br>${esc(c.packageType||c.ecosystem||'')}${c._fromFinding?`<br><small>${t('From finding; not present in inventory','Issu d’un résultat ; absent de l’inventaire')}</small>`:''}</td><td>${esc(c.version||'—')}</td><td>${fixes.map(esc).join('<br>')||'—'}</td><td>${links||'—'}</td><td>${esc(c.architecture||'—')}</td><td>${esc(c.artifactPath||'—')}</td><td>${esc((c.osPackageOwners||[]).map(o=>`${o.name}@${o.version}`).join(', ')||'—')}</td></tr>`;
227
+ return `<tr><td><code>${esc(c.namespace?c.namespace+'/'+c.name:c.name||c.artifactId||c.coord||'')}</code><br>${esc(c.packageType||c.ecosystem||'')}${c._fromFinding?`<br><small>${t('From finding; not present in inventory','Issu d’un résultat ; absent de l’inventaire')}</small>`:''}</td><td>${esc(c.version||'—')}</td><td>${renderLatestVersions(c.releaseVersions,locale)}</td><td>${fixes.map(esc).join('<br>')||'—'}</td><td>${links||'—'}</td><td>${esc(c.architecture||'—')}</td><td>${esc((a.kind==='sbom' || c.provenance==='sbom' ? c.artifactPath : targetPath(c.artifactPath)) || '—')}</td><td>${esc((c.osPackageOwners||[]).map(o=>`${o.name}@${o.version}`).join(', ')||'—')}</td></tr>`;
212
228
  }).join('');
213
- const table=items=>items.length?`<table class="image-inventory"><thead><tr><th>${t('Component','Composant')}</th><th>${t('Installed','Installé')}</th><th>${t('Candidate corrections','Corrections proposées')}</th><th>${t('Advisories','Avis')}</th><th>Arch</th><th>${t('Location','Emplacement')}</th><th>${t('OS package owner','Paquet système propriétaire')}</th></tr></thead><tbody>${componentRows(items)}</tbody></table>`:`<p>${t('No components observed.','Aucun composant observé.')}</p>`;
214
- const componentSections=groupImageSources(inventory,c=>c,locale).map(group=>`<h5>${esc(group.label)} (${group.items.length})</h5>${table(group.items)}`).join('');
229
+ const table=items=>items.length?`<table class="image-inventory"><thead><tr><th>${t('Component','Composant')}</th><th>${t('Installed','Installé')}</th><th>${t('Latest version','Dernière version')}</th><th>${t('Candidate corrections','Corrections proposées')}</th><th>${t('Advisories','Avis')}</th><th>Arch</th><th>${t('Location','Emplacement')}</th><th>${t('OS package owner','Paquet système propriétaire')}</th></tr></thead><tbody>${componentRows(items)}</tbody></table>`:`<p>${t('No components observed.','Aucun composant observé.')}</p>`;
230
+ const componentSections=groupImageSources(inventory,c=>c,locale).map(group=>`<details class="report-subsection"><summary><h4>${esc(group.label)} (${group.items.length})</h4></summary>${table(group.items)}</details>`).join('');
231
+ return `<details class="report-subsection"><summary><h4>${t('Component inventory and candidate corrections','Inventaire des composants et corrections proposées')} (${inventory.length})</h4></summary><p>${meta.systemApplications ? t('Other inventoried components appear in System dependencies.', 'Les autres composants inventoriés figurent dans le chapitre Dépendances du système.') : t('Catalogued interpreters, services and direct applications remain visible without findings. Other system packages and native binaries are detailed when associated with an advisory. Roles describe the image inventory, not project dependency scope.','Les interpréteurs et services du catalogue ainsi que les applications directes restent visibles sans CVE. Les autres paquets système et binaires natifs sont détaillés lorsqu’un avis leur est associé. Les rôles décrivent l’inventaire de l’image et non la portée des dépendances du projet.')}</p><p>${t('Candidate versions come from individual advisories. Verify them in the replacement image; they do not establish that a particular image tag or digest is corrected.','Les versions proposées proviennent d’avis individuels. Vérifiez-les dans l’image de remplacement ; elles ne prouvent pas qu’un tag ou une empreinte d’image est corrigé.')}</p>${componentSections}</details>`;
232
+ }
233
+ function renderArtifactEvidence(projectInfo = {}, locale = 'en', matches = []) {
234
+ const t=tr(locale),groups=artifactGroups(projectInfo,matches),artifacts=groups.map(g=>g.artifact);
235
+ if(!groups.length && !(projectInfo.imageReferences||[]).length)return '';
236
+ const referenceNotice=projectInfo.provenance?.mode==='offline' && projectInfo.imageReferences?.length ? `<p>${t('Air-gap mode: Dockerfiles remain in the isolated environment and are not transferred; images they define cannot therefore be built during online preparation.','Mode air gap : les Dockerfiles restent dans l’environnement isolé et ne sont pas transférés ; les images qu’ils définissent ne peuvent donc pas être construites pendant la préparation en ligne.')}</p>`:'';
237
+ const overviewRows=groups.map(group=>{const a=group.artifact,s=stats(group),sev=Object.entries(s.severity).filter(([,v])=>v>0).map(([k,v])=>`${esc(k)}: ${v}`).join(' · ');return `<tr><td><a href="#${artifactAnchor(a.id)}">${esc(artifactTitle(a,artifacts))}</a></td><td>${Number(a.componentCount??a.components?.length??0)}</td><td>${s.components}</td><td>${s.findings}</td><td>${s.cveFindings}</td><td>${s.advisories}</td><td>${s.cves}</td><td>${sev}</td><td>${s.updates.length}</td></tr>`;}).join('');
238
+ const overview=overviewRows?`<table><thead><tr><th>${t('Image','Image')}</th><th>${t('Components','Composants')}</th><th>${t('Affected packages','Paquets affectés')}</th><th>${t('Raw findings','Résultats bruts')}</th><th>${t('CVE rows','Lignes CVE')}</th><th>${t('Advisories','Avis')}</th><th>${t('Unique CVEs','CVE distinctes')}</th><th>${t('CVE row severities','Sévérités des lignes CVE')}</th><th>${t('Update candidates','Corrections proposées')}</th></tr></thead><tbody>${overviewRows}</tbody></table>`:'';
239
+ const cards=groups.map(group=>{
240
+ const a=group.artifact,meta=a.metadata||{},acq=meta.acquisition||{},s=stats(group),anchor=artifactAnchor(a.id);
241
+ const definitions=(meta.definitions||[]).filter(d=>d.path && (['manifest-digest','index-digest','registry-reference-resolution'].includes(d.binding) || d.match==='exact-digest'));
242
+ const sourceAction=definitions.length ? t('If applicable, update these verified source declarations:', 'Si nécessaire, mettez à jour ces déclarations source vérifiées :')+' '+definitions.map(d=>`<code>${esc(location(d))}</code>`).join(', ') : t('No matching source declaration is available; identify the build or deployment definition before changing it.', 'Aucune déclaration source associée n’est disponible ; identifiez la définition de build ou de déploiement avant de la modifier.');
243
+ const imageAction=visible(group.matches).length ? `<p><strong>${t('Recommended image action','Action recommandée sur l’image')}:</strong> ${t('For a publisher-provided image, obtain and deploy a corrected image from its publisher. If you build the image, rebuild it from a corrected base and packages, republish it and deploy the replacement.','Pour une image fournie par un éditeur, procurez-vous et déployez une image corrigée auprès de cet éditeur. Si vous construisez l’image, reconstruisez-la à partir d’une base et de paquets corrigés, publiez-la de nouveau et déployez son remplacement.')} ${sourceAction} ${t('Scan the replacement image to verify the fixes and its coverage.','Analysez l’image de remplacement pour vérifier les corrections et la couverture.')} ${['available','current'].includes(a.imageUpdate?.status)?'':t('No replacement tag or digest has been verified from this evidence.','Aucun tag ni empreinte de remplacement n’a été vérifié à partir de ces éléments.')}</p>` : `<p><strong>${t('Recommended image action','Action recommandée sur l’image')}:</strong> ${t('No correction is proposed from the recorded findings; consult scan coverage before deciding the image is safe.','Aucune correction n’est proposée à partir des résultats enregistrés ; consultez la couverture avant de considérer l’image comme sûre.')}</p>`;
244
+ const rows=(a.coverage||[]).map(c=>`<tr><td>${esc(c.capability||'')}</td><td>${esc(c.collector||c.source||'')}</td><td>${esc(c.execution||c.status||'unknown')}</td><td>${esc(c.reason||c.message||c.result||'')}</td></tr>`).join('');
215
245
  const totals=[[t('Components','Composants'),Number(a.componentCount ?? a.components?.length ?? 0)],[t('Affected packages','Paquets affectés'),s.components],[t('Advisories','Avis'),s.advisories],[t('Unique CVEs','CVE distinctes'),s.cves]];
216
246
  const totalsTable=`<table class="image-totals"><thead><tr>${totals.map(([label])=>`<th scope="col">${label}</th>`).join('')}</tr></thead><tbody><tr>${totals.map(([,value])=>`<td class="image-total-value">${value}</td>`).join('')}</tr><tr><td colspan="4"><span class="image-severity-label">${t('CVE row severities','Sévérités des lignes CVE')}</span>${renderSeverityCounts(s.severity,locale)}</td></tr></tbody>${group.matches.length?`<tfoot><tr><td colspan="4"><a class="report-section-link" href="#${anchor}-cves">${t('View vulnerability details','Voir les vulnérabilités')}<span aria-hidden="true">→</span></a></td></tr></tfoot>`:''}</table>`;
217
247
  const noCve=visible(group.matches).filter(m=>m.dep?.ecosystem==='system' && !linkedCves(m.cve).length);
@@ -227,8 +257,8 @@ function renderArtifactEvidence(projectInfo = {}, locale = 'en', matches = []) {
227
257
  renderProductCoverage(a,locale)+
228
258
  imageAction+
229
259
  (rows?`<details open><summary>${t('Coverage checks','Contrôles de couverture')}</summary><table><thead><tr><th>${t('Capability','Capacité')}</th><th>${t('Source','Source')}</th><th>${t('Execution','Exécution')}</th><th>${t('Result / limitation','Résultat / limite')}</th></tr></thead><tbody>${rows}</tbody></table></details>`:`<p>${t('Coverage information unavailable.','Informations de couverture indisponibles.')}</p>`)+
230
- renderAdvisoryObservations(a,locale)+nonCveAdvisories+`<details class="report-subsection"><summary><h4>${t('Component inventory and candidate corrections','Inventaire des composants et corrections proposées')} (${inventory.length})</h4></summary><p>${t('Catalogued interpreters, services and direct applications remain visible without findings. Other system packages and native binaries are detailed when associated with an advisory. Roles describe the image inventory, not project dependency scope.','Les interpréteurs et services du catalogue ainsi que les applications directes restent visibles sans CVE. Les autres paquets système et binaires natifs sont détaillés lorsqu’un avis leur est associé. Les rôles décrivent l’inventaire de l’image et non la portée des dépendances du projet.')}</p><p>${t('Candidate versions come from individual advisories. Verify them in the replacement image; they do not establish that a particular image tag or digest is corrected.','Les versions proposées proviennent d’avis individuels. Vérifiez-les dans l’image de remplacement ; elles ne prouvent pas qu’un tag ou une empreinte d’image est corrigé.')}</p>${componentSections}</details></div></details>`;
260
+ renderAdvisoryObservations(a,locale)+nonCveAdvisories+renderComponentInventory(group,locale,s.updates)+'</div></details>';
231
261
  }).join('');
232
262
  return renderReferences(projectInfo,artifacts,locale)+referenceNotice+overview+(groups.length?`<p>${t('A raw finding is an advisory affecting a component. An advisory can link several CVEs; the CVE section groups linked CVE identifiers while advisories without linked CVEs remain below.','Un résultat brut correspond à un avis affectant un composant. Un avis peut être lié à plusieurs CVE ; la section CVE regroupe les identifiants liés et les avis sans CVE liée restent ci-dessous.')}</p>`:'')+cards;
233
263
  }
234
- module.exports={artifactAnchor,artifactTitle,artifactGroups,renderImageCves,renderArtifactEvidence};
264
+ module.exports={renderLatestVersions,renderSeverityCounts,linkedCves,productCheckLabel,renderReferences,renderAdvisoryObservations,artifactAnchor,artifactTitle,artifactGroups,renderImageCves,renderArtifactEvidence};
@@ -6,7 +6,7 @@ const retire=require('retire/lib/retire');
6
6
  const POLICY='image-retire/1';
7
7
  const EXCLUDED=new Set(['node_modules','bower_components','jspm_packages','vendor','site-packages','dist-packages','__pypackages__','.git','.npm','.yarn','.pnpm-store','.cache','.m2','.gradle','.nuget']);
8
8
  async function repository(options){
9
- const helper=require('../retire');
9
+ const helper=require('../providers/retire/scan');
10
10
  const refreshed=await helper.warmRetireSignatures({...options,force:options.forceUpdate});
11
11
  const entry=helper.cachedSignatureEntry(options.cacheDir);
12
12
  if(!entry || !refreshed.ok && !options.offline && require('../providers').hasHostedProxy())throw Error(refreshed.error || 'RetireJS signatures are unavailable');
@@ -48,7 +48,7 @@ async function collectImageJs(root,options={},ownedPaths=[]){
48
48
  if(!results.length)results=retire.scanFileContent(fs.readFileSync(fp),signatures.repo,{sha1:text=>crypto.createHash('sha1').update(text).digest('hex')});
49
49
  for(const result of results){
50
50
  if(!result.component || !result.version)continue;
51
- const dep=require('../dep-record').makeDepRecord({ecosystem:'npm',name:result.component,version:result.version,manifestPath:rel,provenance:'vendored',scope:'vendored'});
51
+ const dep=require('../inventory/dep-record').makeDepRecord({ecosystem:'npm',name:result.component,version:result.version,manifestPath:rel,provenance:'vendored',scope:'vendored'});
52
52
  dep.coordKey=`retire:${rel}:${result.component}@${result.version}`;
53
53
  dep.ecosystemType='retire';dep.installEvidence={source:'retire',path:rel,detection:result.detection};deps.push(dep);
54
54
  }
@@ -68,7 +68,7 @@ async function assessImageJs(target,options={}){
68
68
  for(const dep of target.deps.filter(d=>d.installEvidence?.source==='retire' && !d.osPackageOwners?.length)){
69
69
  if(!repo[dep.name]){missing.push(dep.name);continue;}
70
70
  const raw=[{file:dep.artifactPath,results:retire.check(dep.name,dep.version,repo)}];
71
- matches.push(...require('../retire').normaliseRetireResults(raw).map(m=>({...m,dep})));
71
+ matches.push(...require('../providers/retire/scan').normaliseRetireResults(raw).map(m=>({...m,dep})));
72
72
  }
73
73
  const incomplete=collected.execution!=='completed'||missing.length>0||!!refreshError;
74
74
  const warnings=[];
@@ -2,8 +2,9 @@
2
2
  // NVD context concerns the identified CVE, not the distribution's own
3
3
  // affected-version decision. All values are untrusted report evidence.
4
4
  const esc=value=>String(value ?? '').replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
5
- const {renderTime}=require('../report-time');
5
+ const {renderTime}=require('../reports/time');
6
6
  const CVE=/^CVE-\d{4}-\d{4,}$/i;
7
+ const LINKED_CVE_PREVIEW_LIMIT=6;
7
8
  const words={
8
9
  en:{linked:'Linked CVEs',identity:'Same vulnerability',upstream:'Upstream CVE',unspecified:'Unspecified',associated:'associated CVE',
9
10
  distribution:'Distribution advisories',candidate:'Advisory-specific candidate',original:'Original source',evidence:'Linked CVE evidence',explanation:'CVE metrics provide context; the original advisory remains the source of the affected-version verdict.',
@@ -20,17 +21,20 @@ function records(cve){return Array.isArray(cve?.nvdEvidence?.records)?cve.nvdEvi
20
21
  function renderLinkedCves(cve,locale){
21
22
  const t=dict(locale),own=String(cve?.id||'').toUpperCase(),items=new Map();
22
23
  for(const id of cve?.upstream||[])if(CVE.test(String(id))&&String(id).toUpperCase()!==own)items.set(String(id).toUpperCase(),null);
24
+ for(const entry of cve?.cveEvidence || [])if(entry.cveProjectMetric && items.has(entry.id))items.set(entry.id,entry.cveProjectMetric);
23
25
  for(const record of records(cve)){const id=String(record.id).toUpperCase();if(id!==own)items.set(id,record);}
24
26
  if(!items.size)return '';
25
- return `<div class="linked-cves"><span>${esc(t.linked)}:</span> ${[...items].map(([id,record])=>{
27
+ const remaining=items.size-LINKED_CVE_PREVIEW_LIMIT;
28
+ const preview=[...items].slice(0,LINKED_CVE_PREVIEW_LIMIT).map(([id,record])=>{
26
29
  const severity=typeof record?.severity==='string' && record.severity.toUpperCase()!=='UNKNOWN'?record.severity:null,score=number(record?.score);
27
30
  return cveLink(id)+(severity||score?` <small>(${esc([severity,score].filter(Boolean).join(' · '))})</small>`:'');
28
- }).join(', ')}</div>`;
31
+ }).join(', ');
32
+ return `<div class="linked-cves"><span>${esc(t.linked)}:</span> ${preview}${remaining>0 ? ` … (+${remaining})` : ''}</div>`;
29
33
  }
30
34
  function renderRiskAttribution(cve,locale){
31
- const t=dict(locale),risk=cve?.riskEvidence;if(!risk || !['nvd','euvd'].includes(risk.source) || !['identity','upstream'].includes(risk.relationship) || !CVE.test(String(risk.id||'')))return '';
35
+ const t=dict(locale),risk=cve?.riskEvidence;if(!risk || !['nvd','euvd','cveproject'].includes(risk.source) || !['identity','upstream'].includes(risk.relationship) || !CVE.test(String(risk.id||'')))return '';
32
36
  const kind=risk.relationship==='upstream'?t.associated:t.identity;
33
- return `<span class="risk-attribution">${risk.source==='euvd'?'ENISA EUVD':'NVD'} · ${cveLink(risk.id)} (${esc(kind)})</span>`;
37
+ return `<span class="risk-attribution">${risk.source==='euvd'?'ENISA EUVD':risk.source==='cveproject'?'CVEProject':'NVD'} · ${cveLink(risk.id)} (${esc(kind)})</span>`;
34
38
  }
35
39
  function renderRiskEvidence(cve,locale,options={}){
36
40
  const t=dict(locale),items=records(cve);if(!items.length)return '';
@@ -63,7 +67,7 @@ function renderRiskEvidence(cve,locale,options={}){
63
67
  return `<section class="linked-cve-evidence"><h4>${esc(t.evidence)}</h4><p>${esc(t.explanation)}</p>${body}</section>`;
64
68
  }
65
69
  function renderEuvdEvidence(cve,locale,options={}){
66
- const t=dict(locale),detail=require('../euvd').normalizeEuvdDetailDates(cve?.euvdDetails);
70
+ const t=dict(locale),detail=require('../providers/euvd/enrich').normalizeEuvdDetailDates(cve?.euvdDetails);
67
71
  if(!detail || !/^EUVD-\d{4}-\d{1,12}$/.test(String(detail.id||'')))return '';
68
72
  const field=(label,content)=>`<div><label>${esc(label)}</label><span>${content}</span></div>`;
69
73
  const source=`<a href="https://euvd.enisa.europa.eu/vulnerability/${esc(detail.id)}" target="_blank" rel="noopener noreferrer">${esc(detail.id)}</a>`;
@@ -90,7 +94,7 @@ function renderDistributionAdvisories(cve,locale){
90
94
  }
91
95
 
92
96
  function renderHistoricalEvidence(cve,locale){
93
- const proofs=require('../applicability-evidence').applicabilityEvidence(cve).filter(p=>p.kind==='historical');
97
+ const proofs=require('../findings/applicability-evidence').applicabilityEvidence(cve).filter(p=>p.kind==='historical');
94
98
  return proofs.map(({evidence:e})=>{
95
99
  const fr=String(locale).startsWith('fr'),d=e.distribution||{},commit=String(e.commit||'');
96
100
  const field=(label,value)=>`<div><label>${esc(label)}</label><span>${value}</span></div>`;
@@ -111,7 +115,7 @@ function renderHistoricalEvidence(cve,locale){
111
115
  }).join('');
112
116
  }
113
117
  function renderVendorEvidence(cve,locale){
114
- return require('../applicability-evidence').applicabilityEvidence(cve).filter(p=>p.kind==='vendor').map(({evidence:e})=>{
118
+ return require('../findings/applicability-evidence').applicabilityEvidence(cve).filter(p=>p.kind==='vendor').map(({evidence:e})=>{
115
119
  const fr=String(locale).startsWith('fr');
116
120
  const fields=[[fr?'Version amont':'Upstream version',esc(e.upstreamVersion||'—')],[fr?'Versions affectées':'Affected versions',esc(e.versionRange||'—')],[fr?'Origine déclarée':'Declared origin',esc(e.packageOrigin?.declared||'—')],['Source',safeLink(e.advisoryURL||e.sourceURL)],[fr?'Consultation':'Consulted',renderTime(e.observedAt,locale)]];
117
121
  return `<section class="panel-block"><h4>${fr?'Avis du fournisseur':'Vendor advisory'}</h4><div class="kv">${fields.map(([label,value])=>`<div><label>${label}</label><span>${value}</span></div>`).join('')}</div><p class="muted">${fr?'Correspondance de version fondée sur l’origine déclarée du paquet. L’applicabilité à la configuration effective et la signature du paquet ne sont pas vérifiées.':'Version match based on the declared package origin. Applicability to the runtime configuration and package signature are not verified.'}</p></section>`;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  // Import publisher inventories as unverified evidence; no signature tools invoked.
3
3
  const fs=require('node:fs');
4
- const {makeDepRecord}=require('../dep-record');
4
+ const {makeDepRecord}=require('../inventory/dep-record');
5
5
  const MAX_BYTES=32*1024*1024, MAX_PACKAGES=250000;
6
6
  const adapters=new Map([
7
7
  ['maven',p=>({ecosystem:'maven',namespace:p.namespace,name:p.name})],
@@ -19,6 +19,33 @@ const distributionAdapters = [
19
19
  {id:'purl-os-qualifiers', extract({purl}) {const id=purl?.qualifiers?.os_name, versionId=purl?.qualifiers?.os_version;if(!id||!versionId)return null;return {id:id.toLowerCase(),versionId,evidence:{type:'purl-os-qualifiers',osName:id,osVersion:versionId}};}},
20
20
  {id:'cyclonedx-os', extract({component,format}) {if(format!=='cyclonedx' || component?.type!=='operating-system' || typeof component.name!=='string' || typeof component.version!=='string')return null;const id=component.name.toLowerCase(), versionId=component.version;if(!/^[a-z][a-z0-9._-]*$/.test(id)||!/^[0-9][a-z0-9._+-]*$/i.test(versionId))return null;return {id,versionId,evidence:{type:'cyclonedx-operating-system',name:component.name,version:versionId}};}},
21
21
  ];
22
+ // A deb or rpm package URL carries the epoch as a qualifier (pkg:deb/debian/zlib1g@1.2.13?epoch=1):
23
+ // without it the version compares lower than every fixed version that has one.
24
+ function epochVersion(parsed) {
25
+ const epoch=parsed.qualifiers?.epoch;
26
+ return parsed.version && ['deb','rpm'].includes(parsed.type) && /^[1-9]\d{0,5}$/.test(epoch||'') && !/^\d+:/.test(parsed.version) ? `${epoch}:${parsed.version}` : parsed.version;
27
+ }
28
+ // The source package a system package was built from, as the SBOM producer declared it:
29
+ // distribution advisories are filed under it (libssl3 under openssl). Read from the purl
30
+ // `upstream` qualifier (name or name@version), VigieVuln's own properties, Trivy's and
31
+ // Syft's. Nothing declared stays unknown: a source name is never guessed from the package.
32
+ function declaredSource(component,parsed,format) {
33
+ const props=new Map((format==='cyclonedx' && Array.isArray(component?.properties) ? component.properties : [])
34
+ .filter(p=>p && typeof p.name==='string' && typeof p.value==='string' && p.value).map(p=>[p.name,p.value]));
35
+ const text=value=>typeof value==='string' && value.length<=256 && /^[A-Za-z0-9][A-Za-z0-9+._:~-]*$/.test(value) ? value : null;
36
+ let name=null,version=null;
37
+ const upstream=parsed.qualifiers?.upstream;
38
+ if(upstream){const at=upstream.lastIndexOf('@');name=text(at>0?upstream.slice(0,at):upstream);version=at>0?text(upstream.slice(at+1)):null;}
39
+ name ||= text(props.get('fad:sourceName')) || text(props.get('aquasecurity:trivy:SrcName')) || text(props.get('syft:metadata:source')) || text(props.get('syft:metadata:originPackage'));
40
+ if(!name)return {sourceName:null,sourceVersion:null};
41
+ if(!version)version=text(props.get('fad:sourceVersion')) || text(props.get('syft:metadata:sourceVersion'));
42
+ if(!version && props.get('aquasecurity:trivy:SrcName')===name && text(props.get('aquasecurity:trivy:SrcVersion'))){
43
+ const epoch=props.get('aquasecurity:trivy:SrcEpoch'),release=text(props.get('aquasecurity:trivy:SrcRelease'));
44
+ version=`${/^[1-9]\d*$/.test(epoch||'')?epoch+':':''}${props.get('aquasecurity:trivy:SrcVersion')}${release?'-'+release:''}`;
45
+ }
46
+ // A producer naming the source without a version means the package's own version.
47
+ return {sourceName:name,sourceVersion:version || parsed.version || null};
48
+ }
22
49
  function readSbom(input,opts={}) {
23
50
  const max=opts.maxBytes??MAX_BYTES,warnings=[],deps=new Map(),systemPackages=[];let doc=input;
24
51
  const activeAdapters=opts.purlAdapters || adapters;
@@ -50,14 +77,16 @@ function readSbom(input,opts={}) {
50
77
  function purls(p){if(format==='cyclonedx')return p.purl?[p.purl]:[];return (p.externalRefs||[]).filter(x=>String(x.referenceType||'').toLowerCase().endsWith('purl')).map(x=>x.referenceLocator);}
51
78
  const rootComponent=root?{name:root.name||null,version:root.versionInfo||root.version||null,purl:purls(root)[0]||null}:null;
52
79
  const rootPurl=parsePurl(rootComponent?.purl);if(rootPurl?.qualifiers?.arch)platform={architecture:rootPurl.qualifiers.arch};
53
- const candidates=[];
80
+ const candidates=[],unidentified=[];
54
81
  function collectScope(component,purl){for(const adapter of scopes){const value=adapter.extract({component,purl,format});if(!value)continue;if(typeof value.id!=='string' || !/^[a-z][a-z0-9._-]*$/.test(value.id) || typeof value.versionId!=='string' || !/^[0-9][a-z0-9._+-]*$/i.test(value.versionId))throw Error('Invalid SBOM distribution evidence');candidates.push(value);}}
55
82
  if(root)collectScope(root,rootPurl);
56
- for(const [i,p] of packages.entries()) {const ps=purls(p), parsed=ps.map(parsePurl).find(Boolean);collectScope(p,parsed);if(!parsed && p===root)continue;if(!parsed){warn('sbom-package-unidentified',`SBOM package ${i+1} has no supported package URL.`);continue;}const adapter=activeAdapters.get(parsed.type);if(!adapter){warn('sbom-package-unsupported',`SBOM package URL type ${parsed.type} is unsupported.`);continue;}const item=adapter(parsed),version=parsed.version;if(!item || typeof item.name!=='string' || !item.name || (!item.system && typeof item.ecosystem!=='string')){warn('sbom-adapter-invalid',`SBOM adapter ${parsed.type} did not provide a valid identity.`);continue;}if(!version){warn('sbom-version-unknown',`SBOM package ${parsed.name} has no version in its package URL.`);continue;}
83
+ for(const [i,p] of packages.entries()) {const ps=purls(p), parsed=ps.map(parsePurl).find(Boolean);collectScope(p,parsed);if(!parsed && p===root)continue;if(!parsed){unidentified.push(i+1);continue;}const adapter=activeAdapters.get(parsed.type);if(!adapter){warn('sbom-package-unsupported',`SBOM package URL type ${parsed.type} is unsupported.`);continue;}const item=adapter(parsed),version=epochVersion(parsed);if(!item || typeof item.name!=='string' || !item.name || (!item.system && typeof item.ecosystem!=='string')){warn('sbom-adapter-invalid',`SBOM adapter ${parsed.type} did not provide a valid identity.`);continue;}if(!version){warn('sbom-version-unknown',`SBOM package ${parsed.name} has no version in its package URL.`);continue;}
57
84
  const evidence={source,purl:ps.find(x=>parsePurl(x)?.type===parsed.type),qualifiers:parsed.qualifiers,verification:'unverified'};
58
- if(item.system){systemPackages.push({name:item.name,version,architecture:parsed.qualifiers.arch || null,sourceName:null,sourceVersion:null,manager:item.type,manifestPath:source,ecosystem:'system',provenance:'sbom',distribution:null,qualifiers:parsed.qualifiers,evidence});continue;}
85
+ if(item.system){systemPackages.push({name:item.name,version,architecture:parsed.qualifiers.arch || null,...declaredSource(p,{...parsed,version},format),manager:item.type,manifestPath:source,ecosystem:'system',provenance:'sbom',distribution:null,qualifiers:parsed.qualifiers,evidence});continue;}
59
86
  const dep=makeDepRecord({...item,version,manifestPath:source,provenance:'sbom',scope:'transitive'});dep.coordKey=`sbom:${source}:${i}:${parsed.type}:${parsed.namespace}/${parsed.name}@${version}`;dep.sbomEvidence=evidence;deps.set(dep.coordKey,dep);
60
87
  }
88
+ if(unidentified.length)warnings.push({type:'dependency-coverage',reason:'sbom-package-unidentified',count:unidentified.length,items:unidentified.map(n=>({id:`package ${n}`})),
89
+ message:unidentified.length===1?`SBOM package ${unidentified[0]} has no supported package URL.`:`${unidentified.length} SBOM packages have no supported package URL (packages ${unidentified.slice(0,5).join(', ')}${unidentified.length>5?'…':''}).`});
61
90
  const unique=new Map(candidates.map(c=>[`${c.id}\0${c.versionId}`,c]));let distribution=null;
62
91
  if(unique.size===1)distribution=[...unique.values()][0];else if(unique.size>1)warn('sbom-distribution-conflict','SBOM declares conflicting distribution identities; no common advisory scope can be selected.');else if(systemPackages.length)warn('sbom-distribution-unknown','SBOM system packages have no explicit distribution identity; advisory scope is unknown.');
63
92
  const missingSource=systemPackages.filter(pkg=>!pkg.sourceName || !pkg.sourceVersion).length;