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.
- package/CHANGELOG.md +63 -0
- package/README.md +34 -19
- package/completions/vigievuln.bash +14 -3
- package/completions/vigievuln.zsh +11 -8
- package/data/fingerprints/index.js +80 -0
- package/data/fingerprints/interpreters/javascript/bun.json +23 -0
- package/data/fingerprints/interpreters/javascript/deno.json +10 -0
- package/data/fingerprints/interpreters/javascript/electron.json +20 -0
- package/data/fingerprints/interpreters/javascript/gjs.json +8 -0
- package/data/fingerprints/interpreters/javascript/javascriptcore.json +14 -0
- package/data/fingerprints/interpreters/javascript/jscgtk.json +10 -0
- package/data/fingerprints/interpreters/javascript/node.json +26 -0
- package/data/fingerprints/interpreters/javascript/nwjs.json +8 -0
- package/data/fingerprints/interpreters/javascript/webkitgtk.json +10 -0
- package/data/fingerprints/interpreters/javascript/wpewebkit.json +10 -0
- package/data/fingerprints/interpreters/languages/dotnet.json +8 -0
- package/data/fingerprints/interpreters/languages/erlang.json +9 -0
- package/data/fingerprints/interpreters/languages/gawk.json +10 -0
- package/data/fingerprints/interpreters/languages/guile.json +9 -0
- package/data/fingerprints/interpreters/languages/java.json +8 -0
- package/data/fingerprints/interpreters/languages/julia.json +9 -0
- package/data/fingerprints/interpreters/languages/lua.json +11 -0
- package/data/fingerprints/interpreters/languages/luajit.json +10 -0
- package/data/fingerprints/interpreters/languages/perl.json +11 -0
- package/data/fingerprints/interpreters/languages/php.json +22 -0
- package/data/fingerprints/interpreters/languages/powershell.json +17 -0
- package/data/fingerprints/interpreters/languages/pypy.json +8 -0
- package/data/fingerprints/interpreters/languages/python.json +24 -0
- package/data/fingerprints/interpreters/languages/r.json +9 -0
- package/data/fingerprints/interpreters/languages/racket.json +9 -0
- package/data/fingerprints/interpreters/languages/raku.json +8 -0
- package/data/fingerprints/interpreters/languages/ruby.json +21 -0
- package/data/fingerprints/interpreters/languages/tcl.json +9 -0
- package/data/fingerprints/interpreters/shells/bash.json +10 -0
- package/data/fingerprints/interpreters/shells/dash.json +8 -0
- package/data/fingerprints/interpreters/shells/fish.json +9 -0
- package/data/fingerprints/interpreters/shells/ksh.json +8 -0
- package/data/fingerprints/interpreters/shells/zsh.json +9 -0
- package/data/fingerprints/services/databases/clickhouse.json +8 -0
- package/data/fingerprints/services/databases/elasticsearch.json +8 -0
- package/data/fingerprints/services/databases/etcd.json +9 -0
- package/data/fingerprints/services/databases/mariadb.json +9 -0
- package/data/fingerprints/services/databases/memcached.json +9 -0
- package/data/fingerprints/services/databases/mongo.json +8 -0
- package/data/fingerprints/services/databases/mysql.json +9 -0
- package/data/fingerprints/services/databases/opensearch.json +8 -0
- package/data/fingerprints/services/databases/postgres.json +18 -0
- package/data/fingerprints/services/databases/redis.json +9 -0
- package/data/fingerprints/services/databases/valkey.json +8 -0
- package/data/fingerprints/services/dns-directory/bind.json +8 -0
- package/data/fingerprints/services/dns-directory/dnsmasq.json +8 -0
- package/data/fingerprints/services/dns-directory/slapd.json +8 -0
- package/data/fingerprints/services/dns-directory/unbound.json +8 -0
- package/data/fingerprints/services/mail/cyrus.json +8 -0
- package/data/fingerprints/services/mail/dovecot.json +8 -0
- package/data/fingerprints/services/mail/exim.json +9 -0
- package/data/fingerprints/services/mail/opendkim.json +8 -0
- package/data/fingerprints/services/mail/opensmtpd.json +8 -0
- package/data/fingerprints/services/mail/postfix.json +8 -0
- package/data/fingerprints/services/mail/rspamd.json +8 -0
- package/data/fingerprints/services/mail/sendmail.json +8 -0
- package/data/fingerprints/services/messaging/kafka.json +8 -0
- package/data/fingerprints/services/messaging/mosquitto.json +8 -0
- package/data/fingerprints/services/messaging/nats.json +9 -0
- package/data/fingerprints/services/messaging/rabbitmq.json +8 -0
- package/data/fingerprints/services/remote-access/dropbear.json +8 -0
- package/data/fingerprints/services/remote-access/openssh.json +10 -0
- package/data/fingerprints/services/remote-access/proftpd.json +8 -0
- package/data/fingerprints/services/remote-access/samba.json +8 -0
- package/data/fingerprints/services/remote-access/vsftpd.json +8 -0
- package/data/fingerprints/services/web-proxies/apache.json +18 -0
- package/data/fingerprints/services/web-proxies/caddy.json +9 -0
- package/data/fingerprints/services/web-proxies/envoy.json +8 -0
- package/data/fingerprints/services/web-proxies/haproxy.json +10 -0
- package/data/fingerprints/services/web-proxies/lighttpd.json +8 -0
- package/data/fingerprints/services/web-proxies/nginx.json +14 -0
- package/data/fingerprints/services/web-proxies/squid.json +8 -0
- package/data/fingerprints/services/web-proxies/tomcat.json +8 -0
- package/data/fingerprints/services/web-proxies/traefik.json +9 -0
- package/data/fingerprints/services/web-proxies/varnish.json +8 -0
- package/lib/README.md +51 -0
- package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
- package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
- package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
- package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
- package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
- package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
- package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
- package/lib/{native-advisories.js → advisories/native.js} +15 -13
- package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
- package/lib/{advisory-store.js → advisories/store.js} +2 -2
- package/lib/{application-exports.js → applications/exports.js} +1 -1
- package/lib/{application-inventory.js → applications/inventory.js} +3 -1
- package/lib/applications/layout.js +199 -0
- package/lib/{application-providers → applications}/live-snapshot.js +10 -10
- package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
- package/lib/applications/plugins/ghost.js +36 -0
- package/lib/{application-plugins → applications/plugins}/index.js +1 -1
- package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
- package/lib/applications/plugins/redmine.js +24 -0
- package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
- package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
- package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
- package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
- package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
- package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
- package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
- package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
- package/lib/artifacts/access-warnings.js +24 -0
- package/lib/artifacts/applications.js +39 -8
- package/lib/artifacts/component-scope.js +12 -3
- package/lib/artifacts/cve-view.js +8 -5
- package/lib/artifacts/disk-wasm.mjs +3 -0
- package/lib/artifacts/disk.js +188 -0
- package/lib/artifacts/elf-product.js +215 -0
- package/lib/artifacts/enrichment.js +31 -17
- package/lib/artifacts/go-main-identity.js +135 -36
- package/lib/artifacts/go-publisher-advisories.js +4 -3
- package/lib/artifacts/image-products.js +181 -0
- package/lib/artifacts/index.js +36 -13
- package/lib/artifacts/install-version.js +44 -0
- package/lib/artifacts/inventory-scope.js +53 -3
- package/lib/artifacts/pe-product.js +28 -0
- package/lib/artifacts/product-advisories.js +212 -0
- package/lib/artifacts/product-catalog.js +67 -0
- package/lib/artifacts/release-catalogues.js +149 -0
- package/lib/artifacts/release-versions.js +101 -0
- package/lib/artifacts/remediation-report.js +1 -1
- package/lib/artifacts/report-inventory.js +17 -2
- package/lib/artifacts/report-path.js +29 -0
- package/lib/artifacts/report.js +85 -32
- package/lib/artifacts/retire.js +3 -3
- package/lib/artifacts/risk-report.js +12 -8
- package/lib/artifacts/sbom.js +33 -4
- package/lib/artifacts/scan.js +316 -69
- package/lib/artifacts/system-apps.js +98 -0
- package/lib/artifacts/system-maintenance.js +101 -0
- package/lib/artifacts/system-module-updates.js +104 -0
- package/lib/artifacts/system-report.js +232 -0
- package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
- package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
- package/lib/{cache-db.js → cache/db.js} +1 -1
- package/lib/{dump-format.js → cache/dump-format.js} +2 -2
- package/lib/{json-cache.js → cache/json.js} +1 -1
- package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
- package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
- package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
- package/lib/{cache-repository.js → cache/repository.js} +1 -1
- package/lib/{resource-cache → cache/resource}/engine.js +23 -16
- package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
- package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
- package/lib/{resource-cache → cache/resource}/validate.js +20 -5
- package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
- package/lib/certs/scan.js +17 -11
- package/lib/cli-collect.js +262 -0
- package/lib/cli-command-routing.js +30 -13
- package/lib/cli-groups.js +1 -1
- package/lib/cli-image.js +158 -47
- package/lib/cli-project-commands.js +10 -10
- package/lib/cli-setup.js +8 -8
- package/lib/cli-watch.js +3 -3
- package/lib/codecs/binary/elf-metadata.js +6 -0
- package/lib/codecs/binary/metadata.js +1 -1
- package/lib/codecs/binary/pe-metadata.js +47 -11
- package/lib/codecs/binary/scan.js +12 -4
- package/lib/codecs/binary.codec.js +1 -1
- package/lib/codecs/composer/platform.js +2 -2
- package/lib/codecs/composer/registry.js +12 -18
- package/lib/codecs/composer.codec.js +6 -5
- package/lib/codecs/go/parse.js +1 -1
- package/lib/codecs/go/registry.js +7 -7
- package/lib/codecs/go.codec.js +2 -2
- package/lib/codecs/gradle/parse.js +1 -1
- package/lib/codecs/gradle/versionless.js +2 -2
- package/lib/codecs/gradle.codec.js +7 -7
- package/lib/codecs/index.js +1 -1
- package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
- package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
- package/lib/codecs/maven/jar-scan.js +4 -4
- package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
- package/lib/{core.js → codecs/maven/pom.js} +22 -11
- package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
- package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
- package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
- package/lib/codecs/maven.codec.js +18 -14
- package/lib/codecs/npm/collect.js +55 -8
- package/lib/codecs/npm/manifest-kind.js +16 -0
- package/lib/codecs/npm/parse.js +23 -7
- package/lib/codecs/npm/registry.js +28 -14
- package/lib/codecs/npm.codec.js +5 -5
- package/lib/codecs/nuget/registry.js +7 -7
- package/lib/codecs/nuget.codec.js +4 -4
- package/lib/codecs/pypi/registry.js +7 -7
- package/lib/codecs/pypi.codec.js +4 -4
- package/lib/codecs/recipes.js +2 -2
- package/lib/codecs/ruby/registry.js +7 -7
- package/lib/codecs/ruby.codec.js +2 -2
- package/lib/config.js +1 -1
- package/lib/{attribution.js → findings/attribution.js} +3 -3
- package/lib/findings/cve-descriptions.js +144 -0
- package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
- package/lib/{diff.js → findings/diff.js} +0 -0
- package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
- package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
- package/lib/{gate.js → findings/gate.js} +1 -1
- package/lib/{malware.js → findings/malware.js} +30 -7
- package/lib/{merge-sources.js → findings/merge.js} +57 -9
- package/lib/{priority.js → findings/priority.js} +3 -3
- package/lib/findings/risk-evidence.js +24 -0
- package/lib/findings/severity.js +16 -0
- package/lib/{finding-summary.js → findings/summary.js} +5 -2
- package/lib/{suppress.js → findings/suppress.js} +2 -2
- package/lib/images/local-docker.js +72 -0
- package/lib/{image-network.js → images/network.js} +26 -16
- package/lib/{image-references.js → images/references.js} +29 -11
- package/lib/{image-registry.js → images/registry.js} +18 -9
- package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
- package/lib/images/temp-roots.js +23 -0
- package/lib/{image-update.js → images/update.js} +3 -3
- package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
- package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
- package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
- package/lib/{embedded.js → inventory/embedded.js} +4 -3
- package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
- package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
- package/lib/{module-names.js → inventory/module-names.js} +1 -1
- package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
- package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
- package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
- package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
- package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
- package/lib/{purl.js → inventory/purl.js} +2 -2
- package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
- package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
- package/lib/{outdated.js → maintenance/outdated.js} +20 -20
- package/lib/options-env.js +1 -1
- package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
- package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
- package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
- package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
- package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
- package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
- package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
- package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
- package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
- package/lib/providers/{debian.js → debian/index.js} +1 -0
- package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
- package/lib/providers/{drupal.js → drupal/index.js} +4 -0
- package/lib/providers/{eol.js → eol/index.js} +1 -1
- package/lib/{epss.js → providers/epss/enrich.js} +16 -13
- package/lib/providers/{epss.js → epss/index.js} +2 -2
- package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
- package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
- package/lib/providers/{freexian.js → freexian/index.js} +3 -3
- package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
- package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
- package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
- package/lib/{gcve.js → providers/gcve/id.js} +1 -1
- package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
- package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
- package/lib/providers/{github.js → github/index.js} +3 -1
- package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
- package/lib/providers/{go.js → go/index.js} +1 -1
- package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
- package/lib/providers/{hashid.js → hashid/index.js} +1 -1
- package/lib/providers/index.js +18 -13
- package/lib/{kev.js → providers/kev/enrich.js} +12 -9
- package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
- package/lib/providers/{maven.js → maven/index.js} +5 -3
- package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
- package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
- package/lib/providers/mit-kerberos/index.js +6 -0
- package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
- package/lib/providers/{npm.js → npm/index.js} +1 -1
- package/lib/providers/{nuget.js → nuget/index.js} +1 -1
- package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
- package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
- package/lib/providers/{nvd.js → nvd/index.js} +18 -4
- package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
- package/lib/{osv-db.js → providers/osv/db.js} +18 -16
- package/lib/providers/{osv.js → osv/index.js} +1 -1
- package/lib/{osv.js → providers/osv/query.js} +150 -80
- package/lib/providers/package-releases/index.js +26 -0
- package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
- package/lib/providers/{packagist.js → packagist/index.js} +1 -1
- package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
- package/lib/providers/{pypi.js → pypi/index.js} +1 -1
- package/lib/providers/redhat/bzip2.js +167 -0
- package/lib/providers/redhat/errata.js +75 -0
- package/lib/providers/redhat/index.js +10 -0
- package/lib/providers/redhat/oval.js +70 -0
- package/lib/providers/redhat/unfixed.js +127 -0
- package/lib/{registries.js → providers/registries.js} +4 -4
- package/lib/{retire.js → providers/retire/scan.js} +18 -18
- package/lib/providers/{ruby.js → ruby/index.js} +1 -1
- package/lib/providers/rubysec/advisories.js +177 -0
- package/lib/providers/rubysec/index.js +9 -0
- package/lib/{snyk.js → providers/snyk/client.js} +2 -2
- package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
- package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
- package/lib/providers/wolfi/index.js +10 -0
- package/lib/providers/wolfi/secdb.js +47 -0
- package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
- package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
- package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
- package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
- package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
- package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
- package/lib/providers/wpvulnerability/assess.js +181 -0
- package/lib/providers/wpvulnerability/index.js +12 -0
- package/lib/{charts.js → reports/charts.js} +25 -18
- package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
- package/lib/{cve-report.js → reports/cve-report.js} +453 -228
- package/lib/reports/detail.js +55 -0
- package/lib/{i18n.js → reports/i18n.js} +38 -2
- package/lib/{report-integrity.js → reports/integrity.js} +1 -1
- package/lib/{json-export.js → reports/json-export.js} +95 -24
- package/lib/{report-notices.js → reports/notices.js} +11 -6
- package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
- package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
- package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
- package/lib/scan/coverage.js +114 -0
- package/lib/{provenance.js → scan/provenance.js} +12 -5
- package/lib/scan/reliability.js +157 -0
- package/lib/{source-health.js → scan/source-health.js} +52 -20
- package/lib/{source-profile.js → scan/source-profile.js} +3 -3
- package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
- package/lib/{project-client.js → service/project-client.js} +20 -2
- package/lib/source-input.js +58 -0
- package/lib/system-inventory/advisories.js +89 -16
- package/lib/system-inventory/collect.js +33 -10
- package/lib/system-inventory/distribution-sources.js +32 -15
- package/lib/system-inventory/package-applicability.js +51 -0
- package/lib/system-inventory/targeted.js +8 -5
- package/lib/ui.js +11 -0
- package/package.json +49 -2
- package/vigievuln.js +483 -352
- package/lib/cache-archive.js +0 -676
- package/lib/osv-legacy.js +0 -57
- package/lib/risk-evidence.js +0 -18
- package/lib/scan-coverage.js +0 -61
- /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
- /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
- /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
- /package/lib/{cache-directory.js → cache/directory.js} +0 -0
- /package/lib/{cache-policy.js → cache/policy.js} +0 -0
- /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
- /package/lib/{cache-startup.js → cache/startup.js} +0 -0
- /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
- /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
- /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
- /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
- /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
- /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
- /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
- /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
- /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
- /package/lib/providers/{kev.js → kev/index.js} +0 -0
- /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
- /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
- /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
- /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
- /package/lib/providers/{retire.js → retire/index.js} +0 -0
- /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
- /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
- /package/lib/{report-time.js → reports/time.js} +0 -0
- /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
- /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
- /package/lib/{account-client.js → service/account-client.js} +0 -0
- /package/lib/{account-session.js → service/account-session.js} +0 -0
- /package/lib/{account-terms.js → service/account-terms.js} +0 -0
|
@@ -8,7 +8,7 @@ const zlib=require('node:zlib');
|
|
|
8
8
|
const tar=require('tar-stream');
|
|
9
9
|
const {pipeline}=require('node:stream/promises');
|
|
10
10
|
const {Transform}=require('node:stream');
|
|
11
|
-
const {openCacheDb,closeCacheDbs,SCHEMA_VERSION}=require('./
|
|
11
|
+
const {openCacheDb,closeCacheDbs,SCHEMA_VERSION}=require('./db');
|
|
12
12
|
const {proxyOrigin:canonicalOrigin}=require('./proxy-scope');
|
|
13
13
|
const FORMAT='vigievuln-sqlite-cache';
|
|
14
14
|
const ALLOWED=new Set(['.vigie-vuln/','.vigie-vuln/cache.sqlite','.vigie-vuln/cli-bundle-meta.json','.vigievuln-archive-origin.json']);
|
|
@@ -91,7 +91,7 @@ function mergeDatabase(targetFile,incomingFile){
|
|
|
91
91
|
for(const key of new Set([...Object.keys(local.entries),...Object.keys(incoming.entries)])){
|
|
92
92
|
if(local.entries[key]===true||incoming.entries[key]===true)entries[key]=true;
|
|
93
93
|
}
|
|
94
|
-
require('
|
|
94
|
+
require('../providers/maven/presence').discardUnverifiedEntries({entries});
|
|
95
95
|
}
|
|
96
96
|
const stamp=Math.min(localRow.fetched_at,incomingRow.fetched_at);
|
|
97
97
|
mergedMaps.push({key:localRow.key,stamp,value:{...local,...incoming,meta:{...local.meta,...incoming.meta,fetchedAt:stamp},entries}});
|
|
@@ -171,7 +171,7 @@ function mergeDatabase(targetFile,incomingFile){
|
|
|
171
171
|
target.exec('DETACH DATABASE incoming');
|
|
172
172
|
}finally{target.close()}
|
|
173
173
|
}
|
|
174
|
-
async function importCache(source,{targetDir=require('./
|
|
174
|
+
async function importCache(source,{targetDir=require('./directory').getCacheDir(),proxyOrigin,replace=false,force=false,onProgress,requireUsableSeed=false}={}){
|
|
175
175
|
const abs=path.resolve(source);if(!fs.statSync(abs).isFile())throw Error('cache bundle is not a file');
|
|
176
176
|
onProgress?.({phase:'validating'});
|
|
177
177
|
fs.mkdirSync(path.dirname(targetDir),{recursive:true,mode:0o700});
|
|
@@ -189,7 +189,8 @@ async function importCache(source,{targetDir=require('./cache-directory').getCac
|
|
|
189
189
|
if(requireUsableSeed&&summary.advisories===0)throw Error('SQLite cache bundle contains no advisories');
|
|
190
190
|
fs.mkdirSync(targetDir,{recursive:true,mode:0o700});
|
|
191
191
|
const targetFile=path.join(targetDir,'cache.sqlite');
|
|
192
|
-
|
|
192
|
+
// --force only drops the backup of a --replace import; alone it still merges.
|
|
193
|
+
if(!fs.existsSync(targetFile)||replace){
|
|
193
194
|
closeCacheDbs();
|
|
194
195
|
const backup=fs.existsSync(targetFile)?`${targetDir}.bak-${Date.now()}.sqlite`:null;
|
|
195
196
|
if(backup)fs.renameSync(targetFile,backup);
|
|
@@ -202,7 +203,7 @@ async function importCache(source,{targetDir=require('./cache-directory').getCac
|
|
|
202
203
|
return {dir:targetDir,mode:'merge',stats:{added:0,updated:0,merged:1,kept:0,skipped:[]}};
|
|
203
204
|
}finally{fs.rmSync(stage,{recursive:true,force:true})}
|
|
204
205
|
}
|
|
205
|
-
async function exportCache(destination,{sourceDir=require('./
|
|
206
|
+
async function exportCache(destination,{sourceDir=require('./directory').getCacheDir(),proxyOrigin,project=null}={}){
|
|
206
207
|
const stage=fs.mkdtempSync(path.join(os.tmpdir(),'vigievuln-sqlite-export-'));
|
|
207
208
|
const root=path.join(stage,'.vigie-vuln');fs.mkdirSync(root);
|
|
208
209
|
try{
|
|
@@ -131,7 +131,7 @@ function openCacheDb({cacheDir, readonly=false}={}) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
const shared=new Map();
|
|
134
|
-
function getCacheDb(cacheDir=require('./
|
|
134
|
+
function getCacheDb(cacheDir=require('./directory').getCacheDir()){
|
|
135
135
|
const key=path.resolve(cacheDir);
|
|
136
136
|
let db=shared.get(key);
|
|
137
137
|
if(!db){db=openCacheDb({cacheDir:key});shared.set(key,db)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/dump-format.js — the vigievuln dump format, shared by the service (writes and
|
|
2
|
+
* lib/cache/dump-format.js — the vigievuln dump format, shared by the service (writes and
|
|
3
3
|
* restores dumps) and by `vigievuln serve-cache --seed` (seeds a relay from one).
|
|
4
4
|
*
|
|
5
5
|
* A dump is two files:
|
|
@@ -91,7 +91,7 @@ async function* readLines(payloadPath) {
|
|
|
91
91
|
const encodeLine = obj => JSON.stringify(obj).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029") + "\n";
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* Seed a resource store (lib/
|
|
94
|
+
* Seed a resource store (lib/cache/resource/fs-store.js interface: put) from a dump's
|
|
95
95
|
* "resource" lines. A cached entry fresher than the dump's is kept. → { imported, kept }.
|
|
96
96
|
*/
|
|
97
97
|
async function seedResourceStore(store, payloadPath) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {createCacheRepository} = require('./
|
|
3
|
+
const {createCacheRepository} = require('./repository');
|
|
4
4
|
|
|
5
5
|
function load(cacheDir, key, fallback) {
|
|
6
6
|
try { return createCacheRepository(cacheDir).get('auxiliary', key)?.value ?? fallback; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/proxy-cache.js — shared, persistent proxy-cache for vigievuln's public data sources.
|
|
2
|
+
* lib/cache/proxy-cache.js — shared, persistent proxy-cache for vigievuln's public data sources.
|
|
3
3
|
*
|
|
4
4
|
* A scan of a real reactor makes hundreds of registry/advisory lookups, and every
|
|
5
5
|
* machine that scans makes them again. This module turns ONE of those machines into
|
|
@@ -38,8 +38,8 @@ const fs = require("fs");
|
|
|
38
38
|
const path = require("path");
|
|
39
39
|
const os = require("os");
|
|
40
40
|
const http = require("http");
|
|
41
|
-
const engineLib = require("./resource
|
|
42
|
-
const { createCacheStore, DEFAULT_CACHE_DIR } = require("./resource
|
|
41
|
+
const engineLib = require("./resource/engine");
|
|
42
|
+
const { createCacheStore, DEFAULT_CACHE_DIR } = require("./resource/sqlite-store");
|
|
43
43
|
const {
|
|
44
44
|
createResourceEngine, upstreamHeadersFor, ttlForUrl, sendJson,
|
|
45
45
|
DEFAULT_TTL_MS, TTL_BY_SOURCE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_STORE_BYTES,
|
|
@@ -49,7 +49,7 @@ const {
|
|
|
49
49
|
const DEFAULT_PORT = 8321;
|
|
50
50
|
const DEFAULT_HOST = "127.0.0.1";
|
|
51
51
|
/** The scan's own per-pass cache root — the proxy store must never live inside it. */
|
|
52
|
-
const CLIENT_CACHE_DIR = () => path.join(require("./
|
|
52
|
+
const CLIENT_CACHE_DIR = () => path.join(require("./directory").getCacheDir());
|
|
53
53
|
|
|
54
54
|
// -------------------------------------------------------------- server ----
|
|
55
55
|
|
|
@@ -69,7 +69,7 @@ function readRequestBody(req, maxBytes) {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* The proxy-cache HTTP server: routes, the shared token and store ownership around the
|
|
72
|
-
* resource engine (lib/
|
|
72
|
+
* resource engine (lib/cache/resource/engine.js). Endpoints:
|
|
73
73
|
* POST /v1/resource — typed provider request
|
|
74
74
|
* GET /__health — liveness (no auth)
|
|
75
75
|
* GET /__stats — counters + entry count
|
|
@@ -125,7 +125,7 @@ function createProxyCacheServer(opts = {}) {
|
|
|
125
125
|
catch { return sendJson(res, 400, { error: "invalid resource request" }); }
|
|
126
126
|
// The same whitelist as vigievuln: a serve-cache reachable on a network must not
|
|
127
127
|
// forward anything fad itself would never send.
|
|
128
|
-
try { payload = require("./resource
|
|
128
|
+
try { payload = require("./resource/validate").validateResource(payload); }
|
|
129
129
|
catch (error) { return sendJson(res, 400, { error: error.message, ...(error.field ? { field: error.field } : {}) }); }
|
|
130
130
|
return engine.handleResource(payload, res);
|
|
131
131
|
}
|
|
@@ -196,16 +196,16 @@ function runtimeSupportsEnvProxy() {
|
|
|
196
196
|
* `loopGuard` env prevents recursion; `noProxy` (the --proxy-cache host, if any)
|
|
197
197
|
* keeps local cache traffic out of the corporate tunnel.
|
|
198
198
|
*/
|
|
199
|
-
function reexecWithProxy({ proxyUrl, loopGuard = "__FAD_PROXY_REEXEC__", noProxy = null, env = process.env, spawnImpl = null }) {
|
|
199
|
+
function reexecWithProxy({ proxyUrl, loopGuard = "__FAD_PROXY_REEXEC__", noProxy = null, env = process.env, spawnImpl = null, argv = process.argv }) {
|
|
200
200
|
const { spawn } = require("child_process");
|
|
201
201
|
const e = { ...env, NODE_USE_ENV_PROXY: "1", HTTP_PROXY: proxyUrl, HTTPS_PROXY: proxyUrl, [loopGuard]: "1" };
|
|
202
202
|
if (noProxy) e.NO_PROXY = [env.NO_PROXY, noProxy].filter(Boolean).join(",");
|
|
203
203
|
// Rebuild the command line for the runtime we're in: under node it is
|
|
204
204
|
// `node <script> args`; under bun (incl. the compiled binary, where argv[1] is
|
|
205
205
|
// the executable itself) the executable replays argv from index 1 — the same
|
|
206
|
-
// self-re-exec contract lib/retire.js uses for the vendored-JS mode.
|
|
206
|
+
// self-re-exec contract lib/providers/retire/scan.js uses for the vendored-JS mode.
|
|
207
207
|
const isBun = !!(process.versions && process.versions.bun);
|
|
208
|
-
const args = isBun ?
|
|
208
|
+
const args = isBun ? argv.slice(1) : [argv[1], ...argv.slice(2)];
|
|
209
209
|
const child = (spawnImpl || spawn)(process.execPath, args, { stdio: "inherit", env: e });
|
|
210
210
|
child.on("exit", (code, sig) => process.exit(sig ? 1 : (code ?? 0)));
|
|
211
211
|
child.on("error", err => { console.error(`proxy re-exec failed: ${err.message}`); process.exit(1); });
|
|
@@ -50,7 +50,7 @@ function proxyScope(origin, {homeDir = os.homedir()} = {}) {
|
|
|
50
50
|
if (!cacheStat.isDirectory() || cacheStat.isSymbolicLink()) throw new Error('Unsafe proxy cache directory.');
|
|
51
51
|
}
|
|
52
52
|
if(!preparedScopes.has(cacheDir)){
|
|
53
|
-
require('./
|
|
53
|
+
require('./startup').prepareScopedCache(cacheDir);
|
|
54
54
|
preparedScopes.add(cacheDir);
|
|
55
55
|
}
|
|
56
56
|
return cacheDir;
|
|
@@ -9,7 +9,7 @@ const extractors = {
|
|
|
9
9
|
euvd: record => ({published:record?.published, modified:record?.modified}),
|
|
10
10
|
};
|
|
11
11
|
function stableRecord(source, record, options = {}) {
|
|
12
|
-
if (options.reuseStableAdvisories === false || options.forceUpdate || require('./
|
|
12
|
+
if (options.reuseStableAdvisories === false || options.forceUpdate || require('./policy').shouldForceUpdate()) return false;
|
|
13
13
|
const days = options.stableAdvisoryAgeDays ?? 365;
|
|
14
14
|
if (!Number.isFinite(days) || days <= 0 || days > Number.MAX_SAFE_INTEGER / DAY_MS) return false;
|
|
15
15
|
const now = options.now ?? Date.now(), extract = (options.recordMetadataExtractors || extractors)[source];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/
|
|
2
|
+
* lib/cache/resource/engine.js — the pull-through resource cache, without its transport.
|
|
3
3
|
*
|
|
4
|
-
* Extracted from lib/proxy-cache.js so the same engine serves `vigievuln serve-cache`
|
|
4
|
+
* Extracted from lib/cache/proxy-cache.js so the same engine serves `vigievuln serve-cache`
|
|
5
5
|
* (a relay on a filesystem store) and `vigievuln` (a public service on a SQLite or
|
|
6
6
|
* PostgreSQL store). It knows nothing about routes, tokens or ownership locks: it takes
|
|
7
7
|
* a typed resource request `{ provider, type, params, headers }` and answers it on a Node
|
|
@@ -34,8 +34,8 @@ function slots(n) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
const { pipeline } = require("node:stream/promises");
|
|
37
|
-
const { responseHeaders, cacheResponseHeaders } = require("
|
|
38
|
-
const { sourceForUrl } = require("
|
|
37
|
+
const { responseHeaders, cacheResponseHeaders } = require("../../providers/common");
|
|
38
|
+
const { sourceForUrl } = require("../../scan/source-health");
|
|
39
39
|
|
|
40
40
|
const DEFAULT_TTL_MS = 24 * 3600 * 1000;
|
|
41
41
|
/**
|
|
@@ -44,6 +44,7 @@ const DEFAULT_TTL_MS = 24 * 3600 * 1000;
|
|
|
44
44
|
* deps.dev, CIRCL) falls back to the 24h default. An explicit --ttl overrides all.
|
|
45
45
|
*/
|
|
46
46
|
const TTL_BY_SOURCE = {
|
|
47
|
+
wpvulnerability: 4 * 3600 * 1000,
|
|
47
48
|
osv: 12 * 3600 * 1000,
|
|
48
49
|
nvd: 7 * 24 * 3600 * 1000,
|
|
49
50
|
eol: 7 * 24 * 3600 * 1000,
|
|
@@ -65,7 +66,7 @@ const FAILURE_RETRY_MS = 30 * 1000;
|
|
|
65
66
|
// Format follows the typed operation, never an upstream Content-Type (an HTML
|
|
66
67
|
// error page may claim application/json, and raw JSON mirrors use text/plain).
|
|
67
68
|
const JSON_PROVIDERS = new Set(["nvd", "osv", "packagist", "kev", "eol", "npm", "pypi", "ruby", "go", "nuget", "alpine",
|
|
68
|
-
"wordfence", "wordpress", "drupal", "hashid", "retire", "certfr"]);
|
|
69
|
+
"wordfence", "wordpress", "wpvulnerability", "drupal", "hashid", "retire", "certfr"]);
|
|
69
70
|
function expectsJson(resource) {
|
|
70
71
|
if (!resource) return false;
|
|
71
72
|
const { provider, type } = resource;
|
|
@@ -86,6 +87,10 @@ function parseUpstreamJson(buffer) {
|
|
|
86
87
|
// fields and CVEs without optional CVSS/CPE/weakness enrichment remain valid.
|
|
87
88
|
// Reference: https://csrc.nist.gov/schema/nvd/api/2.0/cve_api_json_2.0.schema
|
|
88
89
|
function validateResourceJson(resource, data) {
|
|
90
|
+
if (resource?.provider === 'wpvulnerability') {
|
|
91
|
+
require('../../providers/wpvulnerability/assess').validate(data, resource.params);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
89
94
|
if (resource?.provider !== "nvd") return;
|
|
90
95
|
const invalid = () => { throw new Error("invalid upstream NVD response"); };
|
|
91
96
|
const object = v => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
@@ -93,7 +98,7 @@ function validateResourceJson(resource, data) {
|
|
|
93
98
|
const text = v => typeof v === "string";
|
|
94
99
|
const language = v => object(v) && text(v.lang) && text(v.value);
|
|
95
100
|
const date = v => text(v) && /^\d{4}-\d{2}-\d{2}T/.test(v) && Number.isFinite(Date.parse(v));
|
|
96
|
-
const expectedId =
|
|
101
|
+
const expectedId = ["spip-advisories","image-product"].includes(resource.type) ? null : String(resource.params?.id || "").toUpperCase();
|
|
97
102
|
const node = (v, depth = 0) => {
|
|
98
103
|
if (!object(v) || depth > 64 || (v.operator !== undefined && !["AND", "OR"].includes(v.operator)) ||
|
|
99
104
|
(v.negate !== undefined && typeof v.negate !== "boolean")) return false;
|
|
@@ -128,7 +133,7 @@ function validateResourceJson(resource, data) {
|
|
|
128
133
|
if (!record(data)) invalid();
|
|
129
134
|
return;
|
|
130
135
|
}
|
|
131
|
-
if (!["cve", "cve-mirror", "spip-advisories"].includes(resource.type) ||
|
|
136
|
+
if (!["cve", "cve-mirror", "spip-advisories", "image-product"].includes(resource.type) ||
|
|
132
137
|
!array(data.vulnerabilities, row => object(row) && record(row.cve))) invalid();
|
|
133
138
|
const count = data.vulnerabilities.length;
|
|
134
139
|
if (expectedId && count > 1) invalid();
|
|
@@ -149,7 +154,7 @@ function validateResourceJson(resource, data) {
|
|
|
149
154
|
* configured HERE wins over whatever a client sent; a client-sent key is forwarded
|
|
150
155
|
* when the server has none. Cache entries are keyed by the CLIENT url, so a keyed
|
|
151
156
|
* fetch and a keyless one share the same entry — the fleet shares the server's quota.
|
|
152
|
-
* nvd → header `apiKey: <key>` (services.nvd.nist.gov — same as lib/nvd.js)
|
|
157
|
+
* nvd → header `apiKey: <key>` (services.nvd.nist.gov — same as lib/providers/nvd/enrich.js)
|
|
153
158
|
* wordfence → `Authorization: Bearer <k>` (www.wordfence.com — same as the live-snapshot lane)
|
|
154
159
|
* github → `Authorization: Bearer <t>` (api.github.com — advisory lanes, pooled rate limit)
|
|
155
160
|
*/
|
|
@@ -160,7 +165,7 @@ function upstreamHeadersFor(target, reqHeaders = {}, keys = {}) {
|
|
|
160
165
|
};
|
|
161
166
|
// Forward the client's own credentials for this host (the proxy is in the trust path:
|
|
162
167
|
// every request it makes is one a client asked for). NVD's header is spelled `apiKey`
|
|
163
|
-
// (lib/nvd.js) but Node's http server lowercases every incoming header name, so both
|
|
168
|
+
// (lib/providers/nvd/enrich.js) but Node's http server lowercases every incoming header name, so both
|
|
164
169
|
// spellings are read and re-emitted as one — a server key must overwrite, not sit
|
|
165
170
|
// beside, the client's (same name, different case, ambiguous on the wire).
|
|
166
171
|
const clientApiKey = reqHeaders.apiKey ?? reqHeaders.apikey;
|
|
@@ -532,7 +537,7 @@ function createResourceEngine(opts = {}) {
|
|
|
532
537
|
const batch = provider.batch(type, params);
|
|
533
538
|
const items = batch.items;
|
|
534
539
|
const effectiveHeaders = upstreamHeadersFor(provider.build(type, params).url, reqHeaders, keys);
|
|
535
|
-
const { providerKey } = require("
|
|
540
|
+
const { providerKey } = require("../../providers");
|
|
536
541
|
const keysForItems = items.map(item => providerKey(provider.id, item.type, item.params, effectiveHeaders));
|
|
537
542
|
// Validate every cached body/backoff before reserving anything. An early return
|
|
538
543
|
// after reserving would leave promises in itemInflight with no producer.
|
|
@@ -622,22 +627,23 @@ function createResourceEngine(opts = {}) {
|
|
|
622
627
|
try { await Promise.all(waits); }
|
|
623
628
|
catch (error) {
|
|
624
629
|
if (error instanceof UpstreamDenied) return sendJson(res, 503, { error: error.message }, { "x-fad-proxy": "denied", "retry-after": String(error.retryAfterS) });
|
|
630
|
+
if (error.status === 429) return sendJson(res, 429, { error: error.message }, { "x-fad-proxy": "pass", "retry-after": String(error.retryAfterS) });
|
|
625
631
|
return sendJson(res, 502, { error: error.message }, { "x-fad-proxy": "error" });
|
|
626
632
|
}
|
|
627
633
|
return sendJson(res, 200, batch.merge(results), { "x-fad-proxy": oldestStale != null ? "stale" : reserved.length ? "miss" : "hit",...(oldestStale != null ? {'x-fad-proxy-reason':staleFailure?'refresh-failed':'revalidating'} : {}),...(quotaFailure?{'x-fad-proxy-refresh-status':String(quotaFailure.status),'x-fad-proxy-refresh-cause':quotaFailure.cause,...(quotaFailure.retryAfterS!=null?{'retry-after':String(quotaFailure.retryAfterS)}:{})}:{}),
|
|
628
634
|
"x-fad-proxy-fetched-at": new Date(oldestStale ?? oldestFetchedAt).toISOString() });
|
|
629
635
|
}
|
|
630
636
|
|
|
631
|
-
const wordfenceProjection = require("
|
|
637
|
+
const wordfenceProjection = require("../../providers/wordfence/resource-cache").createWordfenceProjection({
|
|
632
638
|
store, ttlMs: overrideTtlMs || 24 * 3600 * 1000, allowStale, stats, maxEntries,
|
|
633
|
-
maxResponseBytes: Math.min(maxBodyBytes, require("
|
|
639
|
+
maxResponseBytes: Math.min(maxBodyBytes, require("../../providers/wordfence/projection").MAX_RESPONSE_BYTES),
|
|
634
640
|
loadFeed: async ({ request, reqHeaders, ctx }) => {
|
|
635
641
|
admitOrThrow(request.url, ctx);
|
|
636
642
|
return withUpstream(async signal => {
|
|
637
643
|
stats.upstream++;
|
|
638
644
|
const up = await fetcher(request.url, { headers: upstreamHeadersFor(request.url, reqHeaders, keys), signal, redirect: "error" });
|
|
639
645
|
if (!up.ok) { await up.body?.cancel(); throw new Error(`Wordfence upstream returned HTTP ${up.status}`); }
|
|
640
|
-
try { return await boundedJson(up, signal, require("
|
|
646
|
+
try { return await boundedJson(up, signal, require("../../providers/wordfence/resource-cache").MAX_FEED_BYTES); }
|
|
641
647
|
catch { throw new Error("invalid or incomplete Wordfence catalogue response"); }
|
|
642
648
|
});
|
|
643
649
|
},
|
|
@@ -690,7 +696,7 @@ function createResourceEngine(opts = {}) {
|
|
|
690
696
|
const valid=list==='CVE' ? /^CVE-\d{4}-\d{4,}/m.test(text) : new RegExp('^\\[[^\\]]+\\] '+list+'-\\d+-\\d+','m').test(text);
|
|
691
697
|
if(!valid || /^\s*</.test(text))throw Error('Invalid Debian tracker source list');
|
|
692
698
|
},
|
|
693
|
-
project: (body,params) => require('
|
|
699
|
+
project: (body,params) => require('../../providers/debian/historical').projectDebianList(body,params),
|
|
694
700
|
load: async ({request,reqHeaders,ctx},limit) => {
|
|
695
701
|
admitOrThrow(request.url,ctx);
|
|
696
702
|
return withUpstream(async signal => {
|
|
@@ -707,7 +713,7 @@ function createResourceEngine(opts = {}) {
|
|
|
707
713
|
*/
|
|
708
714
|
async function handleResource(payload, res, ctx = {}) {
|
|
709
715
|
let provider, request, reqHeaders;
|
|
710
|
-
const { getProvider, providerKey } = require("
|
|
716
|
+
const { getProvider, providerKey } = require("../../providers");
|
|
711
717
|
try {
|
|
712
718
|
provider = getProvider(payload?.provider);
|
|
713
719
|
request = provider.build(payload.type, payload.params);
|
|
@@ -748,7 +754,7 @@ function createResourceEngine(opts = {}) {
|
|
|
748
754
|
}
|
|
749
755
|
if(payload.provider==='debian' && payload.type==='list'){
|
|
750
756
|
const {commit,list}=payload.params;
|
|
751
|
-
const key=require('
|
|
757
|
+
const key=require('../../providers/common').requestKey('debian','private-list-v1',{commit,list},'');
|
|
752
758
|
const result=await debianProjection(key,{request,reqHeaders,ctx,list},payload.params);
|
|
753
759
|
res.writeHead(200,{'content-type':'text/plain; charset=utf-8','content-length':result.body.length,'x-fad-proxy':result.stale?'stale':'projection','x-fad-proxy-fetched-at':new Date(result.fetchedAt).toISOString(),'x-vigievuln-source-sha256':result.sha256});
|
|
754
760
|
return res.end(result.body);
|
|
@@ -773,6 +779,7 @@ function createResourceEngine(opts = {}) {
|
|
|
773
779
|
}
|
|
774
780
|
|
|
775
781
|
module.exports = {
|
|
782
|
+
validateResourceJson,
|
|
776
783
|
createResourceEngine, upstreamHeadersFor, ttlForUrl, sendJson, UpstreamDenied,
|
|
777
784
|
DEFAULT_TTL_MS, TTL_BY_SOURCE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_TRANSFER_BYTES, DEFAULT_MAX_STORE_BYTES,
|
|
778
785
|
DEFAULT_UPSTREAM_TIMEOUT_MS, DEFAULT_MAX_CONCURRENT, DEFAULT_MAX_ENTRIES, FAILURE_RETRY_MS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/
|
|
2
|
+
* lib/cache/resource/fs-store.js — the filesystem implementation of the resource store.
|
|
3
3
|
*
|
|
4
4
|
* The resource-cache engine (./engine.js) talks to its store through a small interface,
|
|
5
5
|
* so the same engine runs on this directory store (serve-cache, the client-side local
|
|
@@ -27,7 +27,7 @@ const path = require("path");
|
|
|
27
27
|
const os = require("os");
|
|
28
28
|
const crypto = require("crypto");
|
|
29
29
|
|
|
30
|
-
const DEFAULT_CACHE_DIR = () => require('../
|
|
30
|
+
const DEFAULT_CACHE_DIR = () => require('../directory').getProxyCacheDir();
|
|
31
31
|
const TRANSIENT_KEEP_MS = 30 * 1000;
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -5,9 +5,9 @@ const path=require('node:path');
|
|
|
5
5
|
const os=require('node:os');
|
|
6
6
|
const crypto=require('node:crypto');
|
|
7
7
|
const {Readable}=require('node:stream');
|
|
8
|
-
const {getCacheDb}=require('../
|
|
8
|
+
const {getCacheDb}=require('../db');
|
|
9
9
|
const CHUNK=1024*1024;
|
|
10
|
-
const DEFAULT_CACHE_DIR=()=>require('../
|
|
10
|
+
const DEFAULT_CACHE_DIR=()=>require('../directory').getProxyCacheDir();
|
|
11
11
|
const preparedDefaults=new Set();
|
|
12
12
|
|
|
13
13
|
function location(dir){
|
|
@@ -19,7 +19,7 @@ function location(dir){
|
|
|
19
19
|
|
|
20
20
|
function createCacheStore(dir=DEFAULT_CACHE_DIR()){
|
|
21
21
|
if(dir===DEFAULT_CACHE_DIR()&&!preparedDefaults.has(dir)){
|
|
22
|
-
require('../
|
|
22
|
+
require('../startup').prepareServeCache();
|
|
23
23
|
preparedDefaults.add(dir);
|
|
24
24
|
}
|
|
25
25
|
const {root,prefix}=location(dir),db=getCacheDb(root),pinned=new Map(),pending=new Set();
|
|
@@ -69,10 +69,17 @@ const OSV_QUERY = (v, at) => {
|
|
|
69
69
|
const NONE = T.obj({});
|
|
70
70
|
|
|
71
71
|
/** "<provider>/<type>" → the params schema. */
|
|
72
|
+
const releases = require('../../providers/package-releases');
|
|
73
|
+
const archive = T.oneOf(Object.keys(releases.archives)), suite = T.str(releases.suite,40);
|
|
72
74
|
const RESOURCES = {
|
|
75
|
+
"package-releases/release": T.obj({archive,suite}),
|
|
76
|
+
"package-releases/index": T.obj({archive,suite,file:T.str(releases.index,80)}),
|
|
77
|
+
"package-releases/apk": T.obj({series:T.str(releases.alpine,8),arch:T.str(releases.apkArch,16),section:T.oneOf(['main','community'])}),
|
|
78
|
+
"package-releases/upstream": T.obj({project:T.int(1,1000000)}),
|
|
73
79
|
"nvd/cve": T.obj({ id: CVE }),
|
|
74
80
|
"nvd/cve-mirror": T.obj({ id: CVE }),
|
|
75
81
|
"nvd/spip-advisories": NONE,
|
|
82
|
+
"nvd/image-product": T.obj({product:T.oneOf([...require('../../artifacts/product-catalog').upstreamProducts.values()].filter(p=>p.cpe).map(p=>p.id)),cpe:T.str(/^[a-z0-9_.-]+:[a-z0-9_.-]+$/,100),version:T.str(/^\d+(?:\.\d+){1,3}$/,40)}),
|
|
76
83
|
"osv/vuln": T.obj({ id: T.str(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, 100) }),
|
|
77
84
|
"osv/packages": T.obj({ queries: T.arr(OSV_QUERY, 1, 1000) }),
|
|
78
85
|
"epss/scores": T.obj({ ids: T.arr(CVE, 1, 100) }),
|
|
@@ -87,11 +94,15 @@ const RESOURCES = {
|
|
|
87
94
|
"go/module-info": T.obj({ module: T.str(/^[a-z0-9.!_~-]+(\/[A-Za-z0-9.!_~+-]+)*$/, 300), version: T.str(/^v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+incompatible)?$/, 150) }),
|
|
88
95
|
"alpine/package": T.obj({ name: T.str(/^[a-z0-9][a-z0-9+_.-]*$/, 200) }),
|
|
89
96
|
"nginx/advisories": NONE,
|
|
97
|
+
"rubysec/advisory-db": NONE,
|
|
98
|
+
"wolfi/secdb": T.obj({ repository: T.oneOf(["wolfi", "chainguard"]) }),
|
|
99
|
+
"redhat/oval-unpatched": T.obj({ major: T.oneOf(["6", "7", "8", "9"]) }),
|
|
90
100
|
"freexian/index": T.obj({page:T.int(1,10000)}),
|
|
91
101
|
"freexian/advisory": T.obj({slug:T.str(/^ela-\d+-\d+-[a-z0-9][a-z0-9.+-]*$/,250)}),
|
|
92
|
-
"freexian/tracker": T.obj({packages:T.arr(T.str(/^[a-z0-9][a-z0-9+.-]*$/,200),1,1000)}),
|
|
102
|
+
"freexian/tracker": T.obj({packages:T.arr(T.str(/^[a-z0-9][a-z0-9+.-]*$/,200),1,1000),release:T.str(/^[a-z][a-z0-9-]*$/,32)},["release"]),
|
|
93
103
|
"freexian/vulnerability": T.obj({id:CVE}),
|
|
94
104
|
"alpine/vulnerability": T.obj({ id: CVE }),
|
|
105
|
+
"mit-kerberos/announcement": T.obj({quarter:T.str(/^\d{4}q[1-4]$/,6),message:T.str(/^\d{6}$/,6)}),
|
|
95
106
|
"debian/history": T.obj({ until: T.str(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/, 20) }),
|
|
96
107
|
"debian/source-version": T.obj({ name:T.str(/^[a-z0-9][a-z0-9+.-]*$/,200),version:T.str(/^[0-9][A-Za-z0-9.+:~\-]*$/,150) }),
|
|
97
108
|
"debian/list": T.obj({ commit: T.str(/^[a-f0-9]{40}$/, 40), list: T.oneOf(['CVE','DSA','DLA']), packages: T.arr(T.str(/^[a-z0-9][a-z0-9+.-]*$/, 200), 1, 1000) }),
|
|
@@ -102,10 +113,11 @@ const RESOURCES = {
|
|
|
102
113
|
"packagist/advisory-package": T.obj({ name: COMPOSER }),
|
|
103
114
|
"packagist/package": T.obj({ name: COMPOSER }),
|
|
104
115
|
"packagist/p2": T.obj({ name: COMPOSER }),
|
|
105
|
-
"maven/artifact": T.obj({ path: T.str(/^(?!.*\.\.)[A-Za-z0-9._+-]+(\/[A-Za-z0-9._+-]+)*$/, 500), method: T.oneOf(["GET", "HEAD"]) }, ["method"]),
|
|
116
|
+
"maven/artifact": T.obj({ path: T.str(/^(?!.*\.\.)[A-Za-z0-9._+-]+(\/[A-Za-z0-9._+-]+)*$/, 500), method: T.oneOf(["GET", "HEAD"]), repository:T.oneOf(['google']) }, ["method","repository"]),
|
|
106
117
|
"maven/latest": T.obj({ group: T.str(/^[A-Za-z0-9._-]+$/, 200), artifact: T.str(/^[A-Za-z0-9._-]+$/, 200) }),
|
|
107
|
-
"maven/preflight":
|
|
118
|
+
"maven/preflight": T.obj({repository:T.oneOf(['google'])},['repository']),
|
|
108
119
|
"github/cve-release": NONE,
|
|
120
|
+
"github/theme-release": T.obj({repo:T.oneOf(["TryGhost/Casper","TryGhost/Source"])}),
|
|
109
121
|
"github/cve-maven": T.obj({ keys: T.arr(T.str(/^[pa]:[a-z0-9][a-z0-9._:+-]*$/, 220), 1, 200) }),
|
|
110
122
|
"github/cve-npm": T.obj({ names: T.arr(T.str(/^(@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9._~-][a-z0-9._~-]*$/, 214), 1, 200) }),
|
|
111
123
|
"github/cve-packages": T.obj({ packages: T.arr(T.obj({ecosystem:T.str(/^(?:[A-Za-z0-9][A-Za-z0-9:._+-]*|system:deb:debian:\*)$/,150),name:OSV_NAME}),1,200) }),
|
|
@@ -115,11 +127,14 @@ const RESOURCES = {
|
|
|
115
127
|
"hashid/depsdev-sha1": T.obj({ base64: T.str(/^[A-Za-z0-9+/]{27}=$/, 28) }),
|
|
116
128
|
"hashid/circl-sha256": T.obj({ sha256: T.str(/^[0-9a-fA-F]{64}$/, 64) }),
|
|
117
129
|
"wordfence/production-feed": NONE,
|
|
130
|
+
"wpvulnerability/advisories": T.obj({kind:T.oneOf(["core","plugin","theme"]),subject:T.str(/^[a-z0-9][a-z0-9._-]*$/,200)}),
|
|
118
131
|
"wordfence/software": T.obj({ software: T.arr(T.obj({ type: T.oneOf(["core", "plugin", "theme"]),
|
|
119
132
|
slug: T.str(/^[a-z0-9][a-z0-9._-]*$/, 200) }), 1, 100) }),
|
|
133
|
+
"wordpress/extension": T.obj({kind:T.oneOf(["plugin","theme"]),slug:T.str(/^[a-z0-9][a-z0-9._-]*$/,200)}),
|
|
134
|
+
"drupal/extension": T.obj({name:T.str(/^drupal\/[a-z0-9][a-z0-9_-]*$/,206)}),
|
|
120
135
|
"wordpress/checksums": T.obj({ version: T.str(/^\d+(\.\d+){1,3}$/, 20), locale: T.str(/^[a-z]{2,3}(_[A-Z]{2})?$/, 10) }),
|
|
121
136
|
"drupal/advisories": T.obj({ packages: T.arr(T.str(/^drupal\/[a-z0-9_]+$/, 100), 1, 100) }),
|
|
122
|
-
"osvdb/ecosystem-archive": T.obj({ ecosystem: T.oneOf([...OSV_ECOS, "Debian", "Ubuntu", "Alpine", "AlmaLinux", "Rocky Linux", "Red Hat", "SUSE", "openSUSE"]) }),
|
|
137
|
+
"osvdb/ecosystem-archive": T.obj({ ecosystem: T.oneOf([...OSV_ECOS, "Debian", "Ubuntu", "Alpine", "AlmaLinux", "Rocky Linux", "Red Hat", "SUSE", "openSUSE", "Mageia", "Azure Linux", "openEuler"]) }),
|
|
123
138
|
"retire/signatures": NONE,
|
|
124
139
|
"euvd/cve-mapping": NONE,
|
|
125
140
|
"euvd/cves": T.obj({ ids: T.arr(CVE, 1, 100) }),
|
|
@@ -152,7 +167,7 @@ function validateResource(body) {
|
|
|
152
167
|
const schema = RESOURCES[`${body.provider}/${body.type}`];
|
|
153
168
|
if (!schema) throw new ValidationError(`unknown resource ${String(body.provider).slice(0, 40)}/${String(body.type).slice(0, 40)}`, "type");
|
|
154
169
|
if (body.revalidate !== undefined && typeof body.revalidate !== 'boolean') throw new ValidationError('revalidate: boolean expected', 'revalidate');
|
|
155
|
-
if (body.revalidate && !require('
|
|
170
|
+
if (body.revalidate && !require('../../providers').getProvider(body.provider).revalidateTypes?.includes(body.type)) throw new ValidationError('revalidate: unsupported resource', 'revalidate');
|
|
156
171
|
const params = schema(body.params === undefined ? {} : body.params, "params");
|
|
157
172
|
let headers = {};
|
|
158
173
|
if (body.headers !== undefined) {
|
|
@@ -17,13 +17,15 @@ function nodeDatabase() {
|
|
|
17
17
|
} finally { process.emitWarning = emitWarning; }
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function openSqlite(file, {readonly = false} = {}) {
|
|
21
|
-
if (file !== ':memory:') fs.mkdirSync(path.dirname(file), {recursive:true, mode:0o700});
|
|
20
|
+
function openSqlite(file, {readonly = false, immutable = false} = {}) {
|
|
21
|
+
if (!immutable && file !== ':memory:') fs.mkdirSync(path.dirname(file), {recursive:true, mode:0o700});
|
|
22
|
+
const input = immutable ? require('node:url').pathToFileURL(file).href + '?immutable=1&mode=ro' : file;
|
|
23
|
+
// Bun needs SQLite's READONLY | URI flags to interpret an immutable URI.
|
|
22
24
|
const db = typeof Bun !== 'undefined'
|
|
23
|
-
? new (require('bun:sqlite').Database)(
|
|
24
|
-
: new (nodeDatabase())(
|
|
25
|
+
? new (require('bun:sqlite').Database)(input, immutable ? 0x01 | 0x40 : {readonly, create:!readonly})
|
|
26
|
+
: new (nodeDatabase())(input, {readOnly:readonly || immutable});
|
|
25
27
|
db.exec('PRAGMA foreign_keys=ON; PRAGMA busy_timeout=5000;');
|
|
26
|
-
if (!readonly) db.exec('PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL;');
|
|
28
|
+
if (!readonly && !immutable) db.exec('PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL;');
|
|
27
29
|
const statements=new Map();
|
|
28
30
|
const prepared=new Set();
|
|
29
31
|
const prepare = sql => {
|
package/lib/certs/scan.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* lib/certs/scan.js — walk a source tree for committed crypto material.
|
|
3
3
|
*
|
|
4
|
-
* Reuses the shared prune policy (lib/path-filter) so the cert scan honours the
|
|
4
|
+
* Reuses the shared prune policy (lib/inventory/path-filter) so the cert scan honours the
|
|
5
5
|
* same --exclude-path / --no-default-excludes rules as every other walker. Each
|
|
6
6
|
* candidate file (sniff.js) is read, hashed (sha256), and handed to analyze.js;
|
|
7
7
|
* the resulting items are returned flat. Pure I/O wrapper — no network, ever.
|
|
@@ -23,6 +23,19 @@ const SKIP = new Set([
|
|
|
23
23
|
|
|
24
24
|
const MAX_FILE = 8 * 1024 * 1024; // crypto material is small; skip anything huge
|
|
25
25
|
|
|
26
|
+
function inspectCertificateFile(file, name, evidencePath, { now = Date.now(), expiryDays = 90, onProgress } = {}) {
|
|
27
|
+
const stat = fs.lstatSync(file);
|
|
28
|
+
if (!stat.isFile() || stat.size === 0 || stat.size > MAX_FILE) return [];
|
|
29
|
+
const buf = fs.readFileSync(file);
|
|
30
|
+
onProgress?.(file);
|
|
31
|
+
const items = analyzeBuffer({name, path:evidencePath, buf, now, expiryDays});
|
|
32
|
+
if (items.length) {
|
|
33
|
+
const sha256 = crypto.createHash("sha256").update(buf).digest("hex");
|
|
34
|
+
for (const item of items) item.sha256 = sha256;
|
|
35
|
+
}
|
|
36
|
+
return items;
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
/**
|
|
27
40
|
* Walk `dir`, return a flat array of cert/key/keystore items (analyze.js shape),
|
|
28
41
|
* each stamped with `sha256` of the file.
|
|
@@ -31,7 +44,7 @@ const MAX_FILE = 8 * 1024 * 1024; // crypto material is small; skip anything h
|
|
|
31
44
|
*/
|
|
32
45
|
function scanCertificates(dir, opts = {}) {
|
|
33
46
|
if (!dir) return [];
|
|
34
|
-
const { makeDirFilter } = require("../path-filter");
|
|
47
|
+
const { makeDirFilter } = require("../inventory/path-filter");
|
|
35
48
|
const skipDir = makeDirFilter({
|
|
36
49
|
srcRoot: opts.srcRoot || dir, defaultSkip: SKIP,
|
|
37
50
|
excludePath: opts.excludePath, useDefaults: opts.defaultExcludes !== false,
|
|
@@ -48,14 +61,7 @@ function scanCertificates(dir, opts = {}) {
|
|
|
48
61
|
if (e.isDirectory()) { if (!skipDir(fp, e.name)) stack.push(fp); continue; }
|
|
49
62
|
if (!e.isFile()) continue;
|
|
50
63
|
if (!isCandidate(e.name)) continue;
|
|
51
|
-
|
|
52
|
-
if (st.size > MAX_FILE || st.size === 0) continue;
|
|
53
|
-
let buf; try { buf = fs.readFileSync(fp); } catch { continue; }
|
|
54
|
-
if (opts.onProgress) opts.onProgress(fp);
|
|
55
|
-
const items = analyzeBuffer({ name: e.name, path: fp, buf, now, expiryDays });
|
|
56
|
-
if (!items.length) continue;
|
|
57
|
-
const sha256 = crypto.createHash("sha256").update(buf).digest("hex");
|
|
58
|
-
for (const it of items) { it.sha256 = sha256; out.push(it); }
|
|
64
|
+
try { out.push(...inspectCertificateFile(fp, e.name, fp, { now, expiryDays, onProgress:opts.onProgress })); } catch { continue; }
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
// Worst severity first, then path — matches the report's priority-led ordering.
|
|
@@ -64,4 +70,4 @@ function scanCertificates(dir, opts = {}) {
|
|
|
64
70
|
return out;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
module.exports = { scanCertificates, SKIP };
|
|
73
|
+
module.exports = { scanCertificates, inspectCertificateFile, SKIP };
|