vigievuln 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +34 -19
  3. package/completions/vigievuln.bash +14 -3
  4. package/completions/vigievuln.zsh +11 -8
  5. package/data/fingerprints/index.js +80 -0
  6. package/data/fingerprints/interpreters/javascript/bun.json +23 -0
  7. package/data/fingerprints/interpreters/javascript/deno.json +10 -0
  8. package/data/fingerprints/interpreters/javascript/electron.json +20 -0
  9. package/data/fingerprints/interpreters/javascript/gjs.json +8 -0
  10. package/data/fingerprints/interpreters/javascript/javascriptcore.json +14 -0
  11. package/data/fingerprints/interpreters/javascript/jscgtk.json +10 -0
  12. package/data/fingerprints/interpreters/javascript/node.json +26 -0
  13. package/data/fingerprints/interpreters/javascript/nwjs.json +8 -0
  14. package/data/fingerprints/interpreters/javascript/webkitgtk.json +10 -0
  15. package/data/fingerprints/interpreters/javascript/wpewebkit.json +10 -0
  16. package/data/fingerprints/interpreters/languages/dotnet.json +8 -0
  17. package/data/fingerprints/interpreters/languages/erlang.json +9 -0
  18. package/data/fingerprints/interpreters/languages/gawk.json +10 -0
  19. package/data/fingerprints/interpreters/languages/guile.json +9 -0
  20. package/data/fingerprints/interpreters/languages/java.json +8 -0
  21. package/data/fingerprints/interpreters/languages/julia.json +9 -0
  22. package/data/fingerprints/interpreters/languages/lua.json +11 -0
  23. package/data/fingerprints/interpreters/languages/luajit.json +10 -0
  24. package/data/fingerprints/interpreters/languages/perl.json +11 -0
  25. package/data/fingerprints/interpreters/languages/php.json +22 -0
  26. package/data/fingerprints/interpreters/languages/powershell.json +17 -0
  27. package/data/fingerprints/interpreters/languages/pypy.json +8 -0
  28. package/data/fingerprints/interpreters/languages/python.json +24 -0
  29. package/data/fingerprints/interpreters/languages/r.json +9 -0
  30. package/data/fingerprints/interpreters/languages/racket.json +9 -0
  31. package/data/fingerprints/interpreters/languages/raku.json +8 -0
  32. package/data/fingerprints/interpreters/languages/ruby.json +21 -0
  33. package/data/fingerprints/interpreters/languages/tcl.json +9 -0
  34. package/data/fingerprints/interpreters/shells/bash.json +10 -0
  35. package/data/fingerprints/interpreters/shells/dash.json +8 -0
  36. package/data/fingerprints/interpreters/shells/fish.json +9 -0
  37. package/data/fingerprints/interpreters/shells/ksh.json +8 -0
  38. package/data/fingerprints/interpreters/shells/zsh.json +9 -0
  39. package/data/fingerprints/services/databases/clickhouse.json +8 -0
  40. package/data/fingerprints/services/databases/elasticsearch.json +8 -0
  41. package/data/fingerprints/services/databases/etcd.json +9 -0
  42. package/data/fingerprints/services/databases/mariadb.json +9 -0
  43. package/data/fingerprints/services/databases/memcached.json +9 -0
  44. package/data/fingerprints/services/databases/mongo.json +8 -0
  45. package/data/fingerprints/services/databases/mysql.json +9 -0
  46. package/data/fingerprints/services/databases/opensearch.json +8 -0
  47. package/data/fingerprints/services/databases/postgres.json +18 -0
  48. package/data/fingerprints/services/databases/redis.json +9 -0
  49. package/data/fingerprints/services/databases/valkey.json +8 -0
  50. package/data/fingerprints/services/dns-directory/bind.json +8 -0
  51. package/data/fingerprints/services/dns-directory/dnsmasq.json +8 -0
  52. package/data/fingerprints/services/dns-directory/slapd.json +8 -0
  53. package/data/fingerprints/services/dns-directory/unbound.json +8 -0
  54. package/data/fingerprints/services/mail/cyrus.json +8 -0
  55. package/data/fingerprints/services/mail/dovecot.json +8 -0
  56. package/data/fingerprints/services/mail/exim.json +9 -0
  57. package/data/fingerprints/services/mail/opendkim.json +8 -0
  58. package/data/fingerprints/services/mail/opensmtpd.json +8 -0
  59. package/data/fingerprints/services/mail/postfix.json +8 -0
  60. package/data/fingerprints/services/mail/rspamd.json +8 -0
  61. package/data/fingerprints/services/mail/sendmail.json +8 -0
  62. package/data/fingerprints/services/messaging/kafka.json +8 -0
  63. package/data/fingerprints/services/messaging/mosquitto.json +8 -0
  64. package/data/fingerprints/services/messaging/nats.json +9 -0
  65. package/data/fingerprints/services/messaging/rabbitmq.json +8 -0
  66. package/data/fingerprints/services/remote-access/dropbear.json +8 -0
  67. package/data/fingerprints/services/remote-access/openssh.json +10 -0
  68. package/data/fingerprints/services/remote-access/proftpd.json +8 -0
  69. package/data/fingerprints/services/remote-access/samba.json +8 -0
  70. package/data/fingerprints/services/remote-access/vsftpd.json +8 -0
  71. package/data/fingerprints/services/web-proxies/apache.json +18 -0
  72. package/data/fingerprints/services/web-proxies/caddy.json +9 -0
  73. package/data/fingerprints/services/web-proxies/envoy.json +8 -0
  74. package/data/fingerprints/services/web-proxies/haproxy.json +10 -0
  75. package/data/fingerprints/services/web-proxies/lighttpd.json +8 -0
  76. package/data/fingerprints/services/web-proxies/nginx.json +14 -0
  77. package/data/fingerprints/services/web-proxies/squid.json +8 -0
  78. package/data/fingerprints/services/web-proxies/tomcat.json +8 -0
  79. package/data/fingerprints/services/web-proxies/traefik.json +9 -0
  80. package/data/fingerprints/services/web-proxies/varnish.json +8 -0
  81. package/lib/README.md +51 -0
  82. package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
  83. package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
  84. package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
  85. package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
  86. package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
  87. package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
  88. package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
  89. package/lib/{native-advisories.js → advisories/native.js} +15 -13
  90. package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
  91. package/lib/{advisory-store.js → advisories/store.js} +2 -2
  92. package/lib/{application-exports.js → applications/exports.js} +1 -1
  93. package/lib/{application-inventory.js → applications/inventory.js} +3 -1
  94. package/lib/applications/layout.js +199 -0
  95. package/lib/{application-providers → applications}/live-snapshot.js +10 -10
  96. package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
  97. package/lib/applications/plugins/ghost.js +36 -0
  98. package/lib/{application-plugins → applications/plugins}/index.js +1 -1
  99. package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
  100. package/lib/applications/plugins/redmine.js +24 -0
  101. package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
  102. package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
  103. package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
  104. package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
  105. package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
  106. package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
  107. package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
  108. package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
  109. package/lib/artifacts/access-warnings.js +24 -0
  110. package/lib/artifacts/applications.js +39 -8
  111. package/lib/artifacts/component-scope.js +12 -3
  112. package/lib/artifacts/cve-view.js +8 -5
  113. package/lib/artifacts/disk-wasm.mjs +3 -0
  114. package/lib/artifacts/disk.js +188 -0
  115. package/lib/artifacts/elf-product.js +215 -0
  116. package/lib/artifacts/enrichment.js +31 -17
  117. package/lib/artifacts/go-main-identity.js +135 -36
  118. package/lib/artifacts/go-publisher-advisories.js +4 -3
  119. package/lib/artifacts/image-products.js +181 -0
  120. package/lib/artifacts/index.js +36 -13
  121. package/lib/artifacts/install-version.js +44 -0
  122. package/lib/artifacts/inventory-scope.js +53 -3
  123. package/lib/artifacts/pe-product.js +28 -0
  124. package/lib/artifacts/product-advisories.js +212 -0
  125. package/lib/artifacts/product-catalog.js +67 -0
  126. package/lib/artifacts/release-catalogues.js +149 -0
  127. package/lib/artifacts/release-versions.js +101 -0
  128. package/lib/artifacts/remediation-report.js +1 -1
  129. package/lib/artifacts/report-inventory.js +17 -2
  130. package/lib/artifacts/report-path.js +29 -0
  131. package/lib/artifacts/report.js +85 -32
  132. package/lib/artifacts/retire.js +3 -3
  133. package/lib/artifacts/risk-report.js +12 -8
  134. package/lib/artifacts/sbom.js +33 -4
  135. package/lib/artifacts/scan.js +316 -69
  136. package/lib/artifacts/system-apps.js +98 -0
  137. package/lib/artifacts/system-maintenance.js +101 -0
  138. package/lib/artifacts/system-module-updates.js +104 -0
  139. package/lib/artifacts/system-report.js +232 -0
  140. package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
  141. package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
  142. package/lib/{cache-db.js → cache/db.js} +1 -1
  143. package/lib/{dump-format.js → cache/dump-format.js} +2 -2
  144. package/lib/{json-cache.js → cache/json.js} +1 -1
  145. package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
  146. package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
  147. package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
  148. package/lib/{cache-repository.js → cache/repository.js} +1 -1
  149. package/lib/{resource-cache → cache/resource}/engine.js +23 -16
  150. package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
  151. package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
  152. package/lib/{resource-cache → cache/resource}/validate.js +20 -5
  153. package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
  154. package/lib/certs/scan.js +17 -11
  155. package/lib/cli-collect.js +262 -0
  156. package/lib/cli-command-routing.js +30 -13
  157. package/lib/cli-groups.js +1 -1
  158. package/lib/cli-image.js +158 -47
  159. package/lib/cli-project-commands.js +10 -10
  160. package/lib/cli-setup.js +8 -8
  161. package/lib/cli-watch.js +3 -3
  162. package/lib/codecs/binary/elf-metadata.js +6 -0
  163. package/lib/codecs/binary/metadata.js +1 -1
  164. package/lib/codecs/binary/pe-metadata.js +47 -11
  165. package/lib/codecs/binary/scan.js +12 -4
  166. package/lib/codecs/binary.codec.js +1 -1
  167. package/lib/codecs/composer/platform.js +2 -2
  168. package/lib/codecs/composer/registry.js +12 -18
  169. package/lib/codecs/composer.codec.js +6 -5
  170. package/lib/codecs/go/parse.js +1 -1
  171. package/lib/codecs/go/registry.js +7 -7
  172. package/lib/codecs/go.codec.js +2 -2
  173. package/lib/codecs/gradle/parse.js +1 -1
  174. package/lib/codecs/gradle/versionless.js +2 -2
  175. package/lib/codecs/gradle.codec.js +7 -7
  176. package/lib/codecs/index.js +1 -1
  177. package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
  178. package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
  179. package/lib/codecs/maven/jar-scan.js +4 -4
  180. package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
  181. package/lib/{core.js → codecs/maven/pom.js} +22 -11
  182. package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
  183. package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
  184. package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
  185. package/lib/codecs/maven.codec.js +18 -14
  186. package/lib/codecs/npm/collect.js +55 -8
  187. package/lib/codecs/npm/manifest-kind.js +16 -0
  188. package/lib/codecs/npm/parse.js +23 -7
  189. package/lib/codecs/npm/registry.js +28 -14
  190. package/lib/codecs/npm.codec.js +5 -5
  191. package/lib/codecs/nuget/registry.js +7 -7
  192. package/lib/codecs/nuget.codec.js +4 -4
  193. package/lib/codecs/pypi/registry.js +7 -7
  194. package/lib/codecs/pypi.codec.js +4 -4
  195. package/lib/codecs/recipes.js +2 -2
  196. package/lib/codecs/ruby/registry.js +7 -7
  197. package/lib/codecs/ruby.codec.js +2 -2
  198. package/lib/config.js +1 -1
  199. package/lib/{attribution.js → findings/attribution.js} +3 -3
  200. package/lib/findings/cve-descriptions.js +144 -0
  201. package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
  202. package/lib/{diff.js → findings/diff.js} +0 -0
  203. package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
  204. package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
  205. package/lib/{gate.js → findings/gate.js} +1 -1
  206. package/lib/{malware.js → findings/malware.js} +30 -7
  207. package/lib/{merge-sources.js → findings/merge.js} +57 -9
  208. package/lib/{priority.js → findings/priority.js} +3 -3
  209. package/lib/findings/risk-evidence.js +24 -0
  210. package/lib/findings/severity.js +16 -0
  211. package/lib/{finding-summary.js → findings/summary.js} +5 -2
  212. package/lib/{suppress.js → findings/suppress.js} +2 -2
  213. package/lib/images/local-docker.js +72 -0
  214. package/lib/{image-network.js → images/network.js} +26 -16
  215. package/lib/{image-references.js → images/references.js} +29 -11
  216. package/lib/{image-registry.js → images/registry.js} +18 -9
  217. package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
  218. package/lib/images/temp-roots.js +23 -0
  219. package/lib/{image-update.js → images/update.js} +3 -3
  220. package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
  221. package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
  222. package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
  223. package/lib/{embedded.js → inventory/embedded.js} +4 -3
  224. package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
  225. package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
  226. package/lib/{module-names.js → inventory/module-names.js} +1 -1
  227. package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
  228. package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
  229. package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
  230. package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
  231. package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
  232. package/lib/{purl.js → inventory/purl.js} +2 -2
  233. package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
  234. package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
  235. package/lib/{outdated.js → maintenance/outdated.js} +20 -20
  236. package/lib/options-env.js +1 -1
  237. package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
  238. package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
  239. package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
  240. package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
  241. package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
  242. package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
  243. package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
  244. package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
  245. package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
  246. package/lib/providers/{debian.js → debian/index.js} +1 -0
  247. package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
  248. package/lib/providers/{drupal.js → drupal/index.js} +4 -0
  249. package/lib/providers/{eol.js → eol/index.js} +1 -1
  250. package/lib/{epss.js → providers/epss/enrich.js} +16 -13
  251. package/lib/providers/{epss.js → epss/index.js} +2 -2
  252. package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
  253. package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
  254. package/lib/providers/{freexian.js → freexian/index.js} +3 -3
  255. package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
  256. package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
  257. package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
  258. package/lib/{gcve.js → providers/gcve/id.js} +1 -1
  259. package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
  260. package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
  261. package/lib/providers/{github.js → github/index.js} +3 -1
  262. package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
  263. package/lib/providers/{go.js → go/index.js} +1 -1
  264. package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
  265. package/lib/providers/{hashid.js → hashid/index.js} +1 -1
  266. package/lib/providers/index.js +18 -13
  267. package/lib/{kev.js → providers/kev/enrich.js} +12 -9
  268. package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
  269. package/lib/providers/{maven.js → maven/index.js} +5 -3
  270. package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
  271. package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
  272. package/lib/providers/mit-kerberos/index.js +6 -0
  273. package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
  274. package/lib/providers/{npm.js → npm/index.js} +1 -1
  275. package/lib/providers/{nuget.js → nuget/index.js} +1 -1
  276. package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
  277. package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
  278. package/lib/providers/{nvd.js → nvd/index.js} +18 -4
  279. package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
  280. package/lib/{osv-db.js → providers/osv/db.js} +18 -16
  281. package/lib/providers/{osv.js → osv/index.js} +1 -1
  282. package/lib/{osv.js → providers/osv/query.js} +150 -80
  283. package/lib/providers/package-releases/index.js +26 -0
  284. package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
  285. package/lib/providers/{packagist.js → packagist/index.js} +1 -1
  286. package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
  287. package/lib/providers/{pypi.js → pypi/index.js} +1 -1
  288. package/lib/providers/redhat/bzip2.js +167 -0
  289. package/lib/providers/redhat/errata.js +75 -0
  290. package/lib/providers/redhat/index.js +10 -0
  291. package/lib/providers/redhat/oval.js +70 -0
  292. package/lib/providers/redhat/unfixed.js +127 -0
  293. package/lib/{registries.js → providers/registries.js} +4 -4
  294. package/lib/{retire.js → providers/retire/scan.js} +18 -18
  295. package/lib/providers/{ruby.js → ruby/index.js} +1 -1
  296. package/lib/providers/rubysec/advisories.js +177 -0
  297. package/lib/providers/rubysec/index.js +9 -0
  298. package/lib/{snyk.js → providers/snyk/client.js} +2 -2
  299. package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
  300. package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
  301. package/lib/providers/wolfi/index.js +10 -0
  302. package/lib/providers/wolfi/secdb.js +47 -0
  303. package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
  304. package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
  305. package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
  306. package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
  307. package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
  308. package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
  309. package/lib/providers/wpvulnerability/assess.js +181 -0
  310. package/lib/providers/wpvulnerability/index.js +12 -0
  311. package/lib/{charts.js → reports/charts.js} +25 -18
  312. package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
  313. package/lib/{cve-report.js → reports/cve-report.js} +453 -228
  314. package/lib/reports/detail.js +55 -0
  315. package/lib/{i18n.js → reports/i18n.js} +38 -2
  316. package/lib/{report-integrity.js → reports/integrity.js} +1 -1
  317. package/lib/{json-export.js → reports/json-export.js} +95 -24
  318. package/lib/{report-notices.js → reports/notices.js} +11 -6
  319. package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
  320. package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
  321. package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
  322. package/lib/scan/coverage.js +114 -0
  323. package/lib/{provenance.js → scan/provenance.js} +12 -5
  324. package/lib/scan/reliability.js +157 -0
  325. package/lib/{source-health.js → scan/source-health.js} +52 -20
  326. package/lib/{source-profile.js → scan/source-profile.js} +3 -3
  327. package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
  328. package/lib/{project-client.js → service/project-client.js} +20 -2
  329. package/lib/source-input.js +58 -0
  330. package/lib/system-inventory/advisories.js +89 -16
  331. package/lib/system-inventory/collect.js +33 -10
  332. package/lib/system-inventory/distribution-sources.js +32 -15
  333. package/lib/system-inventory/package-applicability.js +51 -0
  334. package/lib/system-inventory/targeted.js +8 -5
  335. package/lib/ui.js +11 -0
  336. package/package.json +49 -2
  337. package/vigievuln.js +483 -352
  338. package/lib/cache-archive.js +0 -676
  339. package/lib/osv-legacy.js +0 -57
  340. package/lib/risk-evidence.js +0 -18
  341. package/lib/scan-coverage.js +0 -61
  342. /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
  343. /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
  344. /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
  345. /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
  346. /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
  347. /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
  348. /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
  349. /package/lib/{cache-directory.js → cache/directory.js} +0 -0
  350. /package/lib/{cache-policy.js → cache/policy.js} +0 -0
  351. /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
  352. /package/lib/{cache-startup.js → cache/startup.js} +0 -0
  353. /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
  354. /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
  355. /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
  356. /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
  357. /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
  358. /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
  359. /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
  360. /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
  361. /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
  362. /package/lib/providers/{kev.js → kev/index.js} +0 -0
  363. /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
  364. /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
  365. /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
  366. /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
  367. /package/lib/providers/{retire.js → retire/index.js} +0 -0
  368. /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
  369. /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
  370. /package/lib/{report-time.js → reports/time.js} +0 -0
  371. /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
  372. /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
  373. /package/lib/{account-client.js → service/account-client.js} +0 -0
  374. /package/lib/{account-session.js → service/account-session.js} +0 -0
  375. /package/lib/{account-terms.js → service/account-terms.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  const fs = require("node:fs");
2
2
  const path = require("node:path");
3
- const { walkDirs } = require("../parallel-walk");
4
- const { makeDirFilter } = require("../path-filter");
5
- const { createCoverage } = require("../scan-coverage");
3
+ const { walkDirs } = require("../../inventory/parallel-walk");
4
+ const { makeDirFilter } = require("../../inventory/path-filter");
5
+ const { createCoverage } = require("../../scan/coverage");
6
6
  const { selectPlugins } = require("./select");
7
7
 
8
8
  const DEFAULT_SKIP = new Set([".git", ".idea", ".vscode", "node_modules", "vendor", "dist", "build", "out", "target"]);
@@ -37,7 +37,7 @@ async function indexApplicationTree(root, opts = {}) {
37
37
  useDefaults: opts.defaultExcludes !== false,
38
38
  onSkip(abs, reason) { skipped.push({ path: posix(path.relative(srcRoot, abs)), reason }); },
39
39
  });
40
- await walkDirs(srcRoot, { skipDir, onDir(abs, entries) {
40
+ await walkDirs(srcRoot, { skipDir: (child, name) => opts.skipInventoryDir?.(child) || skipDir(child, name), onDir(abs, entries) {
41
41
  const rel = posix(path.relative(srcRoot, abs)) || ".";
42
42
  byDir.set(rel, new Set(entries.filter(e => e.isFile()).map(e => e.name)));
43
43
  } });
@@ -57,11 +57,11 @@ async function indexApplicationTree(root, opts = {}) {
57
57
  function checkedFile(root, relativePath) {
58
58
  if (typeof relativePath !== "string" || path.isAbsolute(relativePath)) throw new Error("application plugin read requires a relative path");
59
59
  const abs = path.resolve(root, relativePath);
60
- if (abs !== root && !abs.startsWith(root + path.sep)) throw new Error("application plugin read escaped scan root");
60
+ if (abs !== root && !abs.startsWith(root.endsWith(path.sep) ? root : root + path.sep)) throw new Error("application plugin read escaped scan root");
61
61
  const stat = fs.lstatSync(abs);
62
62
  if (!stat.isFile() || stat.isSymbolicLink()) throw new Error("application plugin read requires a regular file");
63
63
  const real = fs.realpathSync(abs);
64
- if (!real.startsWith(root + path.sep)) throw new Error("application plugin read escaped scan root");
64
+ if (!real.startsWith(root.endsWith(path.sep) ? root : root + path.sep)) throw new Error("application plugin read escaped scan root");
65
65
  return { abs, stat };
66
66
  }
67
67
 
@@ -109,27 +109,32 @@ async function runApplicationPlugins(root, opts = {}) {
109
109
  // application plugin is selected, and the file goes through the same validation
110
110
  // (schema, freshness) as an operator-supplied one.
111
111
  const selectedPluginIds = new Set(plugins.map(plugin => plugin.id));
112
- const hostedOnline = !opts.offline && require("../providers").hasHostedProxy();
113
- const wordfenceProxyOnline = !opts.offline && require("../providers").hasProxyRoute();
112
+ const hostedOnline = !opts.offline && require("../../providers").hasHostedProxy();
113
+ const wordfenceProxyOnline = !opts.offline && require("../../providers").hasProxyRoute();
114
114
  const liveWordfenceUrl = opts.offline ? null : opts.liveWordfenceUrl || null;
115
115
  const forceCachedSource = (pluginId,file,configured,live,defaultUrl) => {
116
- if (opts.offline || configured || live || !opts.advisoryCacheDir || !selectedPluginIds.has(pluginId) || !require('../cache-policy').shouldForceUpdate()) return live || null;
117
- return require('../application-providers/snapshot-cache').exists(path.join(opts.advisoryCacheDir,file)) ? defaultUrl : null;
116
+ if (opts.offline || configured || live || !opts.advisoryCacheDir || !selectedPluginIds.has(pluginId) || !require('../../cache/policy').shouldForceUpdate()) return live || null;
117
+ return require('../snapshot-cache').exists(path.join(opts.advisoryCacheDir,file)) ? defaultUrl : null;
118
118
  };
119
+ // The publisher advisories of a selected CMS are consulted by default when the scan is
120
+ // online: there is no flag to know. A local snapshot or an explicit URL wins, and
121
+ // --offline never fetches.
122
+ const automatic = (pluginId, configured, live, defaultUrl) => live ||
123
+ (opts.automaticLiveSources && !opts.offline && !configured && selectedPluginIds.has(pluginId) ? defaultUrl : null);
119
124
  // Drupal's live operation is scoped to the inventoried public package identities.
120
125
  // Never refresh a bulk catalogue here, and never replace an operator-selected file.
121
- const liveDrupalAdvisoriesUrl = opts.offline ? null : (opts.liveDrupalAdvisoriesUrl ||
122
- (hostedOnline && !opts.drupalAdvisoriesPath && selectedPluginIds.has("drupal")
123
- ? require("../application-providers/live-snapshot").DRUPAL_ADVISORIES_URL : null) ||
124
- forceCachedSource('drupal','drupal-security-advisories.json',opts.drupalAdvisoriesPath,null,require('../application-providers/live-snapshot').DRUPAL_ADVISORIES_URL));
125
- const livePrestashopAdvisoriesUrl=forceCachedSource('prestashop','github-prestashop-advisories.json',opts.prestashopAdvisoriesPath,opts.livePrestashopAdvisoriesUrl,require('../application-providers/live-snapshot').PRESTASHOP_GITHUB_ADVISORIES_URL);
126
- const liveTypo3AdvisoriesUrl=forceCachedSource('typo3','github-typo3-advisories.json',opts.typo3AdvisoriesPath,opts.liveTypo3AdvisoriesUrl,require('../application-providers/live-snapshot').TYPO3_GITHUB_ADVISORIES_URL);
127
- const liveSpipAdvisoriesUrl=forceCachedSource('spip','spip-security-advisories.json',opts.spipAdvisoriesPath,opts.liveSpipAdvisoriesUrl,require('../application-providers/spip-advisories').SPIP_ADVISORIES_URL);
126
+ const SNAPSHOT_URLS = require("../live-snapshot");
127
+ const liveDrupalAdvisoriesUrl = opts.offline ? null : automatic('drupal', opts.drupalAdvisoriesPath, opts.liveDrupalAdvisoriesUrl ||
128
+ (hostedOnline && !opts.drupalAdvisoriesPath && selectedPluginIds.has("drupal") ? SNAPSHOT_URLS.DRUPAL_ADVISORIES_URL : null) ||
129
+ forceCachedSource('drupal','drupal-security-advisories.json',opts.drupalAdvisoriesPath,null,SNAPSHOT_URLS.DRUPAL_ADVISORIES_URL), SNAPSHOT_URLS.DRUPAL_ADVISORIES_URL);
130
+ const livePrestashopAdvisoriesUrl=automatic('prestashop',opts.prestashopAdvisoriesPath,forceCachedSource('prestashop','github-prestashop-advisories.json',opts.prestashopAdvisoriesPath,opts.livePrestashopAdvisoriesUrl,SNAPSHOT_URLS.PRESTASHOP_GITHUB_ADVISORIES_URL),SNAPSHOT_URLS.PRESTASHOP_GITHUB_ADVISORIES_URL);
131
+ const liveTypo3AdvisoriesUrl=automatic('typo3',opts.typo3AdvisoriesPath,forceCachedSource('typo3','github-typo3-advisories.json',opts.typo3AdvisoriesPath,opts.liveTypo3AdvisoriesUrl,SNAPSHOT_URLS.TYPO3_GITHUB_ADVISORIES_URL),SNAPSHOT_URLS.TYPO3_GITHUB_ADVISORIES_URL);
132
+ const liveSpipAdvisoriesUrl=automatic('spip',opts.spipAdvisoriesPath,forceCachedSource('spip','spip-security-advisories.json',opts.spipAdvisoriesPath,opts.liveSpipAdvisoriesUrl,require('../../providers/spip/advisories').SPIP_ADVISORIES_URL),require('../../providers/spip/advisories').SPIP_ADVISORIES_URL);
128
133
  const autoCachedSources = new Set();
129
134
  const withCachedFallback = (configured, liveUrl, pluginId, file) => {
130
135
  if (configured || liveUrl || !opts.advisoryCacheDir || !selectedPluginIds.has(pluginId)) return configured || null;
131
136
  const cached = path.join(opts.advisoryCacheDir, file);
132
- if (!require('../application-providers/snapshot-cache').exists(cached)) return configured || null;
137
+ if (!require('../snapshot-cache').exists(cached)) return configured || null;
133
138
  autoCachedSources.add(cached);
134
139
  return cached;
135
140
  };
@@ -147,7 +152,7 @@ async function runApplicationPlugins(root, opts = {}) {
147
152
  const validatedLocalSources = new Map();
148
153
  const validateLocalSource = (snapshotPath, label, validate) => {
149
154
  if (!snapshotPath || validatedLocalSources.has(snapshotPath)) return;
150
- const {stat,bytes}=require('../application-providers/snapshot-cache').read(snapshotPath,
155
+ const {stat,bytes}=require('../snapshot-cache').read(snapshotPath,
151
156
  {preferCache:autoCachedSources.has(snapshotPath)});
152
157
  if (!stat.isFile() || stat.size > 128 * 1024 * 1024)
153
158
  throw new Error(`${label} advisory snapshot must be a JSON file of at most 128 MiB`);
@@ -158,31 +163,31 @@ async function runApplicationPlugins(root, opts = {}) {
158
163
  const revalidateWordfence = snapshotPath === wordfenceFeedPath && wordfenceProxyOnline &&
159
164
  staleWordfenceSnapshot(snapshot._fadSnapshot, opts.now || Date.now(), autoCachedSources.has(snapshotPath));
160
165
  if (opts.maxAdvisoryAgeMs && !revalidateWordfence) {
161
- const { assertFresh } = require("../advisory-freshness");
166
+ const { assertFresh } = require("../../advisories/freshness");
162
167
  assertFresh(snapshot, label, opts.maxAdvisoryAgeMs, opts.now || Date.now());
163
168
  }
164
169
  validatedLocalSources.set(snapshotPath, { stat, bytes, snapshot });
165
170
  };
166
- validateLocalSource(wordfenceFeedPath, "Wordfence", feed => require("../application-providers/wordfence-v3").indexFeed(feed));
167
- validateLocalSource(drupalAdvisoriesPath, "Drupal advisories", require("../application-providers/drupal-advisories").validateSnapshot);
171
+ validateLocalSource(wordfenceFeedPath, "Wordfence", feed => require("../../providers/wordfence/v3").indexFeed(feed));
172
+ validateLocalSource(drupalAdvisoriesPath, "Drupal advisories", require("../../providers/drupal/advisories").validateSnapshot);
168
173
  validateLocalSource(prestashopAdvisoriesPath, "PrestaShop advisories",
169
- feed => require("../application-providers/github-advisories").validateSnapshot(feed, { fallbackCoord: "prestashop/prestashop" }));
174
+ feed => require("../../providers/github/advisories").validateSnapshot(feed, { fallbackCoord: "prestashop/prestashop" }));
170
175
  validateLocalSource(typo3AdvisoriesPath, "TYPO3 advisories",
171
- feed => require("../application-providers/github-advisories").validateSnapshot(feed));
176
+ feed => require("../../providers/github/advisories").validateSnapshot(feed));
172
177
  validateLocalSource(spipAdvisoriesPath, "SPIP advisories",
173
- require("../application-providers/spip-advisories").validateSnapshot);
178
+ require("../../providers/spip/advisories").validateSnapshot);
174
179
  validateLocalSource(opts.wpChecksumsPath, "WordPress checksums",
175
- require("../application-providers/wp-checksums").validateChecksums);
180
+ require("../../providers/wordpress/checksums").validateChecksums);
176
181
  const result = { applications: [], inventory: [], findings: [], coverage: [], diagnostics: [] };
177
182
  if (!plugins.length) return result;
178
- const index = await indexApplicationTree(root, opts);
183
+ const index = opts.savedInventory ? null : await indexApplicationTree(root, opts);
179
184
  const journal = createCoverage();
180
185
  const privatePaths = new Set((opts.privateComponentPaths || []).map(privatePath));
181
186
  const publicSlugs = new Map((opts.publicComponents || []).map(publicComponent));
182
187
  for (const relative of publicSlugs.keys()) if (privatePaths.has(relative))
183
188
  throw new Error(`component cannot be both private and public: ${relative}`);
184
189
  const context = {
185
- srcRoot: index.srcRoot, index, resolvedDeps: opts.resolvedDeps || new Map(),
190
+ srcRoot: index?.srcRoot, index, inventoryReplay: !!opts.savedInventory, resolvedDeps: opts.resolvedDeps || new Map(),
186
191
  activeCodecIds: opts.activeCodecIds || [],
187
192
  readText: (rel, maxBytes) => boundedRead(index.srcRoot, rel, maxBytes),
188
193
  readPrefix: (rel, maxBytes) => boundedPrefix(index.srcRoot, rel, maxBytes),
@@ -218,14 +223,14 @@ async function runApplicationPlugins(root, opts = {}) {
218
223
  const local = validatedLocalSources.get(wordfenceFeedPath)?.snapshot;
219
224
  const localStale = staleWordfenceSnapshot(local?._fadSnapshot, context.now,
220
225
  autoCachedSources.has(wordfenceFeedPath));
221
- const forceRefresh = !opts.offline && autoCachedSources.has(wordfenceFeedPath) && require('../cache-policy').shouldForceUpdate();
226
+ const forceRefresh = !opts.offline && autoCachedSources.has(wordfenceFeedPath) && require('../../cache/policy').shouldForceUpdate();
222
227
  let assessed;
223
228
  let refreshError;
224
229
  let usedLocal = true;
225
230
  if (plugin.id === "wordpress" && wordfenceProxyOnline && (localStale || forceRefresh)) {
226
231
  try {
227
232
  assessed = await plugin.assess(app, components, { ...context, wordfenceFeedPath: null,
228
- liveWordfenceUrl: require("../application-providers/wordfence-projection").SOURCE_URL });
233
+ liveWordfenceUrl: require("../../providers/wordfence/projection").SOURCE_URL });
229
234
  usedLocal = false;
230
235
  } catch (error) {
231
236
  if (requiredProviderIds.has("wordfence-v3") && !opts.reportProviderFailures) throw error;
@@ -248,6 +253,54 @@ async function runApplicationPlugins(root, opts = {}) {
248
253
  message: `Wordfence snapshot is stale; advisory coverage is indeterminate${refreshError
249
254
  ? ` (targeted revalidation failed: ${refreshError.message})` : ""}` }] : [])] };
250
255
  }
256
+ async function recordAssessment(plugin, app, components) {
257
+ try {
258
+ const assessed = await assessApplication(plugin, app, components) || [];
259
+ if (Array.isArray(assessed)) result.findings.push(...assessed);
260
+ else {
261
+ result.findings.push(...(assessed.findings || []));
262
+ result.diagnostics.push(...(assessed.diagnostics || []));
263
+ for (const check of assessed.coverage || []) {
264
+ if (context.maxAdvisoryAgeMs && check.sourceSnapshot)
265
+ require("../../advisories/freshness").assertFresh(check.sourceSnapshot,
266
+ check.sourceId || plugin.id, context.maxAdvisoryAgeMs, context.now);
267
+ journal.record(check);
268
+ }
269
+ }
270
+ } catch (error) {
271
+ const required = plugin.providerIds.filter(id => requiredProviderIds.has(id));
272
+ // Retain inventory and failure diagnostics for the CLI. Its
273
+ // coverage gate runs after export; library callers retain fail-fast semantics.
274
+ if (required.length && (!opts.reportProviderFailures || context.maxAdvisoryAgeMs))
275
+ throw new Error(`${plugin.id} advisory source failed: ${error.message}`);
276
+ result.diagnostics.push({ code: "CMS_PLUGIN_FAILED", applicationId: app.id,
277
+ sourceIds: required, message: `assessment failed: ${error.message}` });
278
+ if (!journal.records.some(c => c.applicationId === app.id && c.capability === "advisories")) {
279
+ for (const sourceId of required.length ? required : [null])
280
+ journal.record({ applicationId: app.id, ...(sourceId ? { sourceId } : {}),
281
+ capability: "advisories", execution: "failed", result: "indeterminate", diagnostic: "CMS_PLUGIN_FAILED" });
282
+ }
283
+ }
284
+ }
285
+ if (opts.savedInventory) {
286
+ const components = new Map();
287
+ for (const item of opts.savedInventory.inventory) {
288
+ if (!components.has(item.applicationId)) components.set(item.applicationId, []);
289
+ components.get(item.applicationId).push(item);
290
+ }
291
+ for (const app of opts.savedInventory.applications) {
292
+ const plugin = plugins.find(p => p.id === app.pluginId);
293
+ if (plugin) await recordAssessment(plugin, app, components.get(app.id) || []);
294
+ }
295
+ const embedded = opts.savedInventory.embeddedApplications || [];
296
+ for (const entry of embedded) {
297
+ const plugin = plugins.find(p => p.id === entry.app.pluginId);
298
+ if (plugin) await recordAssessment(plugin, entry.app, entry.inventory);
299
+ }
300
+ result.coverage = journal.records;
301
+ require('../layout').reparentAssessments(result,embedded);
302
+ return result;
303
+ }
251
304
  // discover returns candidates, and may add diagnostics (e.g. recognized-but-invalid input);
252
305
  // a bare candidate array stays the documented simple form.
253
306
  function discovered(plugin) {
@@ -271,15 +324,16 @@ async function runApplicationPlugins(root, opts = {}) {
271
324
  for (const candidate of candidates || []) {
272
325
  const relativeRoot = posix(candidate.root || ".").replace(/^\.\//, "") || ".";
273
326
  const abs = path.resolve(index.srcRoot, relativeRoot);
274
- if (path.isAbsolute(candidate.root || "") || (abs !== index.srcRoot && !abs.startsWith(index.srcRoot + path.sep))) {
327
+ if (path.isAbsolute(candidate.root || "") || (abs !== index.srcRoot && !abs.startsWith(index.srcRoot.endsWith(path.sep) ? index.srcRoot : index.srcRoot + path.sep))) {
275
328
  result.diagnostics.push({ code: "CMS_UNSUPPORTED_LAYOUT", pluginId: plugin.id, path: relativeRoot, message: "candidate root escapes scan root" });
276
329
  continue;
277
330
  }
278
- const app = { id: `${plugin.id}:${relativeRoot}`, type: plugin.id, root: relativeRoot, pluginId: plugin.id,
331
+ const app = { id: [opts.artifactTargetId, plugin.id, relativeRoot].filter(Boolean).join(":"), type: plugin.id, root: relativeRoot, pluginId: plugin.id,
279
332
  pluginVersion: plugin.version, scanContext: context.scanContext, evidence: candidate.evidence || [],
280
333
  ...(candidate.layout ? { layout: candidate.layout } : {}),
281
334
  ...(candidate.documentRoot ? { documentRoot: candidate.documentRoot } : {}),
282
335
  ...(candidate.contentRoot ? { contentRoot: candidate.contentRoot } : {}) };
336
+ if (candidate.deploymentRole) app.deploymentRole = candidate.deploymentRole;
283
337
  if (candidate.componentKind) app.componentKind = candidate.componentKind;
284
338
  if (candidate.edition) app.edition = candidate.edition;
285
339
  if (seen.has(app.id)) continue;
@@ -306,33 +360,8 @@ async function runApplicationPlugins(root, opts = {}) {
306
360
  journal.record({ applicationId: app.id, capability: "inventory", execution: "failed", result: "indeterminate", diagnostic: "CMS_PLUGIN_FAILED" });
307
361
  continue;
308
362
  }
309
- try {
310
- const assessed = await assessApplication(plugin, app, collected.components || []) || [];
311
- if (Array.isArray(assessed)) result.findings.push(...assessed);
312
- else {
313
- result.findings.push(...(assessed.findings || []));
314
- result.diagnostics.push(...(assessed.diagnostics || []));
315
- for (const check of assessed.coverage || []) {
316
- if (context.maxAdvisoryAgeMs && check.sourceSnapshot)
317
- require("../advisory-freshness").assertFresh(check.sourceSnapshot,
318
- check.sourceId || plugin.id, context.maxAdvisoryAgeMs, context.now);
319
- journal.record(check);
320
- }
321
- }
322
- } catch (error) {
323
- const required = plugin.providerIds.filter(id => requiredProviderIds.has(id));
324
- // A CLI scan must retain its inventory and write partial reports. Its explicit
325
- // coverage gate runs after export; library callers retain fail-fast semantics.
326
- if (required.length && (!opts.reportProviderFailures || context.maxAdvisoryAgeMs))
327
- throw new Error(`${plugin.id} advisory source failed: ${error.message}`);
328
- result.diagnostics.push({ code: "CMS_PLUGIN_FAILED", applicationId: app.id,
329
- sourceIds: required, message: `assessment failed: ${error.message}` });
330
- if (!journal.records.some(c => c.applicationId === app.id && c.capability === "advisories")) {
331
- for (const sourceId of required.length ? required : [null])
332
- journal.record({ applicationId: app.id, ...(sourceId ? { sourceId } : {}),
333
- capability: "advisories", execution: "failed", result: "indeterminate", diagnostic: "CMS_PLUGIN_FAILED" });
334
- }
335
- }
363
+ if (opts.inventoryOnly) continue;
364
+ await recordAssessment(plugin, app, collected.components || []);
336
365
  }
337
366
  }
338
367
  for (const relative of privatePaths) if (!result.inventory.some(component => component.path && privatePath(component.path) === relative))
@@ -351,6 +380,7 @@ async function runApplicationPlugins(root, opts = {}) {
351
380
  message: "component scan context recognized no supported application component in the scan root; " +
352
381
  "point --src at a plugin, theme, module or profile with valid metadata, or select the matching --app-plugins" });
353
382
  result.coverage = journal.records;
383
+ require('../layout').reconcileApplications(result);
354
384
  return result;
355
385
  }
356
386
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/application-plugins/spip.js — the SPIP application plugin.
2
+ * lib/applications/plugins/spip.js — the SPIP application plugin.
3
3
  *
4
4
  * SPIP is a French-CMS staple with a layout no other product shares: the front
5
5
  * controller `spip.php` next to `ecrire/inc_version.php` (which carries
@@ -10,15 +10,15 @@
10
10
  * Detection is conjunctive (`spip.php` AND `ecrire/inc_version.php`) and the core
11
11
  * version is only reported when the version constant is actually readable in the
12
12
  * marker file — a bare file name never creates an application. The advisory lane is
13
- * NVD's `cpe:2.3:a:spip:spip` (see lib/application-providers/spip-advisories.js):
13
+ * NVD's `cpe:2.3:a:spip:spip` (see lib/providers/spip/advisories.js):
14
14
  * no publisher API exists. SPIP plugins have no advisory source at all — their rows
15
15
  * say so. The composer lock of a SPIP tree is scanned by the standard lanes like
16
16
  * any library tree; this plugin adds the instance view on top.
17
17
  */
18
18
  const path = require("node:path");
19
19
  const fs = require("node:fs");
20
- const { SPIP_ADVISORIES_URL, fetchSpipAdvisories, assessSpipAdvisories } = require("../application-providers/spip-advisories");
21
- const { writeSnapshotAtomically } = require("../application-providers/live-snapshot");
20
+ const { SPIP_ADVISORIES_URL, fetchSpipAdvisories, assessSpipAdvisories } = require("../../providers/spip/advisories");
21
+ const { writeSnapshotAtomically } = require("../live-snapshot");
22
22
  const { localSourceSnapshot } = require("./wave2-common");
23
23
 
24
24
  /** Attributes of a `paquet.xml` (SPIP ≥3) or legacy `plugin.xml` root element. */
@@ -1,5 +1,5 @@
1
1
  const path = require("node:path");
2
- const frameworkMap = require("../../data/eol-composer-frameworks.json");
2
+ const frameworkMap = require("../../../data/eol-composer-frameworks.json");
3
3
 
4
4
  const FRAMEWORK_COMPONENTS = new Set(frameworkMap.symfony.components);
5
5
  const join = (dir, file) => dir === "." ? file : `${dir}/${file}`;
@@ -1,7 +1,7 @@
1
1
  const fs = require("node:fs");
2
2
  const path = require("node:path");
3
- const { fetchGithubAdvisories, writeSnapshotAtomically } = require("../application-providers/live-snapshot");
4
- const { assessGithubAdvisories, typo3RangeGrammar } = require("../application-providers/github-advisories");
3
+ const { fetchGithubAdvisories, writeSnapshotAtomically } = require("../live-snapshot");
4
+ const { assessGithubAdvisories, typo3RangeGrammar } = require("../../providers/github/advisories");
5
5
  const { join, within, readJson, composerOccurrences, composerComponent, composerCoverageDiagnostic, finishInventory, localSourceSnapshot } = require("./wave2-common");
6
6
 
7
7
  const GITHUB_REPO = "TYPO3/typo3";
@@ -106,7 +106,7 @@ function finishInventory(app, components, diagnostics = [], sourceId = "applicat
106
106
  */
107
107
  function localSourceSnapshot(ctx, snapshotPath, bytes, stat, snapshot) {
108
108
  const { createHash } = require("node:crypto");
109
- const { declaredCollectedAt } = require("../advisory-freshness");
109
+ const { declaredCollectedAt } = require("../../advisories/freshness");
110
110
  const declared = declaredCollectedAt(snapshot);
111
111
  const autoCached = ctx.autoCachedSources?.has(snapshotPath) || false;
112
112
  const stamp = snapshot && typeof snapshot === "object" ? snapshot._fadSnapshot : null;
@@ -1,19 +1,29 @@
1
1
  const path = require("node:path");
2
2
  const fs = require("node:fs");
3
- const { assessWordfenceFeed, indexFeed } = require("../application-providers/wordfence-v3");
4
- const { assertFresh } = require("../advisory-freshness");
5
- const { fetchWordfenceFeed, fetchWordpressChecksums, writeSnapshotAtomically } = require("../application-providers/live-snapshot");
6
- const { validateChecksums, evaluateChecksums, DEFAULT_MAX_FILE_BYTES, WP_CHECKSUMS_API } = require("../application-providers/wp-checksums");
3
+ const { assessWordfenceFeed, indexFeed } = require("../../providers/wordfence/v3");
4
+ const { assertFresh } = require("../../advisories/freshness");
5
+ const { fetchWordfenceFeed, fetchWordpressChecksums, writeSnapshotAtomically } = require("../live-snapshot");
6
+ const { validateChecksums, evaluateChecksums, DEFAULT_MAX_FILE_BYTES, WP_CHECKSUMS_API } = require("../../providers/wordpress/checksums");
7
7
  const { localSourceSnapshot } = require("./wave2-common");
8
8
 
9
9
  const join = (dir, file) => dir === "." ? file : `${dir}/${file}`;
10
10
  const directChild = (dir, parent) => path.posix.dirname(dir) === parent;
11
11
  const DROP_INS = new Set(["advanced-cache.php", "db.php", "object-cache.php", "sunrise.php", "maintenance.php", "fatal-error-handler.php", "install.php"]);
12
12
 
13
+ // WordPress reads a header field from any line of the file's first bytes (get_file_data),
14
+ // not from the first comment only: Akismet opens with a separate `@package` docblock.
13
15
  function header(text, key) {
14
- const comment = String(text || "").match(/\/\*([\s\S]*?)\*\//)?.[1] || "";
15
- const line = comment.split(/\r?\n/).find(raw => new RegExp(`^\\s*\\*?\\s*${key}:`, "i").test(raw));
16
- return line ? line.replace(new RegExp(`^\\s*\\*?\\s*${key}:\\s*`, "i"), "").trim() : null;
16
+ const match = String(text || "").match(new RegExp(`^(?:[ \\t]*<\\?php)?[ \\t/*#@]*${key}:(.*)$`, "mi"));
17
+ const value = match ? match[1].replace(/\s*(?:\*\/|\?>).*$/, "").trim() : "";
18
+ return value || null;
19
+ }
20
+
21
+ // An official directory URL in the extension header identifies its release
22
+ // catalogue even when the install directory was renamed. Never fetch that URL.
23
+ function releaseSlug(text, headerName, type) {
24
+ const uri = header(text, headerName);
25
+ const match = uri?.match(/^https?:\/\/wordpress\.org\/(plugins|themes)\/([a-z0-9][a-z0-9._-]{0,199})\/?$/i);
26
+ return match?.[1].toLowerCase() === type ? {releaseSlug:match[2].toLowerCase()} : {};
17
27
  }
18
28
 
19
29
  function pluginAt(dir, ctx, app, kind = "plugin") {
@@ -32,6 +42,7 @@ function pluginAt(dir, ctx, app, kind = "plugin") {
32
42
  try { coord = JSON.parse(ctx.readText(composerJson)).name || null; } catch { /* identity stays local/unknown */ }
33
43
  }
34
44
  return { id: `${app.id}:${kind}:${dir}`, applicationId: app.id, kind, path: dir,
45
+ ...(!privateComponent && releaseSlug(content,"Plugin URI","plugins")),
35
46
  name: displayName, slug: publicSlug || path.posix.basename(dir), coord, version: version || null,
36
47
  visibility: privateComponent ? "private" : publicSlug ? "public" : "unknown",
37
48
  catalogueStatus: publicSlug ? "user-declared" : "not-queried",
@@ -50,6 +61,7 @@ function themeAt(dir, ctx, app) {
50
61
  if (!name) return null;
51
62
  const version = header(content, "Version");
52
63
  return { id: `${app.id}:theme:${dir}`, applicationId: app.id, kind: "theme", path: dir,
64
+ ...(!ctx.isPrivatePath(dir) && !header(content,"Update URI") && releaseSlug(content,"Theme URI","themes")),
53
65
  name, slug: ctx.publicSlugForPath(dir) || path.posix.basename(dir), version: version || null, parentSlug: header(content, "Template"),
54
66
  visibility: ctx.isPrivatePath(dir) ? "private" : ctx.publicSlugForPath(dir) ? "public" : "unknown",
55
67
  catalogueStatus: ctx.publicSlugForPath(dir) ? "user-declared" : "not-queried",
@@ -60,7 +72,7 @@ function themeAt(dir, ctx, app) {
60
72
  module.exports = {
61
73
  id: "wordpress", version: "0.1.0", apiVersion: 1, label: "WordPress",
62
74
  supportedLayouts: ["classic", "bedrock"], capabilities: { inventory: "experimental", advisories: "experimental" },
63
- requiredCodecs: [], providerIds: ["wordfence-v3", "wordpress-checksums"],
75
+ requiredCodecs: [], providerIds: ["wordfence-v3", "wordpress-checksums", "wpvulnerability"],
64
76
  discover(ctx) {
65
77
  if (ctx.scanContext === "component") {
66
78
  const plugin = pluginAt(".", ctx, { id: "wordpress:." });
@@ -118,6 +130,27 @@ module.exports = {
118
130
  if (plugin) components.push(plugin);
119
131
  }
120
132
  }
133
+ // A single-file plugin sits directly in plugins/ (hello.php). WordPress.org does not name
134
+ // it after its file (hello.php is "hello-dolly"): only an official Plugin URI, or a
135
+ // declared slug, identifies its catalogue entry. Without one it is listed like any
136
+ // private component rather than assessed under a name that could be another plugin's.
137
+ for (const name of ctx.index.filesIn(pluginsBase).filter(n => n.endsWith(".php"))) {
138
+ const file = join(pluginsBase, name);
139
+ let text;
140
+ try { text = ctx.readPrefix(file); } catch { continue; }
141
+ const displayName = header(text, "Plugin Name");
142
+ if (!displayName) continue;
143
+ const version = header(text, "Version");
144
+ const declaredPrivate = ctx.isPrivatePath(file) || !!header(text, "Update URI");
145
+ const publicSlug = declaredPrivate ? null : ctx.publicSlugForPath(file);
146
+ const release = declaredPrivate ? {} : releaseSlug(text, "Plugin URI", "plugins");
147
+ components.push({ id: `${app.id}:plugin:${file}`, applicationId: app.id, kind: "plugin", path: file, ...release,
148
+ name: displayName, slug: publicSlug || release.releaseSlug || name.replace(/\.php$/, ""), coord: null, version: version || null,
149
+ visibility: publicSlug ? "public" : release.releaseSlug ? "unknown" : "private",
150
+ catalogueStatus: publicSlug ? "user-declared" : "not-queried",
151
+ identityStatus: publicSlug ? "asserted" : "probable", activation: "unknown",
152
+ evidence: [{ path: file, field: "Plugin Name" }, ...(version ? [{ path: file, field: "Version" }] : [])] });
153
+ }
121
154
  for (const name of ctx.index.filesIn(muBase).filter(n => n.endsWith(".php"))) {
122
155
  const file = join(muBase, name);
123
156
  let text;
@@ -160,6 +193,7 @@ module.exports = {
160
193
  const base = { applicationId: app.id, capability: "integrity", sourceId: "wordpress-checksums" };
161
194
  const notRun = diagnostic => ({ coverage: [{ ...base, execution: "not-run", result: "indeterminate",
162
195
  expected: 1, executed: 0, diagnostic }], diagnostics: [] });
196
+ if (ctx.inventoryReplay) return {coverage:[{...base,execution:"not-applicable",result:"not-applicable",expected:0,executed:0,diagnostic:"CMS_INVENTORY_ONLY"}],diagnostics:[]};
163
197
  let ctxSnapshotPath = null;
164
198
  if (!ctx.wpChecksumsPath && !ctx.liveWpChecksumsUrl) {
165
199
  // Cached-reference reuse: a reference a prior run (or the air-gap phase 2)
@@ -168,7 +202,7 @@ module.exports = {
168
202
  // an explicit --wp-checksums or live URL always wins.
169
203
  const cachedPath = ctx.advisoryCacheDir && core?.version
170
204
  ? path.join(ctx.advisoryCacheDir, `wordpress-checksums-${core.version}-${ctx.wpChecksumsLocale || "en_US"}.json`) : null;
171
- if (!cachedPath || !require('../application-providers/snapshot-cache').exists(cachedPath)) return notRun("CMS_PROVIDER_UNCONFIGURED");
205
+ if (!cachedPath || !require('../snapshot-cache').exists(cachedPath)) return notRun("CMS_PROVIDER_UNCONFIGURED");
172
206
  ctx.autoCachedSources?.add(cachedPath);
173
207
  ctxSnapshotPath = cachedPath;
174
208
  }
@@ -183,7 +217,7 @@ module.exports = {
183
217
  cached = ctx.snapshotCache.get(key);
184
218
  if (!cached) {
185
219
  const validated = ctx.validatedLocalSources?.get(checksumsPath);
186
- const source=validated||require('../application-providers/snapshot-cache').read(checksumsPath);
220
+ const source=validated||require('../snapshot-cache').read(checksumsPath);
187
221
  const stat = source.stat;
188
222
  if (!stat.isFile() || stat.size > 128 * 1024 * 1024) throw new Error("WordPress checksums snapshot must be a JSON file of at most 128 MiB");
189
223
  const bytes = source.bytes;
@@ -232,13 +266,13 @@ module.exports = {
232
266
  },
233
267
  async assess(app, components, ctx) {
234
268
  const integrity = await this.assessChecksums(app, components, ctx);
235
- if (!ctx.wordfenceFeedPath && !ctx.liveWordfenceUrl) return { findings: [], coverage: [
236
- { applicationId: app.id, capability: "advisories",
237
- sourceId: "wordfence-v3", execution: "not-run", result: "indeterminate", expected: components.length,
238
- executed: 0, diagnostic: "CMS_PROVIDER_UNCONFIGURED" }, ...integrity.coverage],
239
- diagnostics: integrity.diagnostics };
240
- const projection = !ctx.wordfenceFeedPath && require("../providers").hasProxyRoute();
241
- const software = projection ? require("../application-providers/wordfence-projection").componentQueries(components) : null;
269
+ if (!ctx.wordfenceFeedPath && !ctx.liveWordfenceUrl) {
270
+ const assessed = await require('../../providers/wpvulnerability/assess').assess(components, ctx);
271
+ return {...assessed, coverage:[...assessed.coverage, ...integrity.coverage],
272
+ diagnostics:[...assessed.diagnostics, ...integrity.diagnostics]};
273
+ }
274
+ const projection = !ctx.wordfenceFeedPath && require("../../providers").hasProxyRoute();
275
+ const software = projection ? require("../../providers/wordfence/projection").componentQueries(components) : null;
242
276
  const key = ctx.wordfenceFeedPath ? `wordfence-v3:${ctx.wordfenceFeedPath}` :
243
277
  `wordfence-v3:live:${ctx.liveWordfenceUrl}:${projection ? JSON.stringify(software) : "full"}`;
244
278
  let cached = ctx.snapshotCache.get(key);
@@ -259,7 +293,7 @@ module.exports = {
259
293
  fetchImpl: ctx.fetchImpl || undefined, now: ctx.now, apiKey: ctx.wordfenceApiKey, components,
260
294
  });
261
295
  if (ctx.advisoryCacheDir) {
262
- if (projection) require("../application-providers/wordfence-client").cacheProjection(ctx.advisoryCacheDir, fetched.snapshot);
296
+ if (projection) require("../../providers/wordfence/client").cacheProjection(ctx.advisoryCacheDir, fetched.snapshot);
263
297
  else writeSnapshotAtomically(path.join(ctx.advisoryCacheDir, "wordfence-v3.json"), fetched.snapshot);
264
298
  }
265
299
  cached = { index: indexFeed(fetched.snapshot), sourceSnapshot: fetched.sourceSnapshot };
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fs=require('node:fs');
4
4
  const path=require('node:path');
5
- const {createCacheRepository}=require('../cache-repository');
5
+ const {createCacheRepository}=require('../cache/repository');
6
6
 
7
7
  function slot(file){
8
8
  const dir=path.dirname(file);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/cms-snapshot-warm.js — phase-2 (online) warming of the per-publisher CMS advisory
2
+ * lib/applications/snapshot-warm.js — phase-2 (online) warming of the per-publisher CMS advisory
3
3
  * snapshots an air-gapped phase 3 consumes automatically (runner.js offline fallback).
4
4
  *
5
5
  * `--import-anonymized` scans the descriptor's public coordinates with no source tree,
@@ -18,11 +18,11 @@
18
18
  const path = require("node:path");
19
19
  const {
20
20
  fetchDrupalAdvisories, fetchGithubAdvisories, fetchWordpressChecksums, fetchWordfenceFeed, writeSnapshotAtomically,
21
- } = require("./application-providers/live-snapshot");
22
- const { fetchSpipAdvisories, validateSnapshot: validateSpip } = require("./application-providers/spip-advisories");
23
- const { validateSnapshot: validateDrupal } = require("./application-providers/drupal-advisories");
24
- const { validateSnapshot: validateGithub } = require("./application-providers/github-advisories");
25
- const { validateChecksums } = require("./application-providers/wp-checksums");
21
+ } = require("./live-snapshot");
22
+ const { fetchSpipAdvisories, validateSnapshot: validateSpip } = require("../providers/spip/advisories");
23
+ const { validateSnapshot: validateDrupal } = require("../providers/drupal/advisories");
24
+ const { validateSnapshot: validateGithub } = require("../providers/github/advisories");
25
+ const { validateChecksums } = require("../providers/wordpress/checksums");
26
26
 
27
27
  /** Public composer coordinates of a resolved-deps Map (or array) — "vendor/name", lowercased. */
28
28
  function composerCoords(deps) {
@@ -111,7 +111,7 @@ async function warmCmsAdvisorySnapshots(deps, { fetchImpl, advisoryCacheDir,
111
111
  }
112
112
  // In proxy mode only declared public identities are queried and cached.
113
113
  if (wordfenceApiKey || wordfenceLive) {
114
- const { WORDFENCE_PRODUCTION_URL } = require("./application-providers/live-snapshot");
114
+ const { WORDFENCE_PRODUCTION_URL } = require("./live-snapshot");
115
115
  const software = [{ type: "core", slug: "wordpress" }, ...applications
116
116
  .filter(app => String(app?.type || "").toLowerCase() === "wordpress")
117
117
  .flatMap(app => (app.components || []).flatMap(coord => {
@@ -121,9 +121,22 @@ async function warmCmsAdvisorySnapshots(deps, { fetchImpl, advisoryCacheDir,
121
121
  const fetched = await fetchWordfenceFeed(wordfenceUrl || WORDFENCE_PRODUCTION_URL,
122
122
  { fetchImpl, apiKey: wordfenceApiKey, now, software });
123
123
  if (fetched.snapshot.format === "wordfence-targeted-v1")
124
- require("./application-providers/wordfence-client").cacheProjection(advisoryCacheDir, fetched.snapshot);
124
+ require("../providers/wordfence/client").cacheProjection(advisoryCacheDir, fetched.snapshot);
125
125
  else writeSnapshotAtomically(path.join(advisoryCacheDir, "wordfence-v3.json"), fetched.snapshot);
126
126
  warmed.wordfence = true;
127
+ } else {
128
+ const ctx = {fetchImpl, advisoryCacheDir, now, snapshotCache:new Map()};
129
+ const queries = new Map();
130
+ for (const app of applications.filter(app => app.type === 'wordpress')) {
131
+ if (app.version) queries.set(`core:${app.version}`, {kind:'core',subject:app.version});
132
+ for (const coord of app.components || []) {
133
+ const match = /^wordpress:(plugin|theme):([a-z0-9][a-z0-9._-]*)$/.exec(coord);
134
+ if (match) queries.set(coord, {kind:match[1],subject:match[2]});
135
+ }
136
+ }
137
+ for (const query of queries.values())
138
+ await require('../providers/wpvulnerability/assess').fetchComponent(query, ctx);
139
+ warmed.wpvulnerability = queries.size;
127
140
  }
128
141
  }
129
142
  return warmed;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+ // A live system collected without root meets hundreds of unreadable directories and files.
3
+ // One notice says what that means, instead of one warning per path.
4
+ const DENIED = new Set(['EACCES', 'EPERM']);
5
+ const denied = w => DENIED.has(w?.code) || /\b(?:EACCES|EPERM)\b/.test(String(w?.message || ''));
6
+ const pathOf = w => w.manifestPath || /(?:open|scandir|lstat|stat|readlink|opendir) '([^']+)'/.exec(String(w.message || ''))?.[1] || null;
7
+
8
+ function foldAccessWarnings(warnings = []) {
9
+ const hits = warnings.filter(denied);
10
+ // Folding again (a later collection step adds its own warnings) extends the same notice.
11
+ const earlier = warnings.filter(w => w?.reason === 'permission-denied' && Array.isArray(w.items));
12
+ if (hits.length + earlier.length < 2) return warnings;
13
+ const known = new Set(earlier.flatMap(w => w.items.map(item => item.id)));
14
+ const fresh = [...new Set(hits.map(pathOf).filter(Boolean))].filter(p => !known.has(p));
15
+ const count = earlier.reduce((n, w) => n + (w.count || 0), 0) + fresh.length + hits.filter(w => !pathOf(w)).length;
16
+ const paths = [...known, ...fresh].sort();
17
+ return [...warnings.filter(w => !denied(w) && !earlier.includes(w)), {
18
+ type: 'dependency-coverage', capability: 'inventory', reason: 'permission-denied', count,
19
+ items: paths.slice(0, 200).map(id => ({ id })),
20
+ message: `${count} path(s) could not be read (permission denied): their content is not in the inventory. Run the collection as root for a complete inventory.`,
21
+ }];
22
+ }
23
+
24
+ module.exports = { foldAccessWarnings };