vigievuln 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +34 -19
  3. package/completions/vigievuln.bash +14 -3
  4. package/completions/vigievuln.zsh +11 -8
  5. package/data/fingerprints/index.js +80 -0
  6. package/data/fingerprints/interpreters/javascript/bun.json +23 -0
  7. package/data/fingerprints/interpreters/javascript/deno.json +10 -0
  8. package/data/fingerprints/interpreters/javascript/electron.json +20 -0
  9. package/data/fingerprints/interpreters/javascript/gjs.json +8 -0
  10. package/data/fingerprints/interpreters/javascript/javascriptcore.json +14 -0
  11. package/data/fingerprints/interpreters/javascript/jscgtk.json +10 -0
  12. package/data/fingerprints/interpreters/javascript/node.json +26 -0
  13. package/data/fingerprints/interpreters/javascript/nwjs.json +8 -0
  14. package/data/fingerprints/interpreters/javascript/webkitgtk.json +10 -0
  15. package/data/fingerprints/interpreters/javascript/wpewebkit.json +10 -0
  16. package/data/fingerprints/interpreters/languages/dotnet.json +8 -0
  17. package/data/fingerprints/interpreters/languages/erlang.json +9 -0
  18. package/data/fingerprints/interpreters/languages/gawk.json +10 -0
  19. package/data/fingerprints/interpreters/languages/guile.json +9 -0
  20. package/data/fingerprints/interpreters/languages/java.json +8 -0
  21. package/data/fingerprints/interpreters/languages/julia.json +9 -0
  22. package/data/fingerprints/interpreters/languages/lua.json +11 -0
  23. package/data/fingerprints/interpreters/languages/luajit.json +10 -0
  24. package/data/fingerprints/interpreters/languages/perl.json +11 -0
  25. package/data/fingerprints/interpreters/languages/php.json +22 -0
  26. package/data/fingerprints/interpreters/languages/powershell.json +17 -0
  27. package/data/fingerprints/interpreters/languages/pypy.json +8 -0
  28. package/data/fingerprints/interpreters/languages/python.json +24 -0
  29. package/data/fingerprints/interpreters/languages/r.json +9 -0
  30. package/data/fingerprints/interpreters/languages/racket.json +9 -0
  31. package/data/fingerprints/interpreters/languages/raku.json +8 -0
  32. package/data/fingerprints/interpreters/languages/ruby.json +21 -0
  33. package/data/fingerprints/interpreters/languages/tcl.json +9 -0
  34. package/data/fingerprints/interpreters/shells/bash.json +10 -0
  35. package/data/fingerprints/interpreters/shells/dash.json +8 -0
  36. package/data/fingerprints/interpreters/shells/fish.json +9 -0
  37. package/data/fingerprints/interpreters/shells/ksh.json +8 -0
  38. package/data/fingerprints/interpreters/shells/zsh.json +9 -0
  39. package/data/fingerprints/services/databases/clickhouse.json +8 -0
  40. package/data/fingerprints/services/databases/elasticsearch.json +8 -0
  41. package/data/fingerprints/services/databases/etcd.json +9 -0
  42. package/data/fingerprints/services/databases/mariadb.json +9 -0
  43. package/data/fingerprints/services/databases/memcached.json +9 -0
  44. package/data/fingerprints/services/databases/mongo.json +8 -0
  45. package/data/fingerprints/services/databases/mysql.json +9 -0
  46. package/data/fingerprints/services/databases/opensearch.json +8 -0
  47. package/data/fingerprints/services/databases/postgres.json +18 -0
  48. package/data/fingerprints/services/databases/redis.json +9 -0
  49. package/data/fingerprints/services/databases/valkey.json +8 -0
  50. package/data/fingerprints/services/dns-directory/bind.json +8 -0
  51. package/data/fingerprints/services/dns-directory/dnsmasq.json +8 -0
  52. package/data/fingerprints/services/dns-directory/slapd.json +8 -0
  53. package/data/fingerprints/services/dns-directory/unbound.json +8 -0
  54. package/data/fingerprints/services/mail/cyrus.json +8 -0
  55. package/data/fingerprints/services/mail/dovecot.json +8 -0
  56. package/data/fingerprints/services/mail/exim.json +9 -0
  57. package/data/fingerprints/services/mail/opendkim.json +8 -0
  58. package/data/fingerprints/services/mail/opensmtpd.json +8 -0
  59. package/data/fingerprints/services/mail/postfix.json +8 -0
  60. package/data/fingerprints/services/mail/rspamd.json +8 -0
  61. package/data/fingerprints/services/mail/sendmail.json +8 -0
  62. package/data/fingerprints/services/messaging/kafka.json +8 -0
  63. package/data/fingerprints/services/messaging/mosquitto.json +8 -0
  64. package/data/fingerprints/services/messaging/nats.json +9 -0
  65. package/data/fingerprints/services/messaging/rabbitmq.json +8 -0
  66. package/data/fingerprints/services/remote-access/dropbear.json +8 -0
  67. package/data/fingerprints/services/remote-access/openssh.json +10 -0
  68. package/data/fingerprints/services/remote-access/proftpd.json +8 -0
  69. package/data/fingerprints/services/remote-access/samba.json +8 -0
  70. package/data/fingerprints/services/remote-access/vsftpd.json +8 -0
  71. package/data/fingerprints/services/web-proxies/apache.json +18 -0
  72. package/data/fingerprints/services/web-proxies/caddy.json +9 -0
  73. package/data/fingerprints/services/web-proxies/envoy.json +8 -0
  74. package/data/fingerprints/services/web-proxies/haproxy.json +10 -0
  75. package/data/fingerprints/services/web-proxies/lighttpd.json +8 -0
  76. package/data/fingerprints/services/web-proxies/nginx.json +14 -0
  77. package/data/fingerprints/services/web-proxies/squid.json +8 -0
  78. package/data/fingerprints/services/web-proxies/tomcat.json +8 -0
  79. package/data/fingerprints/services/web-proxies/traefik.json +9 -0
  80. package/data/fingerprints/services/web-proxies/varnish.json +8 -0
  81. package/lib/README.md +51 -0
  82. package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
  83. package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
  84. package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
  85. package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
  86. package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
  87. package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
  88. package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
  89. package/lib/{native-advisories.js → advisories/native.js} +15 -13
  90. package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
  91. package/lib/{advisory-store.js → advisories/store.js} +2 -2
  92. package/lib/{application-exports.js → applications/exports.js} +1 -1
  93. package/lib/{application-inventory.js → applications/inventory.js} +3 -1
  94. package/lib/applications/layout.js +199 -0
  95. package/lib/{application-providers → applications}/live-snapshot.js +10 -10
  96. package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
  97. package/lib/applications/plugins/ghost.js +36 -0
  98. package/lib/{application-plugins → applications/plugins}/index.js +1 -1
  99. package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
  100. package/lib/applications/plugins/redmine.js +24 -0
  101. package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
  102. package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
  103. package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
  104. package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
  105. package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
  106. package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
  107. package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
  108. package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
  109. package/lib/artifacts/access-warnings.js +24 -0
  110. package/lib/artifacts/applications.js +39 -8
  111. package/lib/artifacts/component-scope.js +12 -3
  112. package/lib/artifacts/cve-view.js +8 -5
  113. package/lib/artifacts/disk-wasm.mjs +3 -0
  114. package/lib/artifacts/disk.js +188 -0
  115. package/lib/artifacts/elf-product.js +215 -0
  116. package/lib/artifacts/enrichment.js +31 -17
  117. package/lib/artifacts/go-main-identity.js +135 -36
  118. package/lib/artifacts/go-publisher-advisories.js +4 -3
  119. package/lib/artifacts/image-products.js +181 -0
  120. package/lib/artifacts/index.js +36 -13
  121. package/lib/artifacts/install-version.js +44 -0
  122. package/lib/artifacts/inventory-scope.js +53 -3
  123. package/lib/artifacts/pe-product.js +28 -0
  124. package/lib/artifacts/product-advisories.js +212 -0
  125. package/lib/artifacts/product-catalog.js +67 -0
  126. package/lib/artifacts/release-catalogues.js +149 -0
  127. package/lib/artifacts/release-versions.js +101 -0
  128. package/lib/artifacts/remediation-report.js +1 -1
  129. package/lib/artifacts/report-inventory.js +17 -2
  130. package/lib/artifacts/report-path.js +29 -0
  131. package/lib/artifacts/report.js +85 -32
  132. package/lib/artifacts/retire.js +3 -3
  133. package/lib/artifacts/risk-report.js +12 -8
  134. package/lib/artifacts/sbom.js +33 -4
  135. package/lib/artifacts/scan.js +316 -69
  136. package/lib/artifacts/system-apps.js +98 -0
  137. package/lib/artifacts/system-maintenance.js +101 -0
  138. package/lib/artifacts/system-module-updates.js +104 -0
  139. package/lib/artifacts/system-report.js +232 -0
  140. package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
  141. package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
  142. package/lib/{cache-db.js → cache/db.js} +1 -1
  143. package/lib/{dump-format.js → cache/dump-format.js} +2 -2
  144. package/lib/{json-cache.js → cache/json.js} +1 -1
  145. package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
  146. package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
  147. package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
  148. package/lib/{cache-repository.js → cache/repository.js} +1 -1
  149. package/lib/{resource-cache → cache/resource}/engine.js +23 -16
  150. package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
  151. package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
  152. package/lib/{resource-cache → cache/resource}/validate.js +20 -5
  153. package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
  154. package/lib/certs/scan.js +17 -11
  155. package/lib/cli-collect.js +262 -0
  156. package/lib/cli-command-routing.js +30 -13
  157. package/lib/cli-groups.js +1 -1
  158. package/lib/cli-image.js +158 -47
  159. package/lib/cli-project-commands.js +10 -10
  160. package/lib/cli-setup.js +8 -8
  161. package/lib/cli-watch.js +3 -3
  162. package/lib/codecs/binary/elf-metadata.js +6 -0
  163. package/lib/codecs/binary/metadata.js +1 -1
  164. package/lib/codecs/binary/pe-metadata.js +47 -11
  165. package/lib/codecs/binary/scan.js +12 -4
  166. package/lib/codecs/binary.codec.js +1 -1
  167. package/lib/codecs/composer/platform.js +2 -2
  168. package/lib/codecs/composer/registry.js +12 -18
  169. package/lib/codecs/composer.codec.js +6 -5
  170. package/lib/codecs/go/parse.js +1 -1
  171. package/lib/codecs/go/registry.js +7 -7
  172. package/lib/codecs/go.codec.js +2 -2
  173. package/lib/codecs/gradle/parse.js +1 -1
  174. package/lib/codecs/gradle/versionless.js +2 -2
  175. package/lib/codecs/gradle.codec.js +7 -7
  176. package/lib/codecs/index.js +1 -1
  177. package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
  178. package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
  179. package/lib/codecs/maven/jar-scan.js +4 -4
  180. package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
  181. package/lib/{core.js → codecs/maven/pom.js} +22 -11
  182. package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
  183. package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
  184. package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
  185. package/lib/codecs/maven.codec.js +18 -14
  186. package/lib/codecs/npm/collect.js +55 -8
  187. package/lib/codecs/npm/manifest-kind.js +16 -0
  188. package/lib/codecs/npm/parse.js +23 -7
  189. package/lib/codecs/npm/registry.js +28 -14
  190. package/lib/codecs/npm.codec.js +5 -5
  191. package/lib/codecs/nuget/registry.js +7 -7
  192. package/lib/codecs/nuget.codec.js +4 -4
  193. package/lib/codecs/pypi/registry.js +7 -7
  194. package/lib/codecs/pypi.codec.js +4 -4
  195. package/lib/codecs/recipes.js +2 -2
  196. package/lib/codecs/ruby/registry.js +7 -7
  197. package/lib/codecs/ruby.codec.js +2 -2
  198. package/lib/config.js +1 -1
  199. package/lib/{attribution.js → findings/attribution.js} +3 -3
  200. package/lib/findings/cve-descriptions.js +144 -0
  201. package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
  202. package/lib/{diff.js → findings/diff.js} +0 -0
  203. package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
  204. package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
  205. package/lib/{gate.js → findings/gate.js} +1 -1
  206. package/lib/{malware.js → findings/malware.js} +30 -7
  207. package/lib/{merge-sources.js → findings/merge.js} +57 -9
  208. package/lib/{priority.js → findings/priority.js} +3 -3
  209. package/lib/findings/risk-evidence.js +24 -0
  210. package/lib/findings/severity.js +16 -0
  211. package/lib/{finding-summary.js → findings/summary.js} +5 -2
  212. package/lib/{suppress.js → findings/suppress.js} +2 -2
  213. package/lib/images/local-docker.js +72 -0
  214. package/lib/{image-network.js → images/network.js} +26 -16
  215. package/lib/{image-references.js → images/references.js} +29 -11
  216. package/lib/{image-registry.js → images/registry.js} +18 -9
  217. package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
  218. package/lib/images/temp-roots.js +23 -0
  219. package/lib/{image-update.js → images/update.js} +3 -3
  220. package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
  221. package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
  222. package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
  223. package/lib/{embedded.js → inventory/embedded.js} +4 -3
  224. package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
  225. package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
  226. package/lib/{module-names.js → inventory/module-names.js} +1 -1
  227. package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
  228. package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
  229. package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
  230. package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
  231. package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
  232. package/lib/{purl.js → inventory/purl.js} +2 -2
  233. package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
  234. package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
  235. package/lib/{outdated.js → maintenance/outdated.js} +20 -20
  236. package/lib/options-env.js +1 -1
  237. package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
  238. package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
  239. package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
  240. package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
  241. package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
  242. package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
  243. package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
  244. package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
  245. package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
  246. package/lib/providers/{debian.js → debian/index.js} +1 -0
  247. package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
  248. package/lib/providers/{drupal.js → drupal/index.js} +4 -0
  249. package/lib/providers/{eol.js → eol/index.js} +1 -1
  250. package/lib/{epss.js → providers/epss/enrich.js} +16 -13
  251. package/lib/providers/{epss.js → epss/index.js} +2 -2
  252. package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
  253. package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
  254. package/lib/providers/{freexian.js → freexian/index.js} +3 -3
  255. package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
  256. package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
  257. package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
  258. package/lib/{gcve.js → providers/gcve/id.js} +1 -1
  259. package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
  260. package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
  261. package/lib/providers/{github.js → github/index.js} +3 -1
  262. package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
  263. package/lib/providers/{go.js → go/index.js} +1 -1
  264. package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
  265. package/lib/providers/{hashid.js → hashid/index.js} +1 -1
  266. package/lib/providers/index.js +18 -13
  267. package/lib/{kev.js → providers/kev/enrich.js} +12 -9
  268. package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
  269. package/lib/providers/{maven.js → maven/index.js} +5 -3
  270. package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
  271. package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
  272. package/lib/providers/mit-kerberos/index.js +6 -0
  273. package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
  274. package/lib/providers/{npm.js → npm/index.js} +1 -1
  275. package/lib/providers/{nuget.js → nuget/index.js} +1 -1
  276. package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
  277. package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
  278. package/lib/providers/{nvd.js → nvd/index.js} +18 -4
  279. package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
  280. package/lib/{osv-db.js → providers/osv/db.js} +18 -16
  281. package/lib/providers/{osv.js → osv/index.js} +1 -1
  282. package/lib/{osv.js → providers/osv/query.js} +150 -80
  283. package/lib/providers/package-releases/index.js +26 -0
  284. package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
  285. package/lib/providers/{packagist.js → packagist/index.js} +1 -1
  286. package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
  287. package/lib/providers/{pypi.js → pypi/index.js} +1 -1
  288. package/lib/providers/redhat/bzip2.js +167 -0
  289. package/lib/providers/redhat/errata.js +75 -0
  290. package/lib/providers/redhat/index.js +10 -0
  291. package/lib/providers/redhat/oval.js +70 -0
  292. package/lib/providers/redhat/unfixed.js +127 -0
  293. package/lib/{registries.js → providers/registries.js} +4 -4
  294. package/lib/{retire.js → providers/retire/scan.js} +18 -18
  295. package/lib/providers/{ruby.js → ruby/index.js} +1 -1
  296. package/lib/providers/rubysec/advisories.js +177 -0
  297. package/lib/providers/rubysec/index.js +9 -0
  298. package/lib/{snyk.js → providers/snyk/client.js} +2 -2
  299. package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
  300. package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
  301. package/lib/providers/wolfi/index.js +10 -0
  302. package/lib/providers/wolfi/secdb.js +47 -0
  303. package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
  304. package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
  305. package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
  306. package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
  307. package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
  308. package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
  309. package/lib/providers/wpvulnerability/assess.js +181 -0
  310. package/lib/providers/wpvulnerability/index.js +12 -0
  311. package/lib/{charts.js → reports/charts.js} +25 -18
  312. package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
  313. package/lib/{cve-report.js → reports/cve-report.js} +453 -228
  314. package/lib/reports/detail.js +55 -0
  315. package/lib/{i18n.js → reports/i18n.js} +38 -2
  316. package/lib/{report-integrity.js → reports/integrity.js} +1 -1
  317. package/lib/{json-export.js → reports/json-export.js} +95 -24
  318. package/lib/{report-notices.js → reports/notices.js} +11 -6
  319. package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
  320. package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
  321. package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
  322. package/lib/scan/coverage.js +114 -0
  323. package/lib/{provenance.js → scan/provenance.js} +12 -5
  324. package/lib/scan/reliability.js +157 -0
  325. package/lib/{source-health.js → scan/source-health.js} +52 -20
  326. package/lib/{source-profile.js → scan/source-profile.js} +3 -3
  327. package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
  328. package/lib/{project-client.js → service/project-client.js} +20 -2
  329. package/lib/source-input.js +58 -0
  330. package/lib/system-inventory/advisories.js +89 -16
  331. package/lib/system-inventory/collect.js +33 -10
  332. package/lib/system-inventory/distribution-sources.js +32 -15
  333. package/lib/system-inventory/package-applicability.js +51 -0
  334. package/lib/system-inventory/targeted.js +8 -5
  335. package/lib/ui.js +11 -0
  336. package/package.json +49 -2
  337. package/vigievuln.js +483 -352
  338. package/lib/cache-archive.js +0 -676
  339. package/lib/osv-legacy.js +0 -57
  340. package/lib/risk-evidence.js +0 -18
  341. package/lib/scan-coverage.js +0 -61
  342. /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
  343. /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
  344. /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
  345. /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
  346. /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
  347. /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
  348. /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
  349. /package/lib/{cache-directory.js → cache/directory.js} +0 -0
  350. /package/lib/{cache-policy.js → cache/policy.js} +0 -0
  351. /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
  352. /package/lib/{cache-startup.js → cache/startup.js} +0 -0
  353. /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
  354. /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
  355. /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
  356. /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
  357. /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
  358. /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
  359. /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
  360. /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
  361. /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
  362. /package/lib/providers/{kev.js → kev/index.js} +0 -0
  363. /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
  364. /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
  365. /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
  366. /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
  367. /package/lib/providers/{retire.js → retire/index.js} +0 -0
  368. /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
  369. /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
  370. /package/lib/{report-time.js → reports/time.js} +0 -0
  371. /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
  372. /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
  373. /package/lib/{account-client.js → service/account-client.js} +0 -0
  374. /package/lib/{account-session.js → service/account-session.js} +0 -0
  375. /package/lib/{account-terms.js → service/account-terms.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/retire.js — wrap retire.js (the CLI) to find vulnerable
2
+ * lib/providers/retire/scan.js — wrap retire.js (the CLI) to find vulnerable
3
3
  * vendored JavaScript libraries living in the source tree as
4
4
  * unmanaged .js / .min.js files (no package-lock to back them).
5
5
  *
@@ -25,7 +25,7 @@ const { execFile } = require("child_process");
25
25
  const { promisify } = require("util");
26
26
  const execFileP = promisify(execFile);
27
27
 
28
- const RETIRE_CACHE_DIR = path.join(require("./cache-directory").getCacheDir(), "retire-cache");
28
+ const RETIRE_CACHE_DIR = path.join(require("../../cache/directory").getCacheDir(), "retire-cache");
29
29
  const RETIRE_CACHE_TTL_MS = 4 * 3600 * 1000;
30
30
 
31
31
  // retire's own signature DB. By default retire caches it in /tmp/.retire-cache
@@ -33,7 +33,7 @@ const RETIRE_CACHE_TTL_MS = 4 * 3600 * 1000;
33
33
  // air-gapped offline workflow we instead keep a stable local copy INSIDE ~/.fad-checker/
34
34
  // so `--export-cache` carries it, and feed it to retire via `--jsrepo <file>`
35
35
  // (loaded from file, never the network — no TTL).
36
- const RETIRE_SIG_DIR = path.join(require("./cache-directory").getCacheDir(), "retire-signatures");
36
+ const RETIRE_SIG_DIR = path.join(require("../../cache/directory").getCacheDir(), "retire-signatures");
37
37
  const RETIRE_SIG_FILE = path.join(RETIRE_SIG_DIR, "jsrepository-v5.json");
38
38
  const RETIRE_REPO_URL = "https://raw.githubusercontent.com/RetireJS/retire.js/master/repository/jsrepository-v5.json";
39
39
 
@@ -65,26 +65,26 @@ const RETIRE_CACHE_SCHEMA = 2;
65
65
 
66
66
  function readCache(srcDir) {
67
67
  try {
68
- const data = require('./cache-repository').createCacheRepository(path.dirname(RETIRE_CACHE_DIR)).get('retire-results',cacheKey(srcDir))?.value;
68
+ const data = require('../../cache/repository').createCacheRepository(path.dirname(RETIRE_CACHE_DIR)).get('retire-results',cacheKey(srcDir))?.value;
69
69
  if (!(data._schema >= RETIRE_CACHE_SCHEMA)) return null; // legacy / pre-verbose → re-scan
70
- if (require('./cache-policy').fresh(data._fetchedAt, RETIRE_CACHE_TTL_MS)) return data.body;
70
+ if (require('../../cache/policy').fresh(data._fetchedAt, RETIRE_CACHE_TTL_MS)) return data.body;
71
71
  } catch { /* ignore */ }
72
72
  return null;
73
73
  }
74
74
 
75
75
  function writeCache(srcDir, body) {
76
- require('./cache-repository').createCacheRepository(path.dirname(RETIRE_CACHE_DIR)).put('retire-results',cacheKey(srcDir),
76
+ require('../../cache/repository').createCacheRepository(path.dirname(RETIRE_CACHE_DIR)).put('retire-results',cacheKey(srcDir),
77
77
  { _schema: RETIRE_CACHE_SCHEMA, _fetchedAt: Date.now(), body });
78
78
  }
79
79
 
80
80
  function cachedSignatureEntry(cacheDir){
81
- try{return require('./cache-repository').createCacheRepository(cacheDir || path.dirname(RETIRE_SIG_DIR)).get('auxiliary','retire-signatures')||null}
81
+ try{return require('../../cache/repository').createCacheRepository(cacheDir || path.dirname(RETIRE_SIG_DIR)).get('auxiliary','retire-signatures')||null}
82
82
  catch{return null}
83
83
  }
84
84
  function cachedSignatures(cacheDir){return cachedSignatureEntry(cacheDir)?.value || null}
85
85
 
86
86
  function findRetireBin() {
87
- const local = path.join(__dirname, "..", "node_modules", ".bin", "retire");
87
+ const local = path.join(__dirname, "..", "..", "..", "node_modules", ".bin", "retire");
88
88
  if (fs.existsSync(local)) return local;
89
89
  return "retire"; // fall back to PATH
90
90
  }
@@ -116,10 +116,10 @@ function findRetireLauncher() {
116
116
  // npm installs a .cmd shim on Windows; execFile cannot run it without a shell.
117
117
  // Invoke the package's JS entry with the current Node executable instead.
118
118
  if (process.platform === 'win32' && !(process.versions && process.versions.bun)) {
119
- const script = path.join(__dirname, '..', 'node_modules', 'retire', 'lib', 'cli.js');
119
+ const script = path.join(__dirname, '..', '..', '..', 'node_modules', 'retire', 'lib', 'cli.js');
120
120
  if (fs.existsSync(script)) return {cmd:process.execPath, env:null, args:[script]};
121
121
  }
122
- const local = path.join(__dirname, "..", "node_modules", ".bin", "retire");
122
+ const local = path.join(__dirname, "..", "..", "..", "node_modules", ".bin", "retire");
123
123
  return chooseRetireLauncher({
124
124
  localBin: fs.existsSync(local) ? local : null,
125
125
  isBun: !!(process.versions && process.versions.bun),
@@ -137,19 +137,19 @@ async function warmRetireSignatures(opts = {}) {
137
137
  const present = !!cachedSignatures(opts.cacheDir);
138
138
  if (offline) return present ? { ok: true, cached: true }
139
139
  : { ok: false, error: "offline: no local retire signatures" };
140
- const hostedOnline = require("./providers").hasHostedProxy();
141
- if (!force && !hostedOnline && present && require('./cache-policy').fresh(cachedSignatureEntry(opts.cacheDir)?.fetchedAt)) {
140
+ const hostedOnline = require("..").hasHostedProxy();
141
+ if (!force && !hostedOnline && present && require('../../cache/policy').fresh(cachedSignatureEntry(opts.cacheDir)?.fetchedAt)) {
142
142
  if (verbose) console.log(`retire: signatures already present (${RETIRE_SIG_FILE})`);
143
143
  return { ok: true, cached: true };
144
144
  }
145
145
  try {
146
- const res = await require("./providers").getResource("retire", "signatures", {},
146
+ const res = await require("..").getResource("retire", "signatures", {},
147
147
  { ...(opts.fetcher ? { fetcher: opts.fetcher } : {}), signal: AbortSignal.timeout(60000) });
148
148
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
149
149
  const text = await res.text();
150
150
  const repo = JSON.parse(text);
151
151
  if (!repo || typeof repo !== "object" || Array.isArray(repo)) throw new Error("invalid retire signatures");
152
- require('./cache-repository').createCacheRepository(opts.cacheDir || path.dirname(RETIRE_SIG_DIR)).put('auxiliary','retire-signatures',text);
152
+ require('../../cache/repository').createCacheRepository(opts.cacheDir || path.dirname(RETIRE_SIG_DIR)).put('auxiliary','retire-signatures',text);
153
153
  if (verbose) console.log('retire: signatures warmed into SQLite cache');
154
154
  return { ok: true };
155
155
  } catch (e) {
@@ -164,11 +164,11 @@ async function ensureSignatures(opts = {}) {
164
164
  const { offline } = opts;
165
165
  if (offline) return !!cachedSignatures(opts.cacheDir);
166
166
  const r = await warmRetireSignatures(opts);
167
- return !!r.ok || (!require('./providers').hasHostedProxy() && !!cachedSignatures(opts.cacheDir));
167
+ return !!r.ok || (!require('..').hasHostedProxy() && !!cachedSignatures(opts.cacheDir));
168
168
  }
169
169
 
170
170
  // Directories retire never needs to walk. Mirrors the per-walker default SKIP sets
171
- // the codecs use (lib/path-filter.js / npm parse.js): package stores, build output,
171
+ // the codecs use (lib/inventory/path-filter.js / npm parse.js): package stores, build output,
172
172
  // IDE/VCS metadata. Matched by BASENAME at any depth (see buildRetireIgnorePatterns).
173
173
  const DEFAULT_RETIRE_SKIP_DIRS = [
174
174
  "node_modules", "bower_components", "jspm_packages",
@@ -178,7 +178,7 @@ const DEFAULT_RETIRE_SKIP_DIRS = [
178
178
 
179
179
  /**
180
180
  * Build the lines for a retire ignorefile, mirroring the rest of the scan's
181
- * exclude policy (lib/path-filter.js#makeDirFilter) so retire skips the SAME dirs
181
+ * exclude policy (lib/inventory/path-filter.js#makeDirFilter) so retire skips the SAME dirs
182
182
  * every codec walker prunes.
183
183
  *
184
184
  * Why an ignorefile and not `--ignore`: retire `path.resolve()`s every `--ignore`
@@ -326,7 +326,7 @@ async function runRetire(srcDir, opts = {}) {
326
326
  if (!srcDir) { if (verbose) console.warn("retire: no source dir — skipped"); return null; }
327
327
  try { if (!fs.statSync(srcDir).isDirectory()) throw new Error('not a directory'); }
328
328
  catch { diag.error = 'retire.js scan failed: source directory is unavailable'; return null; }
329
- const hostedOnline = !offline && require("./providers").hasHostedProxy();
329
+ const hostedOnline = !offline && require("..").hasHostedProxy();
330
330
  // A result's scan time cannot prove that the signatures it used are still current.
331
331
  if (!force && !hostedOnline) {
332
332
  const cached = readCache(srcDir);
@@ -1,4 +1,4 @@
1
- const { requestKey } = require("./common");
1
+ const { requestKey } = require("../common");
2
2
  module.exports = {
3
3
  id: "ruby", ttlMs: 24 * 3600 * 1000,
4
4
  key(type, params, scope) { return requestKey("ruby", type, { name: String(params?.name || "").toLowerCase() }, scope); },
@@ -0,0 +1,177 @@
1
+ 'use strict';
2
+ /**
3
+ * The Ruby advisory lane. rubysec/ruby-advisory-db records advisories that GitHub's
4
+ * reviewed database, and therefore OSV, does not carry for RubyGems: project security
5
+ * advisories that were never reviewed, and older OSVDB entries. Measured on Mastodon
6
+ * v4.0.2: 27 advisories (net-ssh, puma, doorkeeper…) found by `bundler-audit` and not by
7
+ * the OSV lane.
8
+ *
9
+ * An advisory names the versions that are NOT vulnerable (`patched_versions`,
10
+ * `unaffected_versions`), as RubyGems requirements: a version is vulnerable when it
11
+ * satisfies none of them. That is the rule `bundler-audit` applies.
12
+ */
13
+ const zlib = require('node:zlib');
14
+ const { compareRubyVersions } = require('../../codecs/ruby/version');
15
+ const { severityFromScore } = require('../../findings/severity');
16
+
17
+ const NAMESPACE = 'rubysec', DB_KEY = 'advisory-db', FORMAT = 1;
18
+ const TTL_MS = 4 * 3600 * 1000;
19
+ const MAX_ARCHIVE_BYTES = 64 * 1024 * 1024, MAX_ENTRY_BYTES = 512 * 1024, MAX_ADVISORIES = 100000;
20
+ const GEM = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
21
+
22
+ // ── RubyGems requirements ──────────────────────────────────────────────────────────
23
+ const CLAUSE = /^(=|!=|>=|<=|~>|>|<)?\s*([0-9][0-9A-Za-z.-]*)$/;
24
+ function parseRequirement(text) {
25
+ const clauses = String(text ?? '').split(',').map(part => CLAUSE.exec(part.trim()));
26
+ return clauses.length && clauses.every(Boolean) ? clauses.map(m => ({ op: m[1] || '=', version: m[2] })) : null;
27
+ }
28
+ // Gem::Version#bump: "2.3.18" → "2.4", "5.2" → "6"; a prerelease tail is dropped first.
29
+ function bump(version) {
30
+ const release = [];
31
+ for (const segment of version.replace(/-/g, '.pre.').split('.')) { if (!/^\d+$/.test(segment)) break; release.push(BigInt(segment)); }
32
+ if (!release.length) return null;
33
+ if (release.length > 1) release.pop();
34
+ release[release.length - 1] += 1n;
35
+ return release.join('.');
36
+ }
37
+ /** true / false, or null when the version or the requirement cannot be ordered. */
38
+ function satisfies(version, requirement) {
39
+ const clauses = parseRequirement(requirement);
40
+ if (!clauses) return null;
41
+ for (const { op, version: bound } of clauses) {
42
+ const c = compareRubyVersions(version, bound);
43
+ if (c === null) return null;
44
+ let ok;
45
+ if (op === '~>') { const upper = bump(bound), below = upper && compareRubyVersions(version, upper); if (below == null) return null; ok = c >= 0 && below < 0; }
46
+ else ok = op === '=' ? c === 0 : op === '!=' ? c !== 0 : op === '>' ? c > 0 : op === '<' ? c < 0 : op === '>=' ? c >= 0 : c <= 0;
47
+ if (!ok) return false;
48
+ }
49
+ return true;
50
+ }
51
+ /** Vulnerable (true), not vulnerable (false) or undecidable (null) for one advisory. */
52
+ function vulnerable(advisory, version) {
53
+ let unknown = false;
54
+ for (const requirement of [...(advisory.patched || []), ...(advisory.unaffected || [])]) {
55
+ const verdict = satisfies(version, requirement);
56
+ if (verdict === true) return false;
57
+ if (verdict === null) unknown = true;
58
+ }
59
+ return unknown ? null : true;
60
+ }
61
+ // The lowest patched release above the installed version.
62
+ function fixVersion(advisory, version) {
63
+ let best = null;
64
+ for (const requirement of advisory.patched || []) for (const { op, version: bound } of parseRequirement(requirement) || []) {
65
+ if (!['>=', '~>', '='].includes(op) || !(compareRubyVersions(bound, version) > 0) || vulnerable(advisory, bound) !== false) continue;
66
+ if (best === null || compareRubyVersions(bound, best) < 0) best = bound;
67
+ }
68
+ return best;
69
+ }
70
+
71
+ // ── Archive → advisories by gem ────────────────────────────────────────────────────
72
+ const text = (value, max) => typeof value === 'string' && value.trim() ? value.trim().slice(0, max) : null;
73
+ const list = value => (Array.isArray(value) ? value : value == null ? [] : [value]).filter(item => typeof item === 'string' || typeof item === 'number').map(String);
74
+ function normalise(doc, file) {
75
+ if (!doc || typeof doc !== 'object' || Array.isArray(doc) || typeof doc.gem !== 'string' || !GEM.test(doc.gem)) return null;
76
+ const cve = /^\d{4}-\d{4,}$/.test(String(doc.cve ?? '')) ? `CVE-${doc.cve}` : null;
77
+ const ghsa = /^[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/i.test(String(doc.ghsa ?? '')) ? `GHSA-${String(doc.ghsa).toLowerCase()}` : null;
78
+ const osvdb = /^\d+$/.test(String(doc.osvdb ?? '')) ? `OSVDB-${doc.osvdb}` : null;
79
+ const ids = [cve, ghsa, osvdb].filter(Boolean);
80
+ if (!ids.length) return null;
81
+ const score = [doc.cvss_v4, doc.cvss_v3, doc.cvss_v2].map(Number).find(n => Number.isFinite(n) && n >= 0 && n <= 10);
82
+ const date = doc.date instanceof Date ? doc.date.toISOString().slice(0, 10) : /^\d{4}-\d{2}-\d{2}/.test(String(doc.date ?? '')) ? String(doc.date).slice(0, 10) : null;
83
+ const related = doc.related && typeof doc.related === 'object' ? doc.related : {};
84
+ return { gem: doc.gem.toLowerCase(), id: ids[0], aliases: ids.slice(1), file,
85
+ title: text(doc.title, 500), description: text(doc.description, 20000), url: /^https?:\/\//i.test(String(doc.url ?? '')) ? String(doc.url).slice(0, 2000) : null,
86
+ date, score: score ?? null, patched: list(doc.patched_versions), unaffected: list(doc.unaffected_versions),
87
+ related: list(related.url).filter(u => /^https?:\/\//i.test(u)).slice(0, 20) };
88
+ }
89
+ /** Parse the repository archive (gzip tar). → { gems: { name: [advisory] }, count } */
90
+ async function parseArchive(bytes) {
91
+ if (!bytes || bytes.length > MAX_ARCHIVE_BYTES) throw Error('Ruby advisory database archive is missing or exceeds its size limit');
92
+ const yaml = require('js-yaml'), extract = require('tar-stream').extract();
93
+ const gems = Object.create(null); let count = 0, rejected = 0;
94
+ const done = new Promise((resolve, reject) => {
95
+ extract.on('entry', (header, stream, next) => {
96
+ const match = header.type === 'file' && /^[^/]+\/gems\/([^/]+)\/([^/]+\.yml)$/.exec(header.name);
97
+ const chunks = []; let size = 0;
98
+ stream.on('data', chunk => { size += chunk.length; if (match && size <= MAX_ENTRY_BYTES) chunks.push(chunk); });
99
+ stream.on('end', () => {
100
+ if (match && size <= MAX_ENTRY_BYTES) {
101
+ let advisory = null;
102
+ try { advisory = normalise(yaml.load(Buffer.concat(chunks).toString('utf8')), `gems/${match[1]}/${match[2]}`); } catch { /* counted below */ }
103
+ // A file is filed under its gem's directory: anything else is not an advisory for it.
104
+ if (advisory && advisory.gem === match[1].toLowerCase() && count < MAX_ADVISORIES) { (gems[advisory.gem] ||= []).push(advisory); count++; }
105
+ else rejected++;
106
+ }
107
+ next();
108
+ });
109
+ stream.on('error', reject);
110
+ });
111
+ extract.on('finish', resolve); extract.on('error', reject);
112
+ });
113
+ extract.end(zlib.gunzipSync(bytes, { maxOutputLength: 8 * MAX_ARCHIVE_BYTES }));
114
+ await done;
115
+ if (!count) throw Error('Ruby advisory database archive holds no advisory');
116
+ return { gems, count, rejected };
117
+ }
118
+
119
+ // ── Lane ───────────────────────────────────────────────────────────────────────────
120
+ function toMatch(dep, advisory) {
121
+ const refs = [advisory.url, ...advisory.related].filter(Boolean).map(url => ({ type: 'ADVISORY', url }));
122
+ return { dep, source: 'rubysec', confidence: 'exact', cve: {
123
+ id: advisory.id, sourceAdvisoryId: advisory.file, aliases: advisory.aliases,
124
+ ghsa: [advisory.id, ...advisory.aliases].find(id => id.startsWith('GHSA-')) || null,
125
+ severity: severityFromScore(advisory.score, 'UNKNOWN'), score: advisory.score,
126
+ summary: advisory.title || '', description: advisory.description || advisory.title || '',
127
+ fixVersion: fixVersion(advisory, dep.version), published: advisory.date, osvRefs: refs } };
128
+ }
129
+ /** Pure: evaluate the database against the resolved Ruby dependencies. */
130
+ function collectRubyMatches(resolvedDeps, gems, onConsulted) {
131
+ const matches = [];
132
+ for (const dep of resolvedDeps ? resolvedDeps.values() : []) {
133
+ if (dep.ecosystem !== 'ruby' || !dep.name) continue;
134
+ const advisories = gems[String(dep.name).toLowerCase()] || [];
135
+ for (const version of dep.versions?.length ? dep.versions : [dep.version]) {
136
+ if (compareRubyVersions(version, version) !== 0) continue;
137
+ let decided = true;
138
+ for (const advisory of advisories) {
139
+ const verdict = vulnerable(advisory, version);
140
+ if (verdict === null) decided = false;
141
+ else if (verdict) matches.push(toMatch({ ...dep, version }, advisory));
142
+ }
143
+ // The database is complete: a gem it does not list has no advisory in it.
144
+ if (decided) onConsulted?.(dep, 'rubysec', version);
145
+ }
146
+ }
147
+ return matches;
148
+ }
149
+ /**
150
+ * Match the resolved Ruby dependencies against the Ruby advisory database.
151
+ * Online the archive is refreshed when older than 4 hours; `offline` reads the cache only.
152
+ * → matches (source "rubysec"). Throws when no database is available.
153
+ */
154
+ async function queryRubyAdvisories(resolvedDeps, opts = {}) {
155
+ const { offline, fetcher, cacheDir, onConsulted, onWarning, forceUpdate } = opts;
156
+ if (![...(resolvedDeps ? resolvedDeps.values() : [])].some(dep => dep.ecosystem === 'ruby')) return [];
157
+ const repository = require('../../cache/repository').createCacheRepository(cacheDir || require('../../cache/directory').getCacheDir());
158
+ let saved = repository.get(NAMESPACE, DB_KEY)?.value;
159
+ if (saved?.format !== FORMAT) saved = null;
160
+ const fresh = saved && Date.now() - saved.fetchedAt < TTL_MS && saved.fetchedAt <= Date.now();
161
+ if (!offline && (!fresh || forceUpdate)) {
162
+ try {
163
+ const response = await require('..').getResource('rubysec', 'advisory-db', {}, { fetcher, noStore: true, streaming: true, headers: { 'User-Agent': 'vigievuln-rubysec' } });
164
+ if (!response.ok) throw Error(`Ruby advisory database HTTP ${response.status}`);
165
+ const parsed = await parseArchive(Buffer.from(await response.arrayBuffer()));
166
+ saved = { format: FORMAT, fetchedAt: Date.now(), count: parsed.count, gems: parsed.gems };
167
+ repository.put(NAMESPACE, DB_KEY, saved, { fetchedAt: saved.fetchedAt });
168
+ } catch (error) {
169
+ if (!saved) throw error;
170
+ onWarning?.({ type: 'source-stale', source: 'rubysec', message: `Ruby advisory database refresh failed (${error.message}); the copy of ${new Date(saved.fetchedAt).toISOString().slice(0, 10)} was used.` });
171
+ }
172
+ }
173
+ if (!saved) throw Error(offline ? 'no cached Ruby advisory database' : 'Ruby advisory database unavailable');
174
+ return collectRubyMatches(resolvedDeps, saved.gems, onConsulted);
175
+ }
176
+
177
+ module.exports = { queryRubyAdvisories, collectRubyMatches, parseArchive, satisfies, vulnerable, fixVersion, bump, NAMESPACE };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+ // The Ruby advisory database (rubysec/ruby-advisory-db): the data `bundler-audit` reads.
3
+ // One archive holds every advisory; no package name or version leaves the machine.
4
+ const ARCHIVE = 'https://codeload.github.com/rubysec/ruby-advisory-db/tar.gz/refs/heads/master';
5
+
6
+ module.exports = { id: 'rubysec', ttlMs: 4 * 3600 * 1000, build(type) {
7
+ if (type !== 'advisory-db') throw Error('invalid Ruby advisory database request');
8
+ return { url: ARCHIVE, init: { headers: { accept: 'application/gzip' } } };
9
+ } };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/snyk.js — optional Snyk integration.
2
+ * lib/providers/snyk/client.js — optional Snyk integration.
3
3
  *
4
4
  * Runs `snyk test --all-projects --json` on the cleaned POM directory and
5
5
  * normalises the output to vigievuln's CVE match shape so the report can
@@ -99,7 +99,7 @@ function parseSnykStdout(stdout) {
99
99
  * [{ dep: {groupId, artifactId, version}, cve: {id, severity, score, ...}, source: 'snyk' }]
100
100
  */
101
101
  function parseSnykResults(snykProjectsJson) {
102
- const { makeDepRecord } = require('./dep-record');
102
+ const { makeDepRecord } = require('../../inventory/dep-record');
103
103
  const out = [];
104
104
  const projects = Array.isArray(snykProjectsJson) ? snykProjectsJson : [snykProjectsJson];
105
105
  for (const proj of projects) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/application-providers/spip-advisories.js — the SPIP core advisory lane.
2
+ * lib/providers/spip/advisories.js — the SPIP core advisory lane.
3
3
  *
4
4
  * SPIP is the one CMS in the set with NO publisher API and NO package ecosystem:
5
5
  * not on Packagist (`spip/spip` 404s — SPIP ships from files.spip.net), not on GitHub
@@ -21,15 +21,7 @@ const SPIP_ADVISORIES_URL = "https://services.nvd.nist.gov/rest/json/cves/2.0?vi
21
21
  const SPIP_CPE_PREFIX = "cpe:2.3:a:spip:spip";
22
22
 
23
23
  /** NVD severity band from a CVSS base score — the same thresholds NVD itself uses. */
24
- function severityFromScore(score) {
25
- if (score == null) return "UNKNOWN";
26
- const s = Number(score);
27
- if (!Number.isFinite(s)) return "UNKNOWN";
28
- if (s >= 9) return "CRITICAL";
29
- if (s >= 7) return "HIGH";
30
- if (s >= 4) return "MEDIUM";
31
- return "LOW";
32
- }
24
+ const severityFromScore = score => require("../../findings/severity").severityFromScore(score, "UNKNOWN");
33
25
 
34
26
  /** Worst CVSS base score across the metric versions NVD records for a CVE. */
35
27
  function worstScore(metrics) {
@@ -54,12 +46,12 @@ async function fetchSpipAdvisories({ fetchImpl = globalThis.fetch, apiUrl = SPIP
54
46
  const meta = { collectedAt, completeness: "tool-fetched", sourceUrl: apiUrl };
55
47
  const headers = { "User-Agent": "vigievuln-nvd-spip" };
56
48
  if (apiKey) headers["apiKey"] = String(apiKey).trim();
57
- const response = await require("../providers").getResource("nvd", "spip-advisories", {}, {
49
+ const response = await require("..").getResource("nvd", "spip-advisories", {}, {
58
50
  fetcher: fetchImpl, headers, signal: AbortSignal.timeout(60000),
59
51
  ...(apiUrl === SPIP_ADVISORIES_URL ? {} : { urlOverride: apiUrl, direct: true }),
60
52
  });
61
53
  if (!response || !response.ok) throw new Error(`NVD SPIP advisories request failed with HTTP ${response?.status ?? "unknown"}`);
62
- meta.collectedAt = new Date(require("../providers/common").responseFetchedAt(response, now)).toISOString();
54
+ meta.collectedAt = new Date(require("../common").responseFetchedAt(response, now)).toISOString();
63
55
  const text = await response.text();
64
56
  let body;
65
57
  try { body = JSON.parse(text); }
@@ -107,7 +99,7 @@ function spipCpeMatches(cve) {
107
99
  * anywhere, so its row stays honestly not-run instead of inheriting the core's verdict.
108
100
  */
109
101
  function assessSpipAdvisories(snapshot, components = []) {
110
- const { matchVersionRange } = require("../cpe");
102
+ const { matchVersionRange } = require("../nvd/cpe");
111
103
  const validated = validateSnapshot(snapshot);
112
104
  const core = (components || []).find(c => c.kind === "core");
113
105
  const matches = [], coverage = [], diagnostics = [];
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
  // Targeted consultations of our published advisories. A query is a snapshot of
3
3
  // one package, including an empty result; it can supersede older cached entries.
4
- const {packageName,queryCoversRecord}=require('./advisory-store');
4
+ const {packageName,queryCoversRecord}=require('../../advisories/store');
5
5
  const tuple=p=>({source:'vigievuln',ecosystem:p.ecosystem,name:p.name,version:'*'});
6
6
  const key=p=>JSON.stringify([p.ecosystem,p.ecosystem==='Maven'?p.name:packageName(p.ecosystem,p.name)]);
7
7
  function packagesFor(resolved){
8
- const {osvEcosystemFor,osvPkgName}=require('./osv'),out=new Map();
8
+ const {osvEcosystemFor,osvPkgName}=require('../osv/query'),out=new Map();
9
9
  for(const dep of resolved.values()){
10
10
  if(!dep || dep.scope==='parent'||dep.provenance==='binary'||!['maven','npm','yarn'].includes(dep.ecosystem))continue;
11
11
  const ecosystem=osvEcosystemFor(dep),name=osvPkgName(dep);if(!name)continue;
@@ -13,8 +13,8 @@ function packagesFor(resolved){
13
13
  }
14
14
  return [...out.values()].sort((a,b)=>key(a).localeCompare(key(b)));
15
15
  }
16
- async function refreshReviewed(resolved,store,{ttlMs=4 * 3600000,getResource=require('./providers').getResource}={}){
17
- const packages=packagesFor(resolved),needed=packages.filter(p=>require('./cache-policy').shouldForceUpdate() || !store.getQuery(tuple(p),{ttlMs})?.fresh);let received=0;
16
+ async function refreshReviewed(resolved,store,{ttlMs=4 * 3600000,getResource=require('..').getResource}={}){
17
+ const packages=packagesFor(resolved),needed=packages.filter(p=>require('../../cache/policy').shouldForceUpdate() || !store.getQuery(tuple(p),{ttlMs})?.fresh);let received=0;
18
18
  for(let i=0;i<needed.length;i+=200){
19
19
  const batch=needed.slice(i,i+200),response=await getResource('vigievuln','advisories',{packages:batch},{forceRefresh:true});
20
20
  if(!response.ok)throw Error(`reviewed advisory proxy HTTP ${response.status}`);
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+ // Wolfi and Chainguard OS publish one security database per package repository, in the
3
+ // Alpine "secdb" format: for each package, the version that fixed each vulnerability.
4
+ const REPOSITORIES = { wolfi: 'https://packages.wolfi.dev/os/security.json', chainguard: 'https://packages.cgr.dev/chainguard/security.json' };
5
+
6
+ module.exports = { id: 'wolfi', ttlMs: 4 * 3600 * 1000, REPOSITORIES, build(type, params) {
7
+ const url = type === 'secdb' && Object.hasOwn(REPOSITORIES, String(params?.repository)) ? REPOSITORIES[params.repository] : null;
8
+ if (!url) throw Error('invalid Wolfi security database request');
9
+ return { url, init: { headers: { accept: 'application/json' } } };
10
+ } };
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+ // Turns a Wolfi or Chainguard security database into advisory records the distribution lane
3
+ // already knows how to store and assess: one record per (package, vulnerability, fixed version).
4
+ const NAME = /^[a-z0-9][a-z0-9+_.-]{0,199}$/i, VERSION = /^[0-9][A-Za-z0-9._+~-]{0,199}$/, ID = /^(?:CVE-\d{4}-\d{4,}|GHSA-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}|GO-\d{4}-\d+)$/i;
5
+ const MAX_PACKAGES = 100000, MAX_BYTES = 256 * 1024 * 1024;
6
+
7
+ /**
8
+ * A fix lists the identifiers of one vulnerability side by side (its CVE, its GitHub and Go
9
+ * ids) without saying which belong together. The CVE ids are reported; the other identifiers
10
+ * only when the fix names no CVE at all, so that one vulnerability is not reported three times.
11
+ */
12
+ function identifiers(list) {
13
+ const ids = [...new Set((Array.isArray(list) ? list : []).filter(id => typeof id === 'string' && ID.test(id)).map(id => id.toUpperCase().startsWith('GHSA-') ? 'GHSA-' + id.slice(5).toLowerCase() : id.toUpperCase()))];
14
+ const cves = ids.filter(id => id.startsWith('CVE-'));
15
+ return cves.length ? cves : ids;
16
+ }
17
+ function recordsFromSecdb(document, ecosystem) {
18
+ if (!document || typeof document !== 'object' || !Array.isArray(document.packages) || document.packages.length > MAX_PACKAGES) throw Error('invalid security database');
19
+ const records = [];
20
+ for (const entry of document.packages) {
21
+ const name = entry?.pkg?.name, fixes = entry?.pkg?.secfixes;
22
+ if (typeof name !== 'string' || !NAME.test(name) || !fixes || typeof fixes !== 'object') continue;
23
+ for (const [version, list] of Object.entries(fixes)) {
24
+ // "0" records that the package was never affected: nothing to report.
25
+ if (version === '0' || !VERSION.test(version)) continue;
26
+ // A finding is shown under the vulnerability's own identifier.
27
+ for (const id of identifiers(list)) records.push({ id, aliases: [id],
28
+ affected: [{ package: { ecosystem, name }, ranges: [{ type: 'ECOSYSTEM', events: [{ introduced: '0' }, { fixed: version }] }] }] });
29
+ }
30
+ }
31
+ if (!records.length) throw Error('security database holds no fix');
32
+ return records;
33
+ }
34
+ /** Download the repositories of a scope and return their records. */
35
+ async function fetchRecords(scope, opts = {}) {
36
+ const records = [];
37
+ for (const repository of scope.secdb) {
38
+ const response = await require('..').getResource('wolfi', 'secdb', { repository }, { fetcher: opts.fetcher, streaming: true, noStore: true, signal: opts.signal });
39
+ if (!response.ok) throw Error(`${repository} security database HTTP ${response.status}`);
40
+ const bytes = Buffer.from(await response.arrayBuffer());
41
+ if (!bytes.length || bytes.length > MAX_BYTES) throw Error(`${repository} security database is empty or exceeds its size limit`);
42
+ for (const record of recordsFromSecdb(JSON.parse(bytes.toString('utf8')), scope.ecosystem)) records.push(record);
43
+ }
44
+ return records;
45
+ }
46
+
47
+ module.exports = { recordsFromSecdb, fetchRecords, identifiers };
@@ -1,6 +1,6 @@
1
1
  const crypto = require("node:crypto");
2
2
  const path = require("node:path");
3
- const { FORMAT, MAX_RESPONSE_BYTES, componentQueries, queriesOf, keyOf, indexProjection, projectFeed, mergeProjections } = require("./wordfence-projection");
3
+ const { FORMAT, MAX_RESPONSE_BYTES, componentQueries, queriesOf, keyOf, indexProjection, projectFeed, mergeProjections } = require("./projection");
4
4
  const CACHE_FILE = "wordfence-v3-targeted.json";
5
5
 
6
6
  async function readProjection(response) {
@@ -21,7 +21,7 @@ async function readProjection(response) {
21
21
  }
22
22
 
23
23
  async function fetchWordfenceProjection(components, { fetchImpl = globalThis.fetch, apiKey, now = Date.now(), software } = {}) {
24
- const { hasProxyRoute, getResource } = require("../providers");
24
+ const { hasProxyRoute, getResource } = require("..");
25
25
  if (!hasProxyRoute()) throw new Error("Wordfence projection requires a proxy");
26
26
  const queries = software ? queriesOf(software) : componentQueries(components);
27
27
  let snapshot = null;
@@ -56,14 +56,14 @@ function cacheProjection(dir, snapshot) {
56
56
  const file = path.join(dir, CACHE_FILE);
57
57
  let previous = null;
58
58
  try {
59
- const cached=require('./snapshot-cache').read(file,{preferCache:true});
59
+ const cached=require('../../applications/snapshot-cache').read(file,{preferCache:true});
60
60
  if (cached.stat.size > MAX_RESPONSE_BYTES) throw new Error("Wordfence cache limit exceeded");
61
61
  previous = JSON.parse(cached.bytes.toString('utf8')); indexProjection(previous);
62
62
  }
63
63
  catch { previous = null; }
64
64
  const merged = mergeProjections(previous, snapshot);
65
65
  // Keep the current scan's exact coverage if the cross-project union is too large.
66
- require("./live-snapshot").writeSnapshotAtomically(file,
66
+ require("../../applications/live-snapshot").writeSnapshotAtomically(file,
67
67
  Buffer.byteLength(JSON.stringify(merged)) <= MAX_RESPONSE_BYTES ? merged : snapshot);
68
68
  }
69
69
 
@@ -2,7 +2,7 @@ module.exports = {
2
2
  id: "wordfence", ttlMs: 24 * 3600 * 1000,
3
3
  build(type, params) {
4
4
  if (type === "software") {
5
- require("../application-providers/wordfence-projection").queriesOf(params?.software, { min: 1, max: 100 });
5
+ require("./projection").queriesOf(params?.software, { min: 1, max: 100 });
6
6
  return { url: "https://www.wordfence.com/api/intelligence/v3/vulnerabilities/production", proxyOnly: true };
7
7
  }
8
8
  if (type !== "production-feed") throw new Error("invalid Wordfence request");
@@ -1,5 +1,5 @@
1
1
  /** Explicit coverage contract shared by the Wordfence proxy and its client. */
2
- const { indexProductionFeed } = require("./wordfence-v3");
2
+ const { indexProductionFeed } = require("./v3");
3
3
  const FORMAT = "wordfence-targeted-v1";
4
4
  const SOURCE_URL = "https://www.wordfence.com/api/intelligence/v3/vulnerabilities/production";
5
5
  const MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
@@ -19,11 +19,20 @@ function queriesOf(queries, { min = 0, max = 10000 } = {}) {
19
19
  return [...unique.values()].sort((a, b) => keyOf(a).localeCompare(keyOf(b)));
20
20
  }
21
21
 
22
+ // The slug an extension is assessed under. A plugin or theme is installed in a directory
23
+ // named after its catalogue slug, so every extension not declared private is assessed by
24
+ // default: under the slug of its official header URL, else its declared or directory slug.
25
+ // A provider that does not know the slug reports the component as unknown.
26
+ function catalogueSlug(component) {
27
+ if (!component || component.visibility === "private" || !["plugin", "theme"].includes(component.kind)) return null;
28
+ const slug = String(component.releaseSlug || component.slug || "").toLowerCase();
29
+ return /^[a-z0-9][a-z0-9._-]{0,199}$/.test(slug) ? slug : null;
30
+ }
31
+
22
32
  function componentQueries(components) {
23
33
  return queriesOf(components.filter(c => c.visibility !== "private" && c.version &&
24
- (c.kind === "core" || ["verified", "user-declared"].includes(c.catalogueStatus)) &&
25
- ["core", "plugin", "theme"].includes(c.kind) && (c.kind === "core" || c.slug))
26
- .map(c => ({ type: c.kind, slug: c.kind === "core" ? "wordpress" : c.slug.toLowerCase() })));
34
+ ["core", "plugin", "theme"].includes(c.kind) && (c.kind === "core" || catalogueSlug(c)))
35
+ .map(c => ({ type: c.kind, slug: c.kind === "core" ? "wordpress" : catalogueSlug(c) })));
27
36
  }
28
37
 
29
38
  function indexProjection(snapshot) {
@@ -73,4 +82,4 @@ function mergeProjections(previous, incoming) {
73
82
  previous._fadSnapshot.stale || incoming._fadSnapshot.stale);
74
83
  }
75
84
 
76
- module.exports = { FORMAT, SOURCE_URL, MAX_RESPONSE_BYTES, keyOf, queriesOf, componentQueries, indexProjection, projectFeed, mergeProjections };
85
+ module.exports = { FORMAT, SOURCE_URL, MAX_RESPONSE_BYTES, keyOf, queriesOf, componentQueries, indexProjection, projectFeed, mergeProjections, catalogueSlug };
@@ -1,7 +1,7 @@
1
1
  /** Server-only full catalogue cache. A client receives only an explicit projection. */
2
2
  const { gzipSync, gunzipSync } = require("node:zlib");
3
- const { indexProductionFeed } = require("../application-providers/wordfence-v3");
4
- const { queriesOf, projectFeed, MAX_RESPONSE_BYTES } = require("../application-providers/wordfence-projection");
3
+ const { indexProductionFeed } = require("./v3");
4
+ const { queriesOf, projectFeed, MAX_RESPONSE_BYTES } = require("./projection");
5
5
  const MAX_FEED_BYTES = 128 * 1024 * 1024;
6
6
 
7
7
  function createWordfenceProjection({ store, loadFeed, ttlMs, allowStale, stats, maxEntries,
@@ -95,7 +95,7 @@ function indexProductionFeed(feed) {
95
95
 
96
96
  function indexFeed(feed) {
97
97
  if (feed && typeof feed === "object" && ("format" in feed || "queriedSoftware" in feed || "advisories" in feed))
98
- return require("./wordfence-projection").indexProjection(feed);
98
+ return require("./projection").indexProjection(feed);
99
99
  return indexProductionFeed(feed);
100
100
  }
101
101
 
@@ -111,12 +111,11 @@ function assessWordfenceFeed(feed, components = []) {
111
111
  coverage.push({ ...base, execution: "not-run", result: "indeterminate", diagnostic: "CMS_PRIVATE_COMPONENT" });
112
112
  continue;
113
113
  }
114
- if (!component.version || (component.kind !== "core" && !["verified", "user-declared"].includes(component.catalogueStatus))) {
115
- coverage.push({ ...base, execution: "not-run", result: "indeterminate",
116
- diagnostic: !component.version ? "CMS_VERSION_UNKNOWN" : "CMS_IDENTITY_UNVERIFIED" });
114
+ if (!component.version) {
115
+ coverage.push({ ...base, execution: "not-run", result: "indeterminate", diagnostic: "CMS_VERSION_UNKNOWN" });
117
116
  continue;
118
117
  }
119
- const slug = component.kind === "core" ? "wordpress" : component.slug;
118
+ const slug = component.kind === "core" ? "wordpress" : require("./projection").catalogueSlug(component);
120
119
  if (!slug || !["core", "plugin", "theme"].includes(component.kind)) {
121
120
  coverage.push({ ...base, execution: "not-run", result: "indeterminate", diagnostic: "CMS_IDENTITY_UNVERIFIED" });
122
121
  continue;
@@ -1,6 +1,11 @@
1
1
  module.exports = {
2
2
  id: "wordpress", ttlMs: 24 * 3600 * 1000,
3
3
  build(type, params) {
4
+ if (type === "extension") {
5
+ if (!["plugin","theme"].includes(params?.kind) || !/^[a-z0-9][a-z0-9._-]{0,199}$/.test(params.slug)) throw Error("invalid WordPress catalogue identity");
6
+ const query = new URLSearchParams({action:params.kind+"_information","request[slug]":params.slug});
7
+ return {url:`https://api.wordpress.org/${params.kind}s/info/1.2/?${query}`};
8
+ }
4
9
  if (type !== "checksums" || !params?.version || typeof params.version !== "string") throw new Error("invalid WordPress checksums request");
5
10
  return { url: `https://api.wordpress.org/core/checksums/1.0/?version=${encodeURIComponent(params.version)}&locale=${encodeURIComponent(params.locale || "en_US")}` };
6
11
  },