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
@@ -0,0 +1,199 @@
1
+ 'use strict';
2
+
3
+ const nativePath = require('node:path');
4
+ const path = nativePath.posix;
5
+ const extensionKinds = new Set(['module','plugin','theme','bundle','component','profile','extension','mu-plugin','drop-in','template','package']);
6
+ const isExtension = component => extensionKinds.has(component.kind);
7
+ const within = (file,dir) => dir === '.' || file === dir || file.startsWith(dir+'/');
8
+
9
+ // Recognise the CMS's extension directories even when a particular extension
10
+ // has no readable version marker. A directory name alone is no catalogue identity.
11
+ const directories = {
12
+ ghost: /^content\/themes(?:\/[^/]+)?(?:\/|$)/,
13
+ prestashop: /^(?:(?:admin[^/]*\/)?themes|modules)(?:\/[^/]+)?(?:\/|$)/,
14
+ wordpress: /^(?:plugins|mu-plugins|themes)(?:\/[^/]+)?(?:\/|$)/,
15
+ drupal: /^(?:(?:core|sites\/[^/]+)\/)?(?:modules|themes|profiles)(?:\/(?:contrib|custom))?(?:\/[^/]+)?(?:\/|$)/,
16
+ joomla: /^(?:administrator\/)?(?:plugins(?:\/[^/]+)?|templates|modules|components)(?:\/[^/]+)?(?:\/|$)/,
17
+ typo3: /^(?:typo3conf\/ext|typo3\/sysext)(?:\/[^/]+)?(?:\/|$)/,
18
+ magento: /^app\/(?:code(?:\/[^/]+){0,2}|design(?:\/[^/]+){0,3})(?:\/|$)/,
19
+ spip: /^(?:plugins|plugins-dist)(?:\/[^/]+)?(?:\/|$)/,
20
+ };
21
+
22
+ function extensionLayout(applications, inventory) {
23
+ const apps = applications.filter(a=>a.type !== 'project').slice().sort((a,b)=>b.root.length-a.root.length);
24
+ const byApp = new Map();
25
+ const lockedExtensions = new Set();
26
+ for (const c of inventory) if (isExtension(c) && c.coord) {
27
+ for (const proof of c.evidence || []) if (proof.path && path.basename(proof.path)==='composer.lock') {
28
+ lockedExtensions.add(JSON.stringify([proof.path,c.coord.toLowerCase(),c.versionConflict?.locked || c.version]));
29
+ }
30
+ }
31
+ for (const c of inventory) if (isExtension(c) && c.path) {
32
+ if (!byApp.has(c.applicationId)) byApp.set(c.applicationId,new Map());
33
+ byApp.get(c.applicationId).set(c.path,c);
34
+ }
35
+ function lookup(app,file,directory=false) {
36
+ if (!file || path.isAbsolute(file) || file==='..' || file.startsWith('../') || file===app.root || !within(file,app.root)) return null;
37
+ const owners = byApp.get(app.id);
38
+ for (let dir=file; owners && dir!==app.root && dir!=='.' && dir!=='/'; dir=path.dirname(dir)) {
39
+ if (owners.has(dir)) return {app,component:owners.get(dir)};
40
+ }
41
+ const base = app.type==='wordpress' ? app.contentRoot || path.join(app.root,'wp-content') : app.documentRoot || app.root;
42
+ const rel = path.relative(base,directory ? file : path.dirname(file));
43
+ const expression = Object.hasOwn(directories,app.type) ? directories[app.type] : null;
44
+ const match = expression?.exec(rel);
45
+ if (!match) {
46
+ const site = path.relative(app.documentRoot || app.root,file);
47
+ if ((app.type==='wordpress' && /^(?:wp-includes|wp-admin)(?:\/|$)/.test(site)) ||
48
+ (app.type==='drupal' && /^core(?:\/|$)/.test(site))) return {app,core:true};
49
+ return null;
50
+ }
51
+ // Keep the path in the proof even if the plugin could not identify the module.
52
+ return {app,path:path.join(base,match[0].replace(/\/$/,''))};
53
+ }
54
+ function owner(file,directory=false) {
55
+ for (const app of apps) {
56
+ const match = lookup(app,file,directory);
57
+ if (match) return match;
58
+ }
59
+ return null;
60
+ }
61
+ function lockedExtension(dep) {
62
+ return dep.ecosystem==='composer' && dep.provenance==='lockfile' &&
63
+ lockedExtensions.has(JSON.stringify([dep.artifactPath,[dep.namespace,dep.name].filter(Boolean).join('/').toLowerCase(),dep.version]));
64
+ }
65
+ return {lookup,owner,lockedExtension};
66
+ }
67
+
68
+ // Application-level ownership is separate from the package manager's directness
69
+ // within the module's own manifest. Preserve both for private-module remediation.
70
+ function attributeLayoutFindings(matches, applications, inventory, srcRoot) {
71
+ if (!applications.length) return;
72
+ const layout = extensionLayout(applications,inventory);
73
+ const modules = new Set(inventory.filter(isExtension).map(c=>c.id));
74
+ const roots = new Map(applications.map(app=>[app.root,app]));
75
+ for (const m of matches) {
76
+ const dep = m.dep;
77
+ if (!dep || dep.ecosystem==='system' || dep.systemSection==='runtime' ||
78
+ ['system','global'].includes(dep.imageSource?.category) || (!srcRoot && !dep.artifactTargetId)) continue;
79
+ if (srcRoot && dep.artifactTargetId) continue;
80
+ const files = dep.artifactPath ? [dep.artifactPath] : dep.manifestPaths || [];
81
+ const paths = files.map(file=>srcRoot && nativePath.isAbsolute(file)
82
+ ? nativePath.relative(srcRoot,file).split(nativePath.sep).join('/') : file);
83
+ if (!paths.length || paths.some(f=>!f || f==='..' || f.startsWith('../'))) continue;
84
+ const owner = layout.owner(paths[0]);
85
+ if (owner && paths.every(f=>{
86
+ const o=layout.lookup(owner.app,f);
87
+ return o && (o.component?.id || o.path)===(owner.component?.id || owner.path);
88
+ })) {
89
+ if ((owner.core && dep.provenance==='application') || m.ownerComponentIds?.some(id=>modules.has(id))) continue;
90
+ const self = moduleSelf(dep,owner.component);
91
+ m.applicationIds=[owner.app.id];
92
+ m.ownerComponentIds=owner.component ? [owner.component.id] : [];
93
+ m.applicationRelation=self ? 'direct' : 'indirect';
94
+ m.applicationExposures=[{applicationId:owner.app.id,ownerComponentIds:m.ownerComponentIds,applicationRelation:m.applicationRelation}];
95
+ m.attributionStatus=owner.component || owner.core ? 'confirmed' : 'unknown';
96
+ } else if (!m.applicationIds?.length && paths.every(f=>path.dirname(f)===path.dirname(paths[0]))) {
97
+ const app=roots.get(path.dirname(paths[0]));
98
+ if (app) {
99
+ m.applicationIds=[app.id];
100
+ m.applicationRelation=managerRelation(dep);
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ function managerRelation(dep) {
107
+ const declared = dep.occurrences?.find(o=>o.version===dep.version && dep.manifestPaths?.includes(o.manifestPath))?.managerRelation || dep.managerRelation;
108
+ if (declared==='direct') return 'direct';
109
+ if (declared==='transitive' || declared==='indirect' || dep.scope==='transitive') return 'indirect';
110
+ if (declared==='unknown' || (dep.ecosystem==='composer' && dep.provenance==='lockfile')) return 'unknown';
111
+ if (dep.systemSection==='project' || ['prod','dev','compile','optional','peer','test'].includes(dep.scope)) return 'direct';
112
+ return 'unknown';
113
+ }
114
+
115
+ function moduleSelf(dep,component) {
116
+ return !!component?.coord && component.coord.toLowerCase()===[dep.namespace,dep.name].filter(Boolean).join('/').toLowerCase() &&
117
+ (!component.version || component.version===dep.version);
118
+ }
119
+
120
+ function applyExtensionScope(dep,layout) {
121
+ if (!dep.systemApplicationIds?.length || dep.systemSection==='runtime') return;
122
+ const owner = layout.owner(dep.artifactPath);
123
+ if (!owner && !layout.lockedExtension(dep)) return;
124
+ if (!dep.managerRelation && dep.provenance==='lockfile') dep.managerRelation=managerRelation(dep);
125
+ const self = !owner || moduleSelf(dep,owner.component);
126
+ if (self && owner?.app.type==='ghost' && owner.component?.kind==='theme' && dep.provenance==='installed' &&
127
+ dep.artifactPath===path.join(owner.component.path,'package.json')) dep.registryIdentity='cms-theme';
128
+ dep.systemSection=self ? 'project' : 'dependency';
129
+ dep.imageRole=self ? 'direct' : 'transitive';
130
+ }
131
+
132
+ // Advisory plugins assess one installed application at a time. Keep the
133
+ // original physical finding ID and evidence when displaying an embedded app.
134
+ function reparentAssessments(state, embedded) {
135
+ const parents = new Map(embedded.map(entry=>[entry.app.id,entry]));
136
+ for (const key of ['coverage','diagnostics']) for (const record of state[key] || []) {
137
+ const owner = parents.get(record.applicationId);
138
+ if (!owner) continue;
139
+ record.embeddedApplicationId = record.applicationId;
140
+ record.applicationId = owner.applicationId;
141
+ if (record.componentId) {
142
+ record.embeddedComponentId = record.componentId;
143
+ record.componentId = owner.ownerComponentId;
144
+ }
145
+ }
146
+ for (const m of state.findings || []) {
147
+ if (!m.applicationIds?.some(id=>parents.has(id))) continue;
148
+ const exposures = m.applicationIds.map(id=>{
149
+ const owner = parents.get(id);
150
+ if (owner) return {applicationId:owner.applicationId,ownerComponentIds:owner.ownerComponentId ? [owner.ownerComponentId] : [],
151
+ applicationRelation:'indirect'};
152
+ return m.applicationExposures?.find(e=>e.applicationId===id) ||
153
+ {applicationId:id,ownerComponentIds:m.ownerComponentIds || [],applicationRelation:m.applicationRelation};
154
+ });
155
+ m.applicationExposures = exposures;
156
+ m.applicationIds = [...new Set(exposures.map(e=>e.applicationId))];
157
+ m.ownerComponentIds = [...new Set(exposures.flatMap(e=>e.ownerComponentIds))];
158
+ m.applicationRelation = exposures.some(e=>e.applicationRelation==='direct') ? 'direct' : 'indirect';
159
+ }
160
+ }
161
+
162
+ // Drop a descriptor- or framework-derived instance inside an extension. All
163
+ // other proven applications (including independent nested sites) keep their IDs.
164
+ function reconcileApplications(state, deps = []) {
165
+ const layout = extensionLayout(state.applications,state.inventory);
166
+ const replaced = new Map();
167
+ for (const a of state.applications) {
168
+ const match = layout.owner(a.root,true);
169
+ if (match) replaced.set(a.id,match.app.id);
170
+ }
171
+ if (!replaced.size) return;
172
+ function parent(id) {
173
+ while (replaced.has(id)) id=replaced.get(id);
174
+ return id;
175
+ }
176
+ const byId = new Map(state.applications.map(a=>[a.id,a]));
177
+ const embedded = [];
178
+ for (const app of state.applications) {
179
+ if (!replaced.has(app.id) || !app.pluginId) continue;
180
+ const applicationId = parent(app.id);
181
+ const component = layout.lookup(byId.get(applicationId),app.root,true)?.component;
182
+ embedded.push({app,applicationId,ownerComponentId:component?.id || null,
183
+ inventory:state.inventory.filter(c=>c.applicationId===app.id)});
184
+ }
185
+ if (embedded.length) {
186
+ state.embeddedApplications = [...(state.embeddedApplications || []),...embedded];
187
+ reparentAssessments(state,embedded);
188
+ }
189
+ state.applications = state.applications.filter(a=>!replaced.has(a.id));
190
+ state.inventory = state.inventory.filter(c=>!replaced.has(c.applicationId));
191
+ for (const key of ['relations','diagnostics','coverage']) if (state[key])
192
+ state[key]=state[key].filter(c=>!replaced.has(c.applicationId));
193
+ if (state.findings) state.findings=state.findings.filter(m=>!m.applicationIds?.length || m.applicationIds.some(id=>!replaced.has(id)));
194
+ for (const dep of deps) if (dep.systemApplicationIds?.some(id=>replaced.has(id)))
195
+ dep.systemApplicationIds=[...new Set(dep.systemApplicationIds.map(parent))];
196
+ return replaced;
197
+ }
198
+
199
+ module.exports={reparentAssessments,isExtension,extensionLayout,reconcileApplications,attributeLayoutFindings,managerRelation,moduleSelf,applyExtensionScope};
@@ -6,9 +6,9 @@
6
6
  */
7
7
  const { responseFetchedAt } = require("../providers/common");
8
8
  const crypto = require("node:crypto");
9
- const { indexFeed } = require("./wordfence-v3");
10
- const { validateSnapshot: validateGithubAdvisories } = require("./github-advisories");
11
- const { validateChecksums } = require("./wp-checksums");
9
+ const { indexFeed } = require("../providers/wordfence/v3");
10
+ const { validateSnapshot: validateGithubAdvisories } = require("../providers/github/advisories");
11
+ const { validateChecksums } = require("../providers/wordpress/checksums");
12
12
 
13
13
  const DRUPAL_ADVISORIES_URL = "https://packages.drupal.org/8/security-advisories";
14
14
  const WORDFENCE_PRODUCTION_URL = "https://www.wordfence.com/api/intelligence/v3/vulnerabilities/production";
@@ -37,7 +37,7 @@ async function fetchDrupalAdvisories(packages = [], { fetchImpl = globalThis.fet
37
37
  const url = new URL(apiUrl);
38
38
  for (const pkg of queried) url.searchParams.append("packages[]", pkg);
39
39
  const { body, sha256, fetchedAt } = await responseJson(await require("../providers").getResource("drupal", "advisories", { packages: queried },
40
- { fetcher: fetchImpl, signal: AbortSignal.timeout(60000),
40
+ { fetcher: fetchImpl, requestTimeoutMs: 60000,
41
41
  ...(apiUrl === DRUPAL_ADVISORIES_URL ? {} : { urlOverride: url.toString(), direct: true }) }),
42
42
  "Drupal security-advisories");
43
43
  meta.collectedAt = new Date(Math.min(fetchedAt, now)).toISOString();
@@ -74,13 +74,13 @@ async function fetchWordfenceFeed(url, { fetchImpl = globalThis.fetch, now = Dat
74
74
  if (require("../providers").hasProxyRoute()) {
75
75
  if (sourceUrl !== WORDFENCE_PRODUCTION_URL)
76
76
  throw new Error("Wordfence proxy projections require the official source; direct bulk fallback is unavailable");
77
- return require("./wordfence-client").fetchWordfenceProjection(components, { fetchImpl, now, apiKey: key, software });
77
+ return require("../providers/wordfence/client").fetchWordfenceProjection(components, { fetchImpl, now, apiKey: key, software });
78
78
  }
79
79
  const proxyCredentials = sourceUrl === WORDFENCE_PRODUCTION_URL && require("../providers").hasProxyRoute();
80
80
  if (!key && !proxyCredentials)
81
81
  throw new Error("Wordfence live scan requires an API key (--wordfence-api-key or WORDFENCE_API_KEY), or the official feed via --proxy-cache with a server key");
82
82
  const response = await require("../providers").getResource("wordfence", "production-feed", {}, {
83
- fetcher: fetchImpl, signal: AbortSignal.timeout(120000), headers: key ? { Authorization: `Bearer ${key}` } : {},
83
+ fetcher: fetchImpl, requestTimeoutMs: 120000, headers: key ? { Authorization: `Bearer ${key}` } : {},
84
84
  ...(sourceUrl === WORDFENCE_PRODUCTION_URL ? {} : { urlOverride: sourceUrl, direct: true }),
85
85
  });
86
86
  if (!response?.ok && !key && proxyCredentials)
@@ -117,7 +117,7 @@ async function fetchGithubAdvisories(repo, { fetchImpl = globalThis.fetch, apiUr
117
117
  const requestParams = { repo, page, perPage: 100 };
118
118
  const canonicalUrl = require("../providers").getProvider("github").build("publisher-advisories", requestParams).url;
119
119
  const response = await require("../providers").getResource("github", "publisher-advisories", requestParams,
120
- { fetcher: fetchImpl, signal: AbortSignal.timeout(60000),
120
+ { fetcher: fetchImpl, requestTimeoutMs: 60000,
121
121
  headers: { Accept: "application/vnd.github+json", "User-Agent": "vigievuln-github-advisories" },
122
122
  ...(url === canonicalUrl ? {} : { urlOverride: url, direct: true }) });
123
123
  const { body, fetchedAt } = await responseJson(response, "Github security-advisories");
@@ -141,14 +141,14 @@ async function fetchGithubAdvisories(repo, { fetchImpl = globalThis.fetch, apiUr
141
141
  * instead of producing a bogus comparison against an unusable reference.
142
142
  */
143
143
  async function fetchWordpressChecksums(version, locale = "en_US", { fetchImpl = globalThis.fetch,
144
- apiUrl = require("./wp-checksums").WP_CHECKSUMS_API, now = Date.now() } = {}) {
144
+ apiUrl = require("../providers/wordpress/checksums").WP_CHECKSUMS_API, now = Date.now() } = {}) {
145
145
  const cleanVersion = String(version || "").trim();
146
146
  if (!cleanVersion) throw new Error("WordPress checksums require a core version");
147
147
  const url = `${apiUrl}?version=${encodeURIComponent(cleanVersion)}&locale=${encodeURIComponent(String(locale || "en_US"))}`;
148
148
  const { body, sha256, fetchedAt } = await responseJson(await require("../providers").getResource("wordpress", "checksums",
149
149
  { version: cleanVersion, locale: String(locale || "en_US") },
150
- { fetcher: fetchImpl, signal: AbortSignal.timeout(60000),
151
- ...(apiUrl === require("./wp-checksums").WP_CHECKSUMS_API ? {} : { urlOverride: url, direct: true }) }),
150
+ { fetcher: fetchImpl, requestTimeoutMs: 60000,
151
+ ...(apiUrl === require("../providers/wordpress/checksums").WP_CHECKSUMS_API ? {} : { urlOverride: url, direct: true }) }),
152
152
  "WordPress checksums");
153
153
  const collectedAt = new Date(Math.min(fetchedAt, now)).toISOString();
154
154
  const meta = { collectedAt, completeness: "tool-fetched", sourceUrl: url };
@@ -1,8 +1,8 @@
1
1
  const path = require("node:path");
2
2
  const fs = require("node:fs");
3
3
  const yaml = require("js-yaml");
4
- const { assessDrupalAdvisories } = require("../application-providers/drupal-advisories");
5
- const { fetchDrupalAdvisories, mergeDrupalSnapshots, writeSnapshotAtomically } = require("../application-providers/live-snapshot");
4
+ const { assessDrupalAdvisories } = require("../../providers/drupal/advisories");
5
+ const { fetchDrupalAdvisories, mergeDrupalSnapshots, writeSnapshotAtomically } = require("../live-snapshot");
6
6
  const { localSourceSnapshot } = require("./wave2-common");
7
7
 
8
8
  const join = (dir, file) => dir === "." ? file : `${dir}/${file}`;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+ const path=require('node:path').posix;
3
+ function manifest(ctx,dir){
4
+ const file=path.join(dir,'package.json');
5
+ try{return JSON.parse(ctx.readText(file,1024*1024));}catch{return null;}
6
+ }
7
+ module.exports={
8
+ id:'ghost',apiVersion:1,version:'1.0.0',label:'Ghost',supportedLayouts:['installation','source'],
9
+ requiredCodecs:['npm'],providerIds:[],capabilities:{inventory:'qualified'},
10
+ discover(ctx){
11
+ return ctx.index.directories.filter(dir=>ctx.index.hasFile(path.join(dir,'core/boot.js')) &&
12
+ ctx.index.hasFile(path.join(dir,'index.js')) && manifest(ctx,dir)?.name==='ghost')
13
+ .map(root=>({root,evidence:[{path:path.join(root,'package.json'),field:'name'},{path:path.join(root,'core/boot.js')}]}));
14
+ },
15
+ collect(app,ctx){
16
+ const data=manifest(ctx,app.root);
17
+ const components=[{id:app.id+':core',applicationId:app.id,kind:'core',name:'Ghost',coord:'ghost',
18
+ version:data?.version || null,visibility:'public',path:app.root,
19
+ evidence:[{path:path.join(app.root,'package.json'),field:'version'}]}];
20
+ const themes=path.join(app.root,'content/themes');
21
+ for(const dir of ctx.index.directories){
22
+ if(path.dirname(dir)!==themes || !ctx.index.hasFile(path.join(dir,'package.json')))continue;
23
+ const theme=manifest(ctx,dir);
24
+ if(!theme?.name || !theme.engines?.ghost)continue;
25
+ const repository = typeof theme.repository === 'string' ? theme.repository : theme.repository?.url;
26
+ const repo = /^https:\/\/github\.com\/TryGhost\/(Casper|Source)(?:\.git)?\/?$/i.exec(repository || '')?.[1]?.toLowerCase();
27
+ const official = repo && repo === String(theme.name).toLowerCase() && !ctx.isPrivatePath(dir);
28
+ components.push({...(official ? {releaseRepository:'TryGhost/'+(repo==='casper'?'Casper':'Source')} : {}),id:app.id+':theme:'+path.basename(dir),applicationId:app.id,kind:'theme',name:theme.name,coord:theme.name,
29
+ version:theme.version || null,path:dir,visibility:ctx.isPrivatePath(dir)?'private':official?'public':'unknown',activation:'unknown',
30
+ evidence:[{path:path.join(dir,'package.json'),field:'version'}]});
31
+ }
32
+ return {components,coverage:[{applicationId:app.id,capability:'inventory',execution:'completed',result:'not-applicable',
33
+ expected:components.length,executed:components.length}],diagnostics:[]};
34
+ },
35
+ assess(){return [];},remediation(){return null;},
36
+ };
@@ -9,7 +9,7 @@ const magento = require("./magento");
9
9
  const spip = require("./spip");
10
10
  const { assertPluginShape } = require("./plugin.interface");
11
11
 
12
- const PLUGINS = [symfony, wordpress, drupal, laravel, joomla, prestashop, typo3, magento, spip];
12
+ const PLUGINS = [symfony, wordpress, drupal, laravel, joomla, prestashop, typo3, magento, spip, require('./ghost'), require('./redmine')];
13
13
  for (const plugin of PLUGINS) assertPluginShape(plugin);
14
14
 
15
15
  function allApplicationPlugins() { return PLUGINS.slice(); }
@@ -1,8 +1,8 @@
1
1
  const fs = require("node:fs");
2
2
  const path = require("node:path");
3
3
  const yaml = require("js-yaml");
4
- const { fetchGithubAdvisories, writeSnapshotAtomically } = require("../application-providers/live-snapshot");
5
- const { assessGithubAdvisories, prestashopRangeGrammar } = require("../application-providers/github-advisories");
4
+ const { fetchGithubAdvisories, writeSnapshotAtomically } = require("../live-snapshot");
5
+ const { assessGithubAdvisories, prestashopRangeGrammar } = require("../../providers/github/advisories");
6
6
  const { join, within, readJson, composerOccurrences, composerComponent, composerCoverageDiagnostic, finishInventory, localSourceSnapshot } = require("./wave2-common");
7
7
 
8
8
  const GITHUB_REPO = "PrestaShop/PrestaShop";
@@ -25,7 +25,7 @@ function moduleAt(ctx, app, dir) {
25
25
  if (!ctx.index.hasFile(relative)) continue;
26
26
  let source;
27
27
  try { source = ctx.readPrefix(relative, 65536); } catch { continue; }
28
- if (!/\bextends\s+\\?[A-Za-z_\\]*Module\b/i.test(source)) continue;
28
+ if (!/\bextends\s+\\?[A-Za-z_\\]*Module(?:Graph(?:Engine)?|Grid(?:Engine)?)?\b/i.test(source)) continue;
29
29
  const declared = source.match(/\$this->name\s*=\s*['"]([^'"\r\n]+)['"]\s*;/)?.[1];
30
30
  if (!declared || declared.toLowerCase() !== candidate.slice(0, -4).toLowerCase()) continue;
31
31
  file = relative; name = declared;
@@ -61,13 +61,41 @@ function themeAt(ctx, app, dir) {
61
61
  ...(observedVersion ? [{ path: file, field: "version" }] : [])] };
62
62
  }
63
63
 
64
+ function adminThemeAt(ctx, app, dir) {
65
+ const admin = path.posix.dirname(path.posix.dirname(dir));
66
+ if (!ctx.index.hasFile(join(admin, "index.php")) || !ctx.index.directories.includes(join(dir, "template"))) return null;
67
+ for (const filename of ["package.json", "package-lock.json"]) {
68
+ const file = join(dir, filename);
69
+ if (!ctx.index.hasFile(file)) continue;
70
+ const data = readJson(ctx, file);
71
+ const metadata = data?.packages?.[""] || data;
72
+ if (metadata?.name !== path.posix.basename(dir)) continue;
73
+ const version = typeof metadata.version === "string" ? metadata.version : null;
74
+ return { id:`${app.id}:theme:${dir}`, applicationId:app.id, kind:"theme", path:dir,
75
+ name:metadata.name, version, versionStatus:version ? "observed" : "unknown",
76
+ visibility:ctx.isPrivatePath(dir) ? "private" : "unknown", activation:"unknown",
77
+ evidence:[{path:file,field:data?.packages?.[""] ? 'packages[""].name' : "name"},
78
+ ...(version ? [{path:file,field:data?.packages?.[""] ? 'packages[""].version' : "version"}] : [])] };
79
+ }
80
+ return null;
81
+ }
82
+
64
83
  function componentAt(ctx, app) { return moduleAt(ctx, app, ".") || themeAt(ctx, app, "."); }
65
84
 
85
+ function distributionVersion(dir, ctx) {
86
+ const file = join(dir, "src/Core/Version.php");
87
+ if (!ctx.index.hasFile(file)) return null;
88
+ let text;
89
+ try { text = ctx.readPrefix(file, 16384); } catch { return null; }
90
+ if (!/namespace\s+PrestaShop\\PrestaShop\\Core\s*;/.test(text)) return null;
91
+ return text.match(/\bpublic\s+const\s+VERSION\s*=\s*['"]([0-9]+(?:\.[0-9]+){1,3}(?:[-+][\w.-]+)?)['"]/)?.[1] || null;
92
+ }
93
+
66
94
  function isSite(dir, ctx) {
67
95
  if (!ctx.index.hasFile(join(dir, "config/config.inc.php"))) return false;
68
96
  const manifest = join(dir, "composer.json");
69
97
  if (ctx.index.hasFile(manifest) && readJson(ctx, manifest)?.name?.toLowerCase() === "prestashop/prestashop") return true;
70
- return ctx.index.hasFile(join(dir, "config/settings.inc.php")) && ctx.index.hasFile(join(dir, "classes/Tools.php"));
98
+ return ctx.index.hasFile(join(dir, "classes/Tools.php")) && (ctx.index.hasFile(join(dir, "config/settings.inc.php")) || !!distributionVersion(dir, ctx));
71
99
  }
72
100
 
73
101
  module.exports = {
@@ -81,10 +109,20 @@ module.exports = {
81
109
  return component ? [{ root: ".", layout: "component", componentKind: component.kind,
82
110
  evidence: component.evidence }] : [];
83
111
  }
84
- return ctx.index.directories.filter(dir => isSite(dir, ctx)).map(dir => ({ root: dir,
112
+ return ctx.index.directories.filter(dir => isSite(dir, ctx)).map(dir => {
113
+ const script = "tmp/docker_run.sh";
114
+ let template = false;
115
+ if (ctx.scanContext === "installation" && dir === "tmp/data-ps/prestashop" && ctx.index.hasFile(script)) {
116
+ try {
117
+ template = /^\s*cp\s+(?:-[A-Za-z]+\s+)*\/tmp\/data-ps\/prestashop\/?\s+\/var\/www\/html\/?\s*$/m.test(ctx.readText(script, 65536));
118
+ } catch { /* Keep the role unknown when the script cannot be read. */ }
119
+ }
120
+ return { root: dir,
121
+ ...(template ? {deploymentRole:"installation-template"} : {}),
85
122
  layout: ctx.index.hasFile(join(dir, "composer.json")) ? "composer" : "legacy",
86
123
  evidence: [{ path: join(dir, "config/config.inc.php") },
87
- { path: ctx.index.hasFile(join(dir, "composer.json")) ? join(dir, "composer.json") : join(dir, "classes/Tools.php") }] }));
124
+ { path: ctx.index.hasFile(join(dir, "composer.json")) ? join(dir, "composer.json") : join(dir, "classes/Tools.php") }, ...(template ? [{path:script,field:"installation copy source"}] : [])] };
125
+ });
88
126
  },
89
127
  collect(app, ctx) {
90
128
  if (app.layout === "component") return finishInventory(app, [componentAt(ctx, app)].filter(Boolean),
@@ -94,32 +132,52 @@ module.exports = {
94
132
  const sourceFile = join(app.root, "install-dev/install_version.php");
95
133
  const installed = literalVersion(ctx, installedFile, "_PS_VERSION_");
96
134
  const source = literalVersion(ctx, sourceFile, "_PS_INSTALL_VERSION_");
97
- const version = installed || source;
135
+ const release = distributionVersion(app.root, ctx);
136
+ const version = installed || release || source;
98
137
  if (installed && source && installed !== source) diagnostics.push({ code: "CMS_VERSION_CONFLICT",
99
138
  applicationId: app.id, path: installedFile,
100
139
  message: `installed PrestaShop version ${installed} differs from source installer version ${source}` });
101
140
  components.push({ id: `${app.id}:core`, applicationId: app.id, kind: "core", path: app.root,
102
141
  name: "PrestaShop", coord: "prestashop/prestashop", version, rawVersion: version,
103
- versionStatus: installed ? "observed" : source ? "source-observed" : "unknown",
142
+ versionStatus: installed || release ? "observed" : source ? "source-observed" : "unknown",
104
143
  visibility: "public", identityStatus: "verified", activation: "unknown",
105
- evidence: [{ path: installed ? installedFile : source ? sourceFile : join(app.root, "composer.json"),
106
- field: installed ? "_PS_VERSION_" : source ? "_PS_INSTALL_VERSION_" : "name" }] });
144
+ evidence: [{ path: installed ? installedFile : release ? join(app.root, "src/Core/Version.php") : source ? sourceFile : join(app.root, "composer.json"),
145
+ field: installed ? "_PS_VERSION_" : release ? "Version::VERSION" : source ? "_PS_INSTALL_VERSION_" : "name" }] });
107
146
  for (const dir of ctx.index.directories) {
108
147
  if (!within(dir, app.root) || dir === app.root) continue;
109
148
  const relative = app.root === "." ? dir : dir.slice(app.root.length + 1);
110
149
  if (/^modules\/[^/]+$/.test(relative)) {
111
150
  const module = moduleAt(ctx, app, dir);
112
151
  if (module) components.push(module);
113
- } else if (/^themes\/[^/]+$/.test(relative)) {
114
- const theme = themeAt(ctx, app, dir);
152
+ } else if (/^(?:admin[^/]*\/)?themes\/[^/]+$/.test(relative)) {
153
+ const theme = themeAt(ctx, app, dir) || (relative.startsWith("admin") && adminThemeAt(ctx, app, dir));
115
154
  if (theme) components.push(theme);
116
155
  }
117
156
  }
118
- for (const entry of composerOccurrences(app, ctx)) {
119
- if (components.some(c => c.coord?.toLowerCase() === entry.coord)) continue;
157
+ const entries = composerOccurrences(app, ctx);
158
+ for (const entry of entries) {
120
159
  const kind = entry.occurrence.packageType === "prestashop-module" ? "module" :
121
160
  entry.occurrence.packageType === "prestashop-theme" ? "theme" : "library";
122
- components.push(composerComponent(app, entry, kind));
161
+ const locked = composerComponent(app, entry, kind);
162
+ // Distribution builds can strip each module's composer.json. The official
163
+ // installer places a typed prestashop/<slug> under modules/ or themes/.
164
+ const slug = entry.coord.split("/")[1];
165
+ const installDir = join(app.root,(kind === "theme" ? "themes/" : "modules/") + slug);
166
+ const installed = components.find(c => c.coord?.toLowerCase() === entry.coord ||
167
+ (kind !== "library" && entry.coord.startsWith("prestashop/") && c.kind === kind &&
168
+ !c.coord && c.path === installDir && c.name?.toLowerCase() === slug));
169
+ if (!installed) { components.push(locked); continue; }
170
+ installed.coord = entry.coord;
171
+ installed.managerRelation = locked.managerRelation;
172
+ installed.evidence.push(...locked.evidence);
173
+ if (installed.version && installed.version !== locked.version) {
174
+ installed.versionConflict = {observed:installed.version,locked:locked.version};
175
+ diagnostics.push({code:"CMS_VERSION_CONFLICT",applicationId:app.id,componentId:installed.id,
176
+ path:installed.path,message:`Installed ${entry.coord} ${installed.version} differs from composer.lock ${locked.version}`});
177
+ } else if (!installed.version) {
178
+ installed.version = locked.version;
179
+ installed.versionStatus = "locked";
180
+ }
123
181
  }
124
182
  return finishInventory(app, components, diagnostics, undefined, { advisories: false });
125
183
  },
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+ const path=require('node:path').posix;
3
+ const versionFile='lib/redmine/version.rb';
4
+ function versionFrom(text){
5
+ if(!/^\s*module Redmine\s*$/m.test(text) || !/^\s*module VERSION\s*$/m.test(text))return null;
6
+ const values=['MAJOR','MINOR','TINY'].map(key=>new RegExp('^\\s*'+key+'\\s*=\\s*(\\d+)\\s*$','m').exec(text)?.[1]);
7
+ return values.every(Boolean)?values.join('.'):null;
8
+ }
9
+ module.exports={
10
+ id:'redmine',apiVersion:1,version:'1.0.0',label:'Redmine',supportedLayouts:['installation','source'],
11
+ requiredCodecs:[],providerIds:[],capabilities:{inventory:'qualified'},upstreamCpe:'redmine:redmine',
12
+ discover(ctx){
13
+ return ctx.index.directories.filter(root=>[versionFile,'config/application.rb','Gemfile'].every(file=>ctx.index.hasFile(path.join(root,file))) &&
14
+ versionFrom(ctx.readText(path.join(root,versionFile),256*1024)))
15
+ .map(root=>({root,evidence:[{path:path.join(root,versionFile),field:'Redmine::VERSION'},{path:path.join(root,'config/application.rb')}]}));
16
+ },
17
+ collect(app,ctx){
18
+ const file=path.join(app.root,versionFile),version=versionFrom(ctx.readText(file,256*1024));
19
+ return {components:[{id:app.id+':core',applicationId:app.id,kind:'core',name:'Redmine',coord:'redmine',version,
20
+ visibility:'public',path:app.root,evidence:[{path:file,field:'Redmine::VERSION (MAJOR, MINOR, TINY)'}]}],
21
+ coverage:[{applicationId:app.id,capability:'inventory',execution:'completed',result:'not-applicable',expected:1,executed:1}],diagnostics:[]};
22
+ },
23
+ assess(){return [];},remediation(){return null;},
24
+ };