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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/unmanaged.js — enrich unmanaged (hash-bearing) records with online identity
|
|
2
|
+
* lib/inventory/unmanaged.js — enrich unmanaged (hash-bearing) records with online identity
|
|
3
3
|
* + an integrity classification.
|
|
4
4
|
*
|
|
5
5
|
* integrity:
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
* @author: N.BRAUN
|
|
15
15
|
* @email: pp9ping@gmail.com
|
|
16
16
|
*/
|
|
17
|
-
const { lookupHash, loadCache, saveCache } = require("
|
|
17
|
+
const { lookupHash, loadCache, saveCache } = require("../providers/hashid/identify");
|
|
18
18
|
|
|
19
19
|
async function enrichUnmanaged(resolved, opts = {}) {
|
|
20
20
|
const { fetcher, offline = false, cache, onProgress } = opts;
|
|
21
|
-
|
|
21
|
+
// Image/system components are identified by their scoped inventory. Never
|
|
22
|
+
// submit their executables to the source-project hash-identification pass.
|
|
23
|
+
const targets = [...resolved.values()].filter(d => !d.artifactTargetId && d.hashes && (d.hashes.sha1 || d.hashes.sha256));
|
|
22
24
|
const summary = { total: targets.length, identified: 0, pristine: 0, knownGood: 0, unknown: 0, malicious: 0 };
|
|
23
25
|
if (!targets.length) return summary;
|
|
24
26
|
const entries = cache || loadCache({ offline });
|
|
@@ -63,6 +65,7 @@ function buildInventory(resolved) {
|
|
|
63
65
|
if (!d.hashes || !(d.provenance === "binary" || d.provenance === "embedded") || (d.artifactTargetId && d.osPackageOwners?.length)) continue;
|
|
64
66
|
const identity = d.identity || null;
|
|
65
67
|
out.push({
|
|
68
|
+
...(d.artifactTargetId ? {artifactTargetId:d.artifactTargetId} : {}),
|
|
66
69
|
path: d.manifestPaths?.[0] || d.declaredName || null,
|
|
67
70
|
declaredName: d.declaredName || d.name || null,
|
|
68
71
|
provenance: d.provenance,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/commercial-support.js — paid support past the open-source end of life.
|
|
2
|
+
* lib/maintenance/commercial-support.js — paid support past the open-source end of life.
|
|
3
3
|
*
|
|
4
4
|
* endoflife.date's `extendedSupport` says a vendor sells fixes for a cycle whose open-source
|
|
5
5
|
* life is over (Broadcom for Spring 5.3 until 2029…). Those fixes are not on Maven Central:
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* Maven only: the vendor builds this can prove are Maven coordinates; HeroDevs-style
|
|
25
25
|
* replacements publish under other names that no public registry lists.
|
|
26
26
|
*/
|
|
27
|
-
const { fetchMetadataVersions } = require("
|
|
28
|
-
const { compareMavenVersions, stricterBranchFix } = require("
|
|
27
|
+
const { fetchMetadataVersions } = require("../codecs/maven/transitive");
|
|
28
|
+
const { compareMavenVersions, stricterBranchFix } = require("../codecs/maven/version");
|
|
29
29
|
|
|
30
30
|
const fixVersion = f => (f ? f.fixed || f.after : null);
|
|
31
31
|
/** Does `version` satisfy the branch fix? */
|
|
@@ -47,12 +47,12 @@ function findingCoords(e) {
|
|
|
47
47
|
/**
|
|
48
48
|
* Annotate EOL findings in place. → { commercialBuilds: [finding…] } (also flagged
|
|
49
49
|
* `status: "commercial"` on the finding, for the caller to move out of the EOL list).
|
|
50
|
-
* opts: offline, repos (lib/maven
|
|
50
|
+
* opts: offline, repos (lib/providers/maven/repo list incl. configured ones), fetcher, cacheDir.
|
|
51
51
|
*/
|
|
52
52
|
async function annotateCommercialSupport(eolResults, matches, opts = {}) {
|
|
53
53
|
const commercialBuilds = [];
|
|
54
54
|
// Configured repositories only — Maven Central and its mirrors (`central: true`) list exactly Central.
|
|
55
|
-
const vendorRepos = (opts.repos || []).filter(r => r && typeof r === "object" && !r.central && !/repo1\.maven\.org|repo\.maven\.apache\.org/i.test(String(r.url)));
|
|
55
|
+
const vendorRepos = (opts.repos || []).filter(r => r && typeof r === "object" && !r.central && r.url!==require('../providers/maven/repo').GOOGLE_MAVEN.url && !/repo1\.maven\.org|repo\.maven\.apache\.org/i.test(String(r.url)));
|
|
56
56
|
for (const e of eolResults || []) {
|
|
57
57
|
if (!e.extendedSupport || e.status === "ok") continue;
|
|
58
58
|
const coords = findingCoords(e);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/outdated.js — EOL, obsolete, and outdated dependency checks.
|
|
2
|
+
* lib/maintenance/outdated.js — EOL, obsolete, and outdated dependency checks.
|
|
3
3
|
*
|
|
4
4
|
* EOL data comes from endoflife.date (with on-disk cache).
|
|
5
5
|
* Obsolete data is curated locally (data/known-obsolete.json).
|
|
@@ -11,39 +11,39 @@
|
|
|
11
11
|
const fs = require("fs");
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const os = require("os");
|
|
14
|
-
const { compareMavenVersions, latestStableVersion } = require("
|
|
15
|
-
const { webjarToNpm } = require("
|
|
14
|
+
const { compareMavenVersions, latestStableVersion } = require("../codecs/maven/version");
|
|
15
|
+
const { webjarToNpm } = require("../codecs/npm/collect");
|
|
16
16
|
|
|
17
|
-
const KNOWN_OBSOLETE = require("
|
|
18
|
-
const EOL_MAPPING = require("
|
|
17
|
+
const KNOWN_OBSOLETE = require("../../data/known-obsolete.json");
|
|
18
|
+
const EOL_MAPPING = require("../../data/eol-mapping.json");
|
|
19
19
|
|
|
20
20
|
// Generated by scripts/gen-composer-eol-map.js — Composer packages versioned in lockstep with
|
|
21
21
|
// their framework (the monorepo's `replace: self.version` table). A package on its own version
|
|
22
22
|
// line (monolog-bundle, *-contracts, polyfill-*, flex …) is deliberately ABSENT: mapping it to
|
|
23
23
|
// the framework's endoflife cycles would be a false positive.
|
|
24
|
-
const COMPOSER_FRAMEWORKS = require("
|
|
24
|
+
const COMPOSER_FRAMEWORKS = require("../../data/eol-composer-frameworks.json");
|
|
25
25
|
const COMPOSER_FRAMEWORK_OF = new Map();
|
|
26
26
|
for (const [id, fw] of Object.entries(COMPOSER_FRAMEWORKS)) {
|
|
27
27
|
for (const name of fw.components || []) COMPOSER_FRAMEWORK_OF.set(String(name).toLowerCase(), id);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const CACHE_DIR = path.join(require("
|
|
30
|
+
const CACHE_DIR = path.join(require("../cache/directory").getCacheDir());
|
|
31
31
|
const EOL_CACHE_PATH = path.join(CACHE_DIR, "eol-cache.json");
|
|
32
32
|
const VERSION_CACHE_PATH = path.join(CACHE_DIR, "version-cache.json");
|
|
33
33
|
const EOL_CACHE_MAX_AGE_MS = 4 * 3600 * 1000; // 4 hours
|
|
34
34
|
const VERSION_CACHE_MAX_AGE_MS = 4 * 3600 * 1000; // 4 hours
|
|
35
35
|
|
|
36
36
|
function loadJsonCache(file) {
|
|
37
|
-
return require('
|
|
37
|
+
return require('../cache/json').load(CACHE_DIR,path.basename(file),{ meta: { fetchedAt: 0 }, entries: {} });
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function saveJsonCache(file, data) {
|
|
41
|
-
require('
|
|
41
|
+
require('../cache/json').save(CACHE_DIR,path.basename(file),data);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function isEolCacheFresh(maxAge = EOL_CACHE_MAX_AGE_MS) {
|
|
45
45
|
const c = loadJsonCache(EOL_CACHE_PATH);
|
|
46
|
-
return c.meta?.fetchedAt && require('
|
|
46
|
+
return c.meta?.fetchedAt && require('../cache/policy').fresh(c.meta.fetchedAt, maxAge);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// -------- EOL via endoflife.date --------
|
|
@@ -116,7 +116,7 @@ function findEolProduct(dep) {
|
|
|
116
116
|
// a legacy file (global stamp only) is normalised by normalizeEolCache() at load time.
|
|
117
117
|
function eolEntryFresh(cache, product, now = Date.now()) {
|
|
118
118
|
const ts = cache.fetchedAt?.[product] ?? cache.meta?.fetchedAt ?? 0;
|
|
119
|
-
return ts > 0 && require('
|
|
119
|
+
return ts > 0 && require('../cache/policy').fresh(ts, EOL_CACHE_MAX_AGE_MS, now);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -156,10 +156,10 @@ async function fetchEndoflife(product, cache, opts = {}) {
|
|
|
156
156
|
const cached = cache.entries[product];
|
|
157
157
|
const usable = Array.isArray(cached);
|
|
158
158
|
if (offline) return usable ? cached : null;
|
|
159
|
-
const strictHosted = require("
|
|
159
|
+
const strictHosted = require("../providers").hasHostedProxy();
|
|
160
160
|
if (!strictHosted && usable && eolEntryFresh(cache, product, now)) return cached;
|
|
161
161
|
try {
|
|
162
|
-
const res = await require("
|
|
162
|
+
const res = await require("../providers").getResource("eol", "product", { product },
|
|
163
163
|
{ fetcher, headers: { "User-Agent": "vigievuln-eol-checker" } });
|
|
164
164
|
if (!res.ok) {
|
|
165
165
|
if (usable && !strictHosted) return cached;
|
|
@@ -312,9 +312,9 @@ async function checkEolDeps(resolvedDeps, opts = {}) {
|
|
|
312
312
|
const frameworkHits = []; // Composer framework components → grouped per (framework, manifest, cycle)
|
|
313
313
|
|
|
314
314
|
for (const dep of resolvedDeps.values()) {
|
|
315
|
-
const product = findEolProduct(dep);
|
|
315
|
+
const product = (opts.productFor || findEolProduct)(dep);
|
|
316
316
|
if (!product) continue;
|
|
317
|
-
const dedupeKey = `${dep.groupId}:${dep.artifactId}|${product.product}`;
|
|
317
|
+
const dedupeKey = opts.productFor ? dep : `${dep.groupId}:${dep.artifactId}|${product.product}`;
|
|
318
318
|
if (seen.has(dedupeKey)) continue;
|
|
319
319
|
seen.add(dedupeKey);
|
|
320
320
|
|
|
@@ -512,7 +512,7 @@ function pomLastModifiedRepos(repos) {
|
|
|
512
512
|
|
|
513
513
|
async function pomLastModified(repos, groupId, artifactId, version, opts = {}) {
|
|
514
514
|
try {
|
|
515
|
-
const { tryRepos } = require("
|
|
515
|
+
const { tryRepos } = require("../providers/maven/repo");
|
|
516
516
|
const p = `${groupId.replace(/\./g, "/")}/${artifactId}/${version}/${artifactId}-${version}.pom`;
|
|
517
517
|
// Central and private repositories only — NOT the mirror rotation. maven-metadata.xml is
|
|
518
518
|
// a small, constantly re-requested file that the mirrors serve hot; an individual .pom is
|
|
@@ -552,7 +552,7 @@ async function fetchLatestVersion(groupId, artifactId, cache, opts = {}) {
|
|
|
552
552
|
|
|
553
553
|
if (Array.isArray(opts.repos) && opts.repos.length) {
|
|
554
554
|
try {
|
|
555
|
-
const { fetchMavenMetadata } = require("
|
|
555
|
+
const { fetchMavenMetadata } = require("../providers/maven/repo");
|
|
556
556
|
const hit = await fetchMavenMetadata(opts.repos, groupId, artifactId, {
|
|
557
557
|
userAgent: "vigievuln-outdated-checker", health: opts.health,
|
|
558
558
|
});
|
|
@@ -576,7 +576,7 @@ async function fetchLatestVersion(groupId, artifactId, cache, opts = {}) {
|
|
|
576
576
|
|
|
577
577
|
try {
|
|
578
578
|
const url = `https://search.maven.org/solrsearch/select?q=g:%22${encodeURIComponent(groupId)}%22+AND+a:%22${encodeURIComponent(artifactId)}%22&core=gav&rows=1&wt=json`;
|
|
579
|
-
const res = await require("
|
|
579
|
+
const res = await require("../providers").getResource("maven", "latest", { group: groupId, artifact: artifactId },
|
|
580
580
|
{ headers: { "User-Agent": "vigievuln-outdated-checker" } });
|
|
581
581
|
if (res.ok) {
|
|
582
582
|
const doc = (await res.json())?.response?.docs?.[0];
|
|
@@ -614,7 +614,7 @@ function parseMavenMetadataLatest(xml) {
|
|
|
614
614
|
async function checkOutdatedDeps(resolvedDeps, opts = {}) {
|
|
615
615
|
const { verbose, offline, concurrency = 8, repos, onProgress } = opts;
|
|
616
616
|
const cache = loadJsonCache(VERSION_CACHE_PATH);
|
|
617
|
-
const fresh = !require("
|
|
617
|
+
const fresh = !require("../providers").hasHostedProxy() && cache.meta?.fetchedAt && require('../cache/policy').fresh(cache.meta.fetchedAt, VERSION_CACHE_MAX_AGE_MS);
|
|
618
618
|
const previous = !fresh && !offline ? {entries:cache.entries, fetchedAt:cache.meta?.fetchedAt} : null;
|
|
619
619
|
if (!fresh && !offline) cache.entries = {};
|
|
620
620
|
// Maven Central only — npm/composer/pypi/nuget have their own registries (codec.checkRegistry).
|
|
@@ -672,7 +672,7 @@ async function checkOutdatedDeps(resolvedDeps, opts = {}) {
|
|
|
672
672
|
if (!fresh) cache.meta = { fetchedAt: Date.now() };
|
|
673
673
|
// Hosted responses must be refreshed on the next online run, but the
|
|
674
674
|
// successful answers still belong in an exported air-gapped cache.
|
|
675
|
-
require('
|
|
675
|
+
require('../cache/policy').preserveEntries(cache, previous); saveJsonCache(VERSION_CACHE_PATH, cache);
|
|
676
676
|
}
|
|
677
677
|
results.sort((a, b) => `${a.dep.groupId}:${a.dep.artifactId}`.localeCompare(`${b.dep.groupId}:${b.dep.artifactId}`));
|
|
678
678
|
return results;
|
package/lib/options-env.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Layers (highest → lowest): CLI flags > explicitly selected config file (--config,
|
|
5
5
|
* JSON) > FAD_CHECKER_ENV (a CLI-flag string) > global ~/.fad-checker/config.json
|
|
6
6
|
* > commander defaults. Scalar options follow precedence; `registries` are unioned
|
|
7
|
-
* elsewhere (lib/registries.js). The source flag has aliases (src/source).
|
|
7
|
+
* elsewhere (lib/providers/registries.js). The source flag has aliases (src/source).
|
|
8
8
|
*
|
|
9
9
|
* @author: N.BRAUN
|
|
10
10
|
* @email: pp9ping@gmail.com
|
|
@@ -2,38 +2,58 @@
|
|
|
2
2
|
// Alpine's tracker combines CPE rules and distro fix data. Its `fixed:false`
|
|
3
3
|
// rows are *possibly vulnerable*, not an Alpine affected verdict.
|
|
4
4
|
const crypto=require('node:crypto');
|
|
5
|
-
const {createCacheRepository}=require('
|
|
6
|
-
const {getCacheDir}=require('
|
|
5
|
+
const {createCacheRepository}=require('../../cache/repository');
|
|
6
|
+
const {getCacheDir}=require('../../cache/directory');
|
|
7
7
|
const ORIGIN='https://security.alpinelinux.org';
|
|
8
8
|
const CVE=/^CVE-\d{4}-\d{4,}$/;
|
|
9
9
|
function key(kind,id){return `alpine-tracker-${kind}-${crypto.createHash('sha256').update(id).digest('hex')}`;}
|
|
10
10
|
function branch(distribution){const m=/^(\d+)\.(\d+)(?:\.\d+)?$/.exec(distribution?.versionId||'');return distribution?.id==='alpine'&&m?`${m[1]}.${m[2]}`:null;}
|
|
11
11
|
function packageUrl(name,version){if(!/^[a-z0-9][a-z0-9+_.-]*$/.test(name)||!/^[A-Za-z0-9][A-Za-z0-9+_.~-]*$/.test(version))throw Error('invalid Alpine source package identity');return `${ORIGIN}/srcpkg/${encodeURIComponent(name)}/${encodeURIComponent(version)}`;}
|
|
12
12
|
function cveId(url){try{const u=new URL(url);if(u.origin!==ORIGIN)return null;const m=/^\/vuln\/(CVE-\d{4}-\d{4,})$/.exec(u.pathname);return m?.[1]||null;}catch{return null;}}
|
|
13
|
+
// Tracker package indexes include historical rules for every release. Discard a
|
|
14
|
+
// rule only when a literal numeric bound excludes the installed upstream version.
|
|
15
|
+
// Complex upstream version schemes still need the tracker record.
|
|
16
|
+
function mayMatchRule(rule, sourceVersion) {
|
|
17
|
+
const version = sourceVersion.replace(/-r\d+$/, '');
|
|
18
|
+
const numeric = /^\d{1,9}(?:\.\d{1,9}){0,6}$/;
|
|
19
|
+
if (!numeric.test(version)) return true;
|
|
20
|
+
for (const side of ['minimumVersion', 'maximumVersion']) {
|
|
21
|
+
const bound = rule[side], op = rule[side+'Op'];
|
|
22
|
+
if (!numeric.test(bound) || !['==','<','<=','>','>='].includes(op)) continue;
|
|
23
|
+
const parts=version.split('.').map(Number), other=bound.split('.').map(Number);
|
|
24
|
+
// Equal prefixes with different lengths can have product-specific semantics.
|
|
25
|
+
let diff=0;
|
|
26
|
+
for (let i=0; i<Math.min(parts.length,other.length) && !diff; i++) diff=parts[i]-other[i];
|
|
27
|
+
if (!diff && parts.length!==other.length) continue;
|
|
28
|
+
if ((op==='==' && diff!==0) || (op==='<' && diff>=0) || (op==='<=' && diff>0) ||
|
|
29
|
+
(op==='>' && diff<=0) || (op==='>=' && diff<0)) return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
13
33
|
async function boundedJson(response,maxBytes){if(!response.body)throw Error('empty Alpine tracker response');const chunks=[];let n=0;for await(const chunk of response.body){n+=chunk.length;if(n>maxBytes)throw Error('Alpine tracker response exceeds configured limit');chunks.push(Buffer.from(chunk));}return JSON.parse(Buffer.concat(chunks).toString('utf8'));}
|
|
14
34
|
async function assessAlpineTracker(packages,distribution,options={}){
|
|
15
35
|
const release=branch(distribution);if(!release)return {observations:[],coverage:{source:'alpine-tracker',execution:'not-applicable',reason:'Alpine release identity is unavailable.'},diagnostics:[]};
|
|
16
36
|
const repo=options.cacheRepository||createCacheRepository(options.cacheDir||getCacheDir()),ttl=options.ttlMs??86400000,maxBytes=options.maxBytes??8*1024*1024,maxCves=options.maxCves??1000,concurrency=options.concurrency??6;
|
|
17
37
|
if(![ttl,maxBytes,maxCves,concurrency].every(v=>Number.isSafeInteger(v)&&v>0))throw Error('invalid Alpine tracker limits');
|
|
18
38
|
const groups=new Map(),diagnostics=[],observations=[],memo=new Map(),limit=require('p-limit')(concurrency);let unscoped=0;
|
|
19
|
-
for(const p of packages||[]){if(p.manager!=='apk')continue;if(!p.sourceName||!p.sourceVersion){unscoped++;continue;}try{packageUrl(p.sourceName,p.sourceVersion);}catch{unscoped++;continue;}const id=JSON.stringify([p.sourceName,p.sourceVersion]);if(!groups.has(id))groups.set(id,{name:p.sourceName,version:p.sourceVersion,packages:[]});groups.get(id).packages.push(p.name);}
|
|
39
|
+
for(const p of packages||[]){if(p.manager!=='apk' || p.packageMetadata?.virtual)continue;if(!p.sourceName||!p.sourceVersion){unscoped++;continue;}try{packageUrl(p.sourceName,p.sourceVersion);}catch{unscoped++;continue;}const id=JSON.stringify([p.sourceName,p.sourceVersion]);if(!groups.has(id))groups.set(id,{name:p.sourceName,version:p.sourceVersion,packages:[]});groups.get(id).packages.push(p.name);}
|
|
20
40
|
async function get(kind,id,url){const memoKey=kind+':'+id;if(memo.has(memoKey))return memo.get(memoKey);
|
|
21
41
|
const promise=limit(async()=>{const k=key(kind,id),cached=repo.get('catalogue',k)?.value,age=Date.now()-(cached?.fetchedAt||0);
|
|
22
42
|
if(options.offline){if(cached?.document)return cached;throw Error('Alpine tracker observation is not cached');}
|
|
23
43
|
if(cached?.document&&!cached.stale&&age>=0&&age<ttl)return cached;
|
|
24
44
|
const signal=options.signal?AbortSignal.any([options.signal,AbortSignal.timeout(options.timeoutMs??30000)]):AbortSignal.timeout(options.timeoutMs??30000);
|
|
25
45
|
const type=kind==='package'?'package':'vulnerability',params=kind==='package'?{name:id}:{id};
|
|
26
|
-
const response=await require('
|
|
46
|
+
const response=await require('..').getResource('alpine',type,params,{fetcher:options.fetcher,signal,streaming:true,noStore:true});
|
|
27
47
|
if(!response.ok){await response.body?.cancel();throw Object.assign(Error(`Alpine tracker HTTP ${response.status}`),{status:response.status});}
|
|
28
48
|
const document=await boundedJson(response,maxBytes);
|
|
29
49
|
if(document?.id!==url||!Array.isArray(kind==='package'?document.cpeMatch:document.state))throw Error('invalid Alpine tracker response');
|
|
30
|
-
const proxy=require('
|
|
50
|
+
const proxy=require('..').hasProxyRoute(),stamp=Date.parse(response.headers?.get?.('x-fad-proxy-fetched-at')||''),valid=Number.isFinite(stamp)&&stamp>0&&stamp<=Date.now()+300000;
|
|
31
51
|
const entry={document,fetchedAt:proxy?(valid?stamp:Date.now()):Date.now(),stale:proxy&&(!valid||response.headers?.get?.('x-fad-proxy')==='stale'),url};repo.put('catalogue',k,entry);return entry;
|
|
32
52
|
});memo.set(memoKey,promise);return promise;
|
|
33
53
|
}
|
|
34
54
|
const indexes=await Promise.all([...groups.values()].map(async group=>{const sourceUrl=`${ORIGIN}/srcpkg/${encodeURIComponent(group.name)}`;try{const index=await get('package',group.name,sourceUrl);if(index.document?.id!==sourceUrl||!Array.isArray(index.document.cpeMatch))throw Error('invalid Alpine package index');return {group,sourceUrl,index};}catch(error){diagnostics.push({source:'alpine-tracker',code:error.status===404?'record-not-listed':options.offline?'cache-missing':'source-request-failed',reason:error.status===404?'No entry published by the Alpine tracker (HTTP 404); this does not establish absence of vulnerabilities.':error.message,resources:[sourceUrl]});return null;}}));
|
|
35
55
|
const work=[];let truncated=false;
|
|
36
|
-
for(const index of indexes.filter(Boolean)){const {group,sourceUrl}=index,ids=[...new Set(index.index.document.cpeMatch.filter(m=>m.package===sourceUrl).map(m=>cveId(m.vuln)).filter(Boolean))];for(const id of ids){if(work.length>=maxCves){truncated=true;break;}work.push({...index,id});}}
|
|
56
|
+
for(const index of indexes.filter(Boolean)){const {group,sourceUrl}=index,ids=[...new Set(index.index.document.cpeMatch.filter(m=>m.package===sourceUrl && mayMatchRule(m,group.version)).map(m=>cveId(m.vuln)).filter(Boolean))];for(const id of ids){if(work.length>=maxCves){truncated=true;break;}work.push({...index,id});}}
|
|
37
57
|
await Promise.all(work.map(async({group,sourceUrl,index,id})=>{const url=`${ORIGIN}/vuln/${id}`;let entry;try{entry=await get('vulnerability',id,url);if(entry.document?.id!==url||!Array.isArray(entry.document.state))throw Error('invalid Alpine vulnerability record');}catch(error){diagnostics.push({source:'alpine-tracker',code:error.status===404?'record-not-listed':options.offline?'cache-missing':'source-request-failed',reason:error.status===404?'No entry published by the Alpine tracker (HTTP 404); this does not establish absence of vulnerabilities.':error.message,resources:[url]});return;}
|
|
38
58
|
const expectedVersion=packageUrl(group.name,group.version),states=entry.document.state.filter(s=>s.packageVersion===expectedVersion&&typeof s.repo==='string'&&s.repo.startsWith(`${release}-`)&&typeof s.fixed==='boolean');
|
|
39
59
|
const scoped=options.alpineRepository?states.filter(s=>s.repo===`${release}-${options.alpineRepository}`):states,statuses=new Set(scoped.map(s=>s.fixed?'fixed':'possible')),status=statuses.size===1?[...statuses][0]:'unknown';
|
|
@@ -42,6 +62,6 @@ async function assessAlpineTracker(packages,distribution,options={}){
|
|
|
42
62
|
observations.sort((a,b)=>a.sourceName.localeCompare(b.sourceName)||a.id.localeCompare(b.id));
|
|
43
63
|
if(truncated)diagnostics.push({source:'alpine-tracker',code:'request-limit',reason:`Alpine tracker candidate limit ${maxCves} reached.`,resources:[]});
|
|
44
64
|
const notListed=diagnostics.filter(d=>d.code==='record-not-listed').length,missing=diagnostics.filter(d=>!['request-limit','record-not-listed'].includes(d.code)).length,stale=observations.filter(o=>o.stale).length,incomplete=!!(missing||truncated||unscoped||stale);
|
|
45
|
-
return {observations,coverage:{source:'alpine-tracker',execution:incomplete?'partial':'completed',result:incomplete?'indeterminate':'consulted',scope:'cpe-candidates',...(!missing&&!truncated&&!stale?{affectsCompleteness:false}:{}),notListed,packages:groups.size,candidates:work.length,missing,unscoped,stale,reason:incomplete?'
|
|
65
|
+
return {observations,coverage:{source:'alpine-tracker',execution:incomplete?'partial':'completed',result:incomplete?'indeterminate':'consulted',scope:'cpe-candidates',...(!missing&&!truncated&&!stale?{affectsCompleteness:false}:{}),notListed,packages:groups.size,candidates:work.length,missing,unscoped,stale,reason:incomplete?[missing && missing+' tracker requests failed',truncated && 'candidate budget reached',unscoped && unscoped+' package identities outside the tracker namespace',stale && stale+' stale observations'].filter(Boolean).join(', '):'Consulted Alpine tracker rules for the installed source versions.'},diagnostics};
|
|
46
66
|
}
|
|
47
67
|
module.exports={assessAlpineTracker};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/certfr.js — link matched CVEs to the CERT-FR (ANSSI) advisories that cite them.
|
|
2
|
+
* lib/providers/certfr/enrich.js — link matched CVEs to the CERT-FR (ANSSI) advisories that cite them.
|
|
3
3
|
*
|
|
4
4
|
* CERT-FR publishes every "avis" (advisory) and "alerte" (alert) as JSON, each listing
|
|
5
5
|
* the CVEs it covers — but offers no CVE → advisory lookup. So fad keeps a LOCAL index:
|
|
@@ -20,7 +20,7 @@ const fs = require("fs");
|
|
|
20
20
|
const path = require("path");
|
|
21
21
|
const os = require("os");
|
|
22
22
|
|
|
23
|
-
const DEFAULT_CACHE_DIR = path.join(require("
|
|
23
|
+
const DEFAULT_CACHE_DIR = path.join(require("../../cache/directory").getCacheDir());
|
|
24
24
|
const CACHE_FILE = "certfr-cache.json";
|
|
25
25
|
const CACHE_TTL_MS = 4 * 3600 * 1000;
|
|
26
26
|
const KINDS = ["avis", "alerte"];
|
|
@@ -30,7 +30,7 @@ const cachePath = dir => path.join(dir || DEFAULT_CACHE_DIR, CACHE_FILE);
|
|
|
30
30
|
|
|
31
31
|
function readCache(dir) {
|
|
32
32
|
try {
|
|
33
|
-
const data = require('
|
|
33
|
+
const data = require('../../cache/repository').createCacheRepository(dir || DEFAULT_CACHE_DIR).get('catalogue','certfr')?.value;
|
|
34
34
|
if (data?.entries && typeof data.entries === "object") return data;
|
|
35
35
|
} catch { /* none yet */ }
|
|
36
36
|
return { meta: { fetchedAt: 0 }, entries: {} };
|
|
@@ -39,7 +39,7 @@ function readCache(dir) {
|
|
|
39
39
|
function writeCache(dir, data) {
|
|
40
40
|
if (dir === false) return; // a caller that persists the index itself (vigievuln)
|
|
41
41
|
try {
|
|
42
|
-
require('
|
|
42
|
+
require('../../cache/repository').createCacheRepository(dir || DEFAULT_CACHE_DIR).put('catalogue','certfr',data,{fetchedAt:data.meta?.fetchedAt||Date.now()});
|
|
43
43
|
} catch { /* a cache is an optimisation */ }
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -76,14 +76,14 @@ function indexByCve(entries) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
async function refresh(data, { fetcher, verbose, cacheDir, concurrency, onProgress }) {
|
|
79
|
-
const { getResource } = require("
|
|
79
|
+
const { getResource } = require("..");
|
|
80
80
|
const headers = { "User-Agent": "vigievuln-certfr" };
|
|
81
81
|
const todo = [];
|
|
82
82
|
let oldestFetchedAt = Date.now();
|
|
83
83
|
for (const kind of KINDS) {
|
|
84
84
|
const r = await getResource("certfr", "index", { kind }, { fetcher, headers });
|
|
85
85
|
if (!r.ok) throw new Error(`CERT-FR ${kind} listing HTTP ${r.status}`);
|
|
86
|
-
oldestFetchedAt = Math.min(oldestFetchedAt, require('
|
|
86
|
+
oldestFetchedAt = Math.min(oldestFetchedAt, require('../common').responseFetchedAt(r));
|
|
87
87
|
todo.push(...staleAdvisories(await r.json(), data.entries, kind));
|
|
88
88
|
}
|
|
89
89
|
let done = 0, failed = 0, next = 0;
|
|
@@ -92,7 +92,7 @@ async function refresh(data, { fetcher, verbose, cacheDir, concurrency, onProgre
|
|
|
92
92
|
const a = todo[next++];
|
|
93
93
|
try {
|
|
94
94
|
const r = await getResource("certfr", "advisory", { kind: a.kind, ref: a.ref, rev: a.rev }, { fetcher, headers });
|
|
95
|
-
oldestFetchedAt = Math.min(oldestFetchedAt, require('
|
|
95
|
+
oldestFetchedAt = Math.min(oldestFetchedAt, require('../common').responseFetchedAt(r));
|
|
96
96
|
// A 404/410 is an answer (a listed advisory without JSON): record it empty so it
|
|
97
97
|
// is not re-requested every run. Anything else is retried next time.
|
|
98
98
|
if (r.ok) data.entries[a.ref] = { kind: a.kind, rev: a.rev, title: a.title, cves: advisoryCves(await r.json()) };
|
|
@@ -124,7 +124,7 @@ async function enrichCertFr(matches, opts = {}) {
|
|
|
124
124
|
const ids = [...new Set(matches.map(m => m.cve?.id).filter(id => /^CVE-\d{4}-\d{4,7}$/.test(id || "")))];
|
|
125
125
|
const byId = new Map();
|
|
126
126
|
for (let i = 0; i < ids.length; i += 100) {
|
|
127
|
-
const res = await require("
|
|
127
|
+
const res = await require("..").getResource("certfr", "cves", { ids: ids.slice(i, i + 100) }, { fetcher, noStore: true, streaming: true });
|
|
128
128
|
if (!res.ok) throw new Error(`hosted CERT-FR unavailable (HTTP ${res.status})`);
|
|
129
129
|
const data = await res.json();
|
|
130
130
|
if (!Array.isArray(data.items)) throw new Error("invalid hosted CERT-FR response");
|
|
@@ -136,7 +136,7 @@ async function enrichCertFr(matches, opts = {}) {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
const data = readCache(cacheDir);
|
|
139
|
-
if (!offline && !require('
|
|
139
|
+
if (!offline && !require('../../cache/policy').fresh(data.meta?.fetchedAt || 0, CACHE_TTL_MS)) {
|
|
140
140
|
try { await refresh(data, { fetcher, verbose, cacheDir, concurrency, onProgress }); }
|
|
141
141
|
catch (err) { if (verbose) console.warn(` CERT-FR refresh failed: ${err.message} — using the cached index`); }
|
|
142
142
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/
|
|
2
|
+
* lib/providers/cveproject/download.js — fetch the CVEProject/cvelistV5 daily bundle and
|
|
3
3
|
* build a compact Maven-relevant index (~5-20 MB).
|
|
4
4
|
*
|
|
5
5
|
* The bundle is ~500 MB+. getResource streams it through the shared cache,
|
|
@@ -18,9 +18,9 @@ const { pipeline } = require("node:stream/promises");
|
|
|
18
18
|
const { Readable } = require("node:stream");
|
|
19
19
|
const execFileP = promisify(execFile);
|
|
20
20
|
|
|
21
|
-
const { compareMavenVersions, versionLikeBound } = require("
|
|
21
|
+
const { compareMavenVersions, versionLikeBound } = require("../../codecs/maven/version");
|
|
22
22
|
|
|
23
|
-
const CVE_DATA_DIR = path.join(require("
|
|
23
|
+
const CVE_DATA_DIR = path.join(require("../../cache/directory").getCacheDir(), "cve-data");
|
|
24
24
|
const CVE_INDEX_PATH = path.join(CVE_DATA_DIR, "maven-cve-index.json");
|
|
25
25
|
const CVE_META_PATH = path.join(CVE_DATA_DIR, "meta.json");
|
|
26
26
|
const CVE_EXTRACT_DIR = path.join(CVE_DATA_DIR, "extracted");
|
|
@@ -46,13 +46,13 @@ const KNOWN_JAVA_VENDORS = new Set([
|
|
|
46
46
|
"squareup", "okhttp",
|
|
47
47
|
]);
|
|
48
48
|
|
|
49
|
-
// Curated CPE vendor:product → Maven coord map, shared with lib/cpe.js. Used
|
|
49
|
+
// Curated CPE vendor:product → Maven coord map, shared with lib/providers/nvd/cpe.js. Used
|
|
50
50
|
// here at index-build time to retain product-only Java records as lookup
|
|
51
51
|
// candidates. Such a mapping does not establish an exact package identity.
|
|
52
52
|
let COORD_MAP_CACHE = null;
|
|
53
53
|
function coordMap() {
|
|
54
54
|
if (!COORD_MAP_CACHE) {
|
|
55
|
-
try { COORD_MAP_CACHE = require("
|
|
55
|
+
try { COORD_MAP_CACHE = require("../../../data/cpe-coord-map.json"); }
|
|
56
56
|
catch { COORD_MAP_CACHE = { byVendorProduct: {} }; }
|
|
57
57
|
}
|
|
58
58
|
return COORD_MAP_CACHE;
|
|
@@ -184,14 +184,7 @@ function extractSeverity(cveJson) {
|
|
|
184
184
|
return { severity: "UNKNOWN", score: null };
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
if (s == null) return null;
|
|
189
|
-
if (s >= 9) return "CRITICAL";
|
|
190
|
-
if (s >= 7) return "HIGH";
|
|
191
|
-
if (s >= 4) return "MEDIUM";
|
|
192
|
-
if (s > 0) return "LOW";
|
|
193
|
-
return "NONE";
|
|
194
|
-
}
|
|
187
|
+
const { severityFromScore } = require("../../findings/severity");
|
|
195
188
|
|
|
196
189
|
/**
|
|
197
190
|
* CVE 5.x `versions[]` entries may carry a `changes[]` timeline: the range
|
|
@@ -204,7 +197,7 @@ function severityFromScore(s) {
|
|
|
204
197
|
function expandVersionChanges(v) {
|
|
205
198
|
if (v.changes == null || (Array.isArray(v.changes) && !v.changes.length)) return null;
|
|
206
199
|
const changes = Array.isArray(v.changes) ? v.changes.filter(c => c && c.at) : [];
|
|
207
|
-
const cmp = require('./
|
|
200
|
+
const cmp = require('./version-verdict').comparator(v.versionType);
|
|
208
201
|
const unknown = () => [{version:'*', status:'unknown', versionType:v.versionType}];
|
|
209
202
|
if (!cmp || typeof v.version !== 'string' || (v.version !== '0' && cmp(v.version,v.version) !== 0) ||
|
|
210
203
|
!Array.isArray(v.changes) || !['affected','unaffected'].includes(String(v.status || '').toLowerCase()) ||
|
|
@@ -274,7 +267,7 @@ function extractMavenRelevantCve(json) {
|
|
|
274
267
|
const cveId = json?.cveMetadata?.cveId || json?.cve?.id;
|
|
275
268
|
if (!cveId) return null;
|
|
276
269
|
const description = extractDescription(json);
|
|
277
|
-
const {normalizeLegacySplitRanges}=require('./
|
|
270
|
+
const {normalizeLegacySplitRanges}=require('./legacy-ranges');
|
|
278
271
|
const cna = Array.isArray(json?.containers?.cna?.affected) ? json.containers.cna.affected.map(a => ({...normalizeLegacySplitRanges(a,description,json.containers.cna.x_legacyV4Record), _affectedProvider: {kind:'cna', name:json.containers.cna.providerMetadata?.shortName || null}})) : [];
|
|
279
272
|
// ADPs may provide structured package evidence that is absent from the
|
|
280
273
|
// CNA. Only ingest ADP entries with an explicit Maven coordinate; product
|
|
@@ -348,24 +341,36 @@ async function commandExists(name) {
|
|
|
348
341
|
async function fetchLatestRelease() {
|
|
349
342
|
const headers = { "User-Agent": "vigievuln-cve-downloader" };
|
|
350
343
|
if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
|
351
|
-
const res = await require("
|
|
344
|
+
const res = await require("..").getResource("github", "cve-release", {}, { headers });
|
|
352
345
|
if (!res.ok) throw new Error(`GitHub API HTTP ${res.status}`);
|
|
353
346
|
const data = await res.json();
|
|
354
|
-
const asset = data.assets?.find(a =>
|
|
355
|
-
if (!asset) throw new Error("no
|
|
347
|
+
const asset = data.assets?.find(a => /^(?:.*all[_-]cves.*|all|cves|cvelistv5)(?:\.zip)+$/i.test(a.name) && !/delta/i.test(a.name));
|
|
348
|
+
if (!asset) throw new Error("no full CVE archive on latest cvelistV5 release");
|
|
356
349
|
return { url: asset.browser_download_url, tag: data.tag_name, name: asset.name };
|
|
357
350
|
}
|
|
358
351
|
|
|
359
352
|
async function download(url, dest, opts = {}) {
|
|
360
|
-
const { tag, name } = opts;
|
|
361
|
-
const canonical = require("
|
|
362
|
-
const res = await require("
|
|
353
|
+
const { tag, name, onProgress } = opts;
|
|
354
|
+
const canonical = require("..").getProvider("github").build("cve-archive", { tag, name }).url;
|
|
355
|
+
const res = await require("..").getResource("github", "cve-archive", { tag, name }, {
|
|
363
356
|
streaming: true, ...(url === canonical ? {} : { urlOverride: url, direct: true }),
|
|
364
357
|
});
|
|
365
358
|
if (!res.ok || !res.body) throw new Error(`download HTTP ${res.status}`);
|
|
366
359
|
const tmp = dest + ".tmp-" + require("node:crypto").randomBytes(6).toString("hex");
|
|
367
360
|
try {
|
|
368
|
-
|
|
361
|
+
const source = Readable.fromWeb(res.body);
|
|
362
|
+
if (onProgress) {
|
|
363
|
+
const total = Number(res.headers.get("content-length"));
|
|
364
|
+
let bytes = 0, lastMiB = 0;
|
|
365
|
+
source.on("data", chunk => {
|
|
366
|
+
bytes += chunk.length;
|
|
367
|
+
const mib = Math.floor(bytes / 1048576);
|
|
368
|
+
if (mib <= lastMiB) return;
|
|
369
|
+
lastMiB = mib;
|
|
370
|
+
onProgress("Downloading archive", total > 0 ? `${mib}/${Math.ceil(total / 1048576)} MiB` : `${mib} MiB`);
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
await pipeline(source, fs.createWriteStream(tmp));
|
|
369
374
|
await fs.promises.rename(tmp, dest);
|
|
370
375
|
} catch (error) { await fs.promises.rm(tmp, { force: true }); throw error; }
|
|
371
376
|
}
|
|
@@ -429,11 +434,12 @@ function walkJsonFiles(dir, onFile) {
|
|
|
429
434
|
}
|
|
430
435
|
|
|
431
436
|
async function buildCveIndex(extractDir, opts = {}) {
|
|
432
|
-
const { verbose, releaseTag, cacheDir = path.dirname(CVE_DATA_DIR) } = opts;
|
|
437
|
+
const { verbose, releaseTag, cacheDir = path.dirname(CVE_DATA_DIR), onProgress } = opts;
|
|
433
438
|
const index = newIndex();
|
|
434
439
|
let processed = 0;
|
|
435
440
|
let added = 0;
|
|
436
441
|
const tick = 5000;
|
|
442
|
+
onProgress?.("Indexing CVE files");
|
|
437
443
|
walkJsonFiles(extractDir, file => {
|
|
438
444
|
processed++;
|
|
439
445
|
let json;
|
|
@@ -444,26 +450,36 @@ async function buildCveIndex(extractDir, opts = {}) {
|
|
|
444
450
|
addToIndex(index, cve);
|
|
445
451
|
added++;
|
|
446
452
|
}
|
|
447
|
-
if (
|
|
448
|
-
|
|
453
|
+
if (processed % tick === 0) {
|
|
454
|
+
onProgress?.("Indexing CVE files", `${processed} scanned`);
|
|
455
|
+
if (verbose) process.stdout.write(`\r scanned ${processed} CVE files, ${added} Maven-relevant`);
|
|
449
456
|
}
|
|
450
457
|
});
|
|
451
458
|
if (verbose) process.stdout.write(`\r scanned ${processed} CVE files, ${added} Maven-relevant\n`);
|
|
452
459
|
index.meta.builtAt = new Date().toISOString();
|
|
453
460
|
index.meta.releaseTag = releaseTag || null;
|
|
461
|
+
index.meta.fullArchive = opts.fullArchive === true;
|
|
454
462
|
index.meta.cveCount = added;
|
|
455
463
|
// Keep native records and REJECTED revisions alongside the legacy index.
|
|
456
464
|
// This incremental import cannot infer withdrawals from absent files, so its
|
|
457
465
|
// coverage is recorded as partial until a full reconciliation is available.
|
|
458
|
-
const store = require('
|
|
459
|
-
try {
|
|
466
|
+
const store = require('../../advisories/store').openAdvisoryStore({cacheDir});
|
|
467
|
+
try {
|
|
468
|
+
onProgress?.("Importing records into SQLite");
|
|
469
|
+
await require('../../advisories/native').importCveDirectory(store, extractDir, {
|
|
470
|
+
fetchedAt: Date.parse(index.meta.builtAt),
|
|
471
|
+
provenance: { transport: 'direct', releaseTag: releaseTag || null },
|
|
472
|
+
onProgress: count => onProgress?.("Importing records into SQLite", `${count} processed`),
|
|
473
|
+
});
|
|
474
|
+
}
|
|
460
475
|
finally { store.close(); }
|
|
461
|
-
|
|
476
|
+
onProgress?.("Saving index");
|
|
477
|
+
saveCveIndex(index, cacheDir);
|
|
462
478
|
return index;
|
|
463
479
|
}
|
|
464
480
|
|
|
465
481
|
function saveCveIndex(index, cacheDir = path.dirname(CVE_DATA_DIR)) {
|
|
466
|
-
const db=require('
|
|
482
|
+
const db=require('../../cache/db').getCacheDb(cacheDir);
|
|
467
483
|
const insert=db.prepare('INSERT OR IGNORE INTO cve_lookup(kind,lookup_key,source,cve,affected_key,projection_json) VALUES (?,?,?,?,?,?)');
|
|
468
484
|
const existing=db.prepare('SELECT projection_json FROM cve_lookup WHERE kind=? AND lookup_key=? AND source=? AND cve=? AND affected_key=?');
|
|
469
485
|
db.transaction(()=>{
|
|
@@ -481,7 +497,7 @@ function saveCveIndex(index, cacheDir = path.dirname(CVE_DATA_DIR)) {
|
|
|
481
497
|
}
|
|
482
498
|
|
|
483
499
|
function loadCveIndex(cacheDir = path.dirname(CVE_DATA_DIR)) {
|
|
484
|
-
const db=require('
|
|
500
|
+
const db=require('../../cache/db').getCacheDb(cacheDir);
|
|
485
501
|
const snapshot=db.prepare("SELECT metadata_json FROM cache_snapshots WHERE namespace='cve_lookup'").get();
|
|
486
502
|
if(!snapshot)return null;
|
|
487
503
|
const statement=db.prepare('SELECT projection_json FROM cve_lookup WHERE kind=? AND lookup_key=?');
|
|
@@ -502,7 +518,7 @@ function isCveIndexFresh(maxAgeHours = 4, cacheDir = path.dirname(CVE_DATA_DIR))
|
|
|
502
518
|
}
|
|
503
519
|
|
|
504
520
|
async function downloadCveData(opts = {}) {
|
|
505
|
-
const { verbose, force, revalidate, cacheDir = path.dirname(CVE_DATA_DIR) } = opts;
|
|
521
|
+
const { verbose, force, revalidate, cacheDir = path.dirname(CVE_DATA_DIR), onProgress } = opts;
|
|
506
522
|
const dataDir=path.join(cacheDir,'cve-data'), extractDir=path.join(dataDir,'extracted'), zipPath=path.join(dataDir,'cves.zip');
|
|
507
523
|
await fs.promises.mkdir(dataDir, { recursive: true });
|
|
508
524
|
if (!force && !revalidate && isCurrentCveIndex(loadCveIndex(cacheDir)) && isCveIndexFresh(4, cacheDir)) {
|
|
@@ -511,10 +527,11 @@ async function downloadCveData(opts = {}) {
|
|
|
511
527
|
}
|
|
512
528
|
|
|
513
529
|
if (verbose) console.log("📥 fetching latest CVE release metadata…");
|
|
530
|
+
onProgress?.("Checking latest release");
|
|
514
531
|
const { url, tag, name } = await fetchLatestRelease();
|
|
515
532
|
if (verbose) console.log(` ${tag} → ${name}`);
|
|
516
533
|
const cached=loadCveIndex(cacheDir);
|
|
517
|
-
const db=require('
|
|
534
|
+
const db=require('../../cache/db').getCacheDb(cacheDir);
|
|
518
535
|
const snapshot=db.prepare("SELECT complete,stale FROM cache_snapshots WHERE namespace='cve_lookup'").get();
|
|
519
536
|
if (!force && isCurrentCveIndex(cached) && snapshot?.complete === 1 && snapshot.stale === 0 && tag && cached.meta.releaseTag === tag) {
|
|
520
537
|
const checkedAt=new Date().toISOString(), meta={...cached.meta,checkedAt};
|
|
@@ -524,16 +541,19 @@ async function downloadCveData(opts = {}) {
|
|
|
524
541
|
}
|
|
525
542
|
|
|
526
543
|
if (verbose) console.log("📥 downloading CVE zip (this may take a while)…");
|
|
527
|
-
|
|
544
|
+
onProgress?.("Downloading archive");
|
|
545
|
+
await download(url, zipPath, { tag, name, onProgress });
|
|
528
546
|
|
|
529
547
|
if (verbose) console.log("📦 extracting…");
|
|
548
|
+
onProgress?.("Extracting archive");
|
|
530
549
|
try { await fs.promises.rm(extractDir, { recursive: true, force: true }); } catch {}
|
|
531
550
|
await extractZip(zipPath, extractDir, { verbose });
|
|
532
551
|
|
|
533
552
|
if (verbose) console.log("🔎 building Maven CVE index…");
|
|
534
|
-
const index = await buildCveIndex(extractDir, { verbose, releaseTag: tag, cacheDir });
|
|
553
|
+
const index = await buildCveIndex(extractDir, { verbose, releaseTag: tag, fullArchive:true, cacheDir, onProgress });
|
|
535
554
|
|
|
536
555
|
// cleanup heavy files
|
|
556
|
+
onProgress?.("Cleaning up extracted files");
|
|
537
557
|
try { await fs.promises.rm(extractDir, { recursive: true, force: true }); } catch {}
|
|
538
558
|
try { await fs.promises.rm(zipPath, { force: true }); } catch {}
|
|
539
559
|
|
|
@@ -552,8 +572,8 @@ async function ensureCveIndex(opts = {}) {
|
|
|
552
572
|
if (!cached) throw new Error("--cve-offline set but no cached CVE index found");
|
|
553
573
|
return cached;
|
|
554
574
|
}
|
|
555
|
-
if (!force && !require('
|
|
556
|
-
return downloadCveData({ verbose, force: !!force, revalidate: true, cacheDir });
|
|
575
|
+
if (!force && !require('../../cache/policy').shouldForceUpdate() && isCurrentCveIndex(cached) && isCveIndexFresh(ttlMs / 3600000, cacheDir)) return cached;
|
|
576
|
+
return downloadCveData({ verbose, force: !!force, revalidate: true, cacheDir, onProgress: opts.onProgress });
|
|
557
577
|
}
|
|
558
578
|
|
|
559
579
|
module.exports = {
|
|
@@ -41,7 +41,7 @@ function normalizeLegacySplitRanges(affected,description,legacy) {
|
|
|
41
41
|
if(text && structured && JSON.stringify(text)!==JSON.stringify(structured))return affected;
|
|
42
42
|
const parts=structured || text,old=affected.versions;
|
|
43
43
|
if(!parts || !parts.length || parts.length>32 || old.length!==parts.length*2)return affected;
|
|
44
|
-
const versions=[],cmp=require('./
|
|
44
|
+
const versions=[],cmp=require('./version-verdict').comparator('maven');
|
|
45
45
|
const concrete=new RegExp(`^${VERSION}$`);
|
|
46
46
|
for(let i=0;i<parts.length;i++) {
|
|
47
47
|
const [lower,upper]=parts[i],a=old[i*2],b=old[i*2+1];
|