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
package/lib/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# How the code is organised
|
|
2
|
+
|
|
3
|
+
`vigievuln.js` at the repository root is the executable. It routes each command to one of
|
|
4
|
+
the entry points below, and runs the project scan (`scan <path>`) itself.
|
|
5
|
+
|
|
6
|
+
## Where it starts: the files at the root of `lib/`
|
|
7
|
+
|
|
8
|
+
| File | What starts there |
|
|
9
|
+
|---|---|
|
|
10
|
+
| `cli-command-routing.js` | maps the command line (`scan`, `system`, `cache`, `account`…) to an entry point |
|
|
11
|
+
| `cli-image.js` | `system scan`: images, archives, root filesystems, inventories, SBOMs |
|
|
12
|
+
| `cli-collect.js` | `system collect`: inventory of a live system or a root filesystem |
|
|
13
|
+
| `cli-project-commands.js` | account and hosted-project commands |
|
|
14
|
+
| `cli-setup.js` | `setup`: interactive configuration |
|
|
15
|
+
| `cli-watch.js` | `watch`: rescan on change |
|
|
16
|
+
| `cli-groups.js` | option groups and report formats (`-r html,json…`) |
|
|
17
|
+
| `options-env.js` | how an option is resolved: command line, environment, configuration file |
|
|
18
|
+
| `config.js` | the user configuration file (`~/.vigie-vuln/config.json`) |
|
|
19
|
+
| `source-input.js` | the scanned source: a directory or an archive |
|
|
20
|
+
| `ui.js` | terminal output: banner, sections, colours |
|
|
21
|
+
|
|
22
|
+
Nothing else lives at the root of `lib/`. A new module goes in the folder of its theme.
|
|
23
|
+
|
|
24
|
+
## Folders
|
|
25
|
+
|
|
26
|
+
| Folder | Content |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `providers/` | One folder per data source. `providers/index.js` is the single entry point for every network lookup (cache, proxy or direct request). `providers/<name>/index.js` describes the source's requests; the other files of the folder are everything specific to that source: parsing, enrichment, matching rules. |
|
|
29
|
+
| `codecs/` | One codec per ecosystem (Maven, Gradle, npm, Yarn, PyPI, Composer, Go, NuGet, Ruby, binaries): manifests, lockfiles, registry metadata, version ordering. `codecs/maven/` holds the POM model, reactor, BOMs and transitive resolution. |
|
|
30
|
+
| `inventory/` | The dependency model shared by every codec (`dep-record.js`), descriptors, package URLs, private and unmanaged components, directory walking. |
|
|
31
|
+
| `advisories/` | The advisory store and the matching of native CVE records against packages. |
|
|
32
|
+
| `findings/` | What happens to a match once found: merging sources, severity, priority, enrichment, evidence, attribution, suppression, CI gate, differential audit. |
|
|
33
|
+
| `scan/` | Facts about a run: coverage, reliability and the publication policy, diagnostics, source health, provenance. |
|
|
34
|
+
| `reports/` | HTML and Word report, JSON, CycloneDX, SARIF, CSAF and Excel exports, charts, localisation. |
|
|
35
|
+
| `cache/` | SQLite cache, cache archives for air-gapped use, the proxy cache, the pull-through resource cache (`cache/resource/`). |
|
|
36
|
+
| `images/` | Image references in source trees, registry client, local Docker engine, extraction roots. |
|
|
37
|
+
| `artifacts/` | Acquisition and assessment of system targets: layers, disks, installed applications, binaries, SBOM input. |
|
|
38
|
+
| `system-inventory/` | Installed packages of a system and their assessment against distribution advisories. |
|
|
39
|
+
| `applications/` | CMS and framework instances: inventory, layout, exports; `applications/plugins/` has one plugin per application type. |
|
|
40
|
+
| `maintenance/` | End of life, obsolete and outdated components, commercial support. |
|
|
41
|
+
| `certs/` | Certificates and keys found in a tree. |
|
|
42
|
+
| `service/` | Client of the hosted account and project service. |
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
- Code specific to one data source goes in `providers/<name>/`, next to that source's
|
|
47
|
+
request descriptor. A folder that serves several sources stays generic.
|
|
48
|
+
- Code specific to one ecosystem goes in `codecs/<ecosystem>/`.
|
|
49
|
+
- The server repository loads some of these modules by path (`vigievuln/lib/<name>`). The
|
|
50
|
+
`exports` map of `package.json` keeps the paths it knows working when a file moves. After
|
|
51
|
+
moving or removing a module, run `node scripts/check-server-modules.js ../server`.
|
|
@@ -16,7 +16,7 @@ function needsMavenReview(candidate, store, {ttlMs} = {}) {
|
|
|
16
16
|
return !r.withdrawnAt && !d?.withdrawn && [d?.id,...(d?.aliases || [])].includes(id);
|
|
17
17
|
});
|
|
18
18
|
if(!records.length) return true;
|
|
19
|
-
const {vulnVerdict}=require('
|
|
19
|
+
const {vulnVerdict}=require('../providers/osv/db');
|
|
20
20
|
const verdicts=records.map(({document})=>{
|
|
21
21
|
const affected=(document.affected || []).filter(a=>a?.package?.ecosystem==='Maven' && a.package.name===name);
|
|
22
22
|
return affected.length ? vulnVerdict(version,{...document,affected},'Maven') : null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/cve-match.js — collect resolved deps from the parsed POM tree and
|
|
3
|
-
* match them against a CVE index built by lib/
|
|
2
|
+
* lib/advisories/cve-match.js — collect resolved deps from the parsed POM tree and
|
|
3
|
+
* match them against a CVE index built by lib/providers/cveproject/download.js.
|
|
4
4
|
*
|
|
5
5
|
* @author: N.BRAUN
|
|
6
6
|
* @email: pp9ping@gmail.com
|
|
7
7
|
*/
|
|
8
|
-
const { coord } = require("
|
|
9
|
-
const { compareMavenVersions, isVersionAffected, normalizeHardPin, branchFixFromRanges } = require("
|
|
10
|
-
const { resolveTransitiveDeps } = require("
|
|
11
|
-
const { makeDepRecord } = require("
|
|
12
|
-
const { affectedVerdict, rangeMembership, comparator } = require('
|
|
8
|
+
const { coord } = require("../codecs/maven/pom");
|
|
9
|
+
const { compareMavenVersions, isVersionAffected, normalizeHardPin, branchFixFromRanges } = require("../codecs/maven/version");
|
|
10
|
+
const { resolveTransitiveDeps } = require("../codecs/maven/transitive");
|
|
11
|
+
const { makeDepRecord } = require("../inventory/dep-record");
|
|
12
|
+
const { affectedVerdict, rangeMembership, comparator } = require('../providers/cveproject/version-verdict');
|
|
13
13
|
|
|
14
14
|
const SEVERITY_RANK = { CRITICAL: 4, HIGH: 3, MEDIUM: 2, LOW: 1, NONE: 0, UNKNOWN: 0 };
|
|
15
15
|
|
|
@@ -116,6 +116,10 @@ function collectResolvedDeps(allPomMetadata, allPropsByPom, opts = {}) {
|
|
|
116
116
|
const rec = out.get(key);
|
|
117
117
|
(rec.versionRelations || (rec.versionRelations = {}))[concrete] = "direct";
|
|
118
118
|
}
|
|
119
|
+
// Declared in <dependencies> without a version of its own: the version comes from
|
|
120
|
+
// dependencyManagement, a parent or a BOM. The declaration is direct all the same;
|
|
121
|
+
// the project descriptor binds it to the version once exactly one is resolved.
|
|
122
|
+
if (!fromMgmt) out.get(key).declaredDirect = true;
|
|
119
123
|
// The <exclusions> that apply to THIS declaration: its own plus the ones its pom's
|
|
120
124
|
// effective <dependencyManagement> attaches to the coord (Maven merges them). One
|
|
121
125
|
// set per declaration — expandWithTransitives keeps only what EVERY declaration
|
|
@@ -136,7 +140,7 @@ function collectResolvedDeps(allPomMetadata, allPropsByPom, opts = {}) {
|
|
|
136
140
|
// Remember WHICH pom declares THIS version. The record is coord-wide, so
|
|
137
141
|
// this is the only link back from a scanned version to its manifest —
|
|
138
142
|
// without it a match on one version is reported against every pom that
|
|
139
|
-
// declares the coord at any version (lib/attribution.js consumes this).
|
|
143
|
+
// declares the coord at any version (lib/findings/attribution.js consumes this).
|
|
140
144
|
if (concrete) {
|
|
141
145
|
const rec = out.get(key);
|
|
142
146
|
if (!rec.versionPaths) rec.versionPaths = {};
|
|
@@ -224,7 +228,7 @@ async function expandWithTransitives(resolvedDeps, opts = {}) {
|
|
|
224
228
|
// Gradle allows a direct declaration to omit its version when another request
|
|
225
229
|
// on the same classpath supplies it. Resolve these before seeding the graph:
|
|
226
230
|
// they remain DIRECT dependencies, with their own scopes and exclusions.
|
|
227
|
-
await require("
|
|
231
|
+
await require("../codecs/gradle/versionless").recoverVersionlessGradle(resolvedDeps, opts);
|
|
228
232
|
// Root depMgmt: every dep in the Map that has a concrete version becomes a
|
|
229
233
|
// version override for transitive resolution. This catches cases where the
|
|
230
234
|
// project pins a transitive's version via <dependencyManagement>.
|
|
@@ -241,7 +245,7 @@ async function expandWithTransitives(resolvedDeps, opts = {}) {
|
|
|
241
245
|
rootDepMgmt.set(`${dep.groupId}:${dep.artifactId}`, { version: dep.version, exclusions: commonExclusions(dep.mgmtExclusionSets), ...(dep.pinMinimum ? { minimum: true } : {}) });
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
|
-
// External import BOMs / <parent> managed tables (lib/maven
|
|
248
|
+
// External import BOMs / <parent> managed tables (lib/codecs/maven/bom.js, resolved by the BOM
|
|
245
249
|
// step): Maven applies them to TRANSITIVE versions too, not only to versionless
|
|
246
250
|
// declarations. Without them a project aligning netty through netty-bom had its
|
|
247
251
|
// transitives resolved at whatever reactor-netty declares — the wrong version,
|
|
@@ -293,6 +297,7 @@ async function expandWithTransitives(resolvedDeps, opts = {}) {
|
|
|
293
297
|
|
|
294
298
|
const transitives = await resolveTransitiveDeps(directs, {
|
|
295
299
|
...opts,
|
|
300
|
+
gradleComponents: directs.length > 0 && directs.every(d=>d.ecosystemType==='gradle'),
|
|
296
301
|
...(includedScopes ? { includedScopes } : {}),
|
|
297
302
|
rootDepMgmt,
|
|
298
303
|
});
|
|
@@ -336,7 +341,7 @@ async function expandWithTransitives(resolvedDeps, opts = {}) {
|
|
|
336
341
|
* Turn a `managedOnly` record into the transitive it really is. In place: the record is
|
|
337
342
|
* the Map's own entry, nothing else holds it yet. The pom that pins it is kept as
|
|
338
343
|
* `managedIn` (where to bump the version), NOT as manifestPaths — it does not declare a
|
|
339
|
-
* dependency, and lib/attribution.js would otherwise file the finding there as direct.
|
|
344
|
+
* dependency, and lib/findings/attribution.js would otherwise file the finding there as direct.
|
|
340
345
|
*/
|
|
341
346
|
function promoteManagedToTransitive(rec, t, rootEcoType) {
|
|
342
347
|
const managedIn = [...(rec.manifestPaths || [])];
|
|
@@ -436,7 +441,7 @@ function matchOne(dep, entries, confidence, onUnknown) {
|
|
|
436
441
|
const evidence = [...providers.values()];
|
|
437
442
|
const evaluatedRanges = effectiveRanges(e);
|
|
438
443
|
const verdictFor = version => {
|
|
439
|
-
const states = evidence.map(item =>
|
|
444
|
+
const states = evidence.map(item => affectedVerdict(String(version), item.ranges, item.defaultStatus === undefined ? 'unaffected' : item.defaultStatus));
|
|
440
445
|
if (states.some(state => state === null)) return null;
|
|
441
446
|
return states.every(state => state === true) ? true : states.every(state => state === false) ? false : null;
|
|
442
447
|
};
|
|
@@ -14,7 +14,7 @@ function mergeAdvisoryFixes(left, right) {
|
|
|
14
14
|
if (fixVersion && [left, right].some(c => c.fixVersion === fixVersion && c.fixEvidence === 'explicit-unaffected-version')) result.fixEvidence = 'explicit-unaffected-version';
|
|
15
15
|
if (unknown) result.fixEvaluation = 'unknown';
|
|
16
16
|
else if (left.fixEvaluation === 'verified' || right.fixEvaluation === 'verified') result.fixEvaluation = 'verified';
|
|
17
|
-
if (left.branchFix || right.branchFix) result.branchFix = require('
|
|
17
|
+
if (left.branchFix || right.branchFix) result.branchFix = require('../codecs/maven/version').stricterBranchFix(left.branchFix, right.branchFix);
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const UNITS = { s: 1000, m: 60 * 1000, h: 3600 * 1000, d: 24 * 3600 * 1000 };
|
|
7
7
|
|
|
8
|
+
// A consultation made during this run is current whatever the TTL: `--advisory-query-ttl 0`
|
|
9
|
+
// asks for a new consultation, it does not declare that new consultation out of date.
|
|
10
|
+
function runTtl(ttlMs) { return Math.max(Number(ttlMs) || 0, Math.ceil(process.uptime() * 1000) + 1000); }
|
|
11
|
+
|
|
8
12
|
function parseMaxAge(value) {
|
|
9
13
|
const match = /^(\d+)(s|m|h|d)$/.exec(String(value || "").trim());
|
|
10
14
|
if (!match || Number(match[1]) < 1) throw new Error(`invalid --max-advisory-age duration: ${value}`);
|
|
@@ -34,4 +38,4 @@ function assertFresh(snapshot, label, maxAgeMs, nowMs = Date.now()) {
|
|
|
34
38
|
return { collectedAt: collectedAt.toISOString() };
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
module.exports = { parseMaxAge, declaredCollectedAt, assertFresh };
|
|
41
|
+
module.exports = { parseMaxAge, declaredCollectedAt, assertFresh, runTtl };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/gap-adjudicate.js — adjudicate a claimed false negative against the public record.
|
|
2
|
+
* lib/advisories/gap-adjudicate.js — adjudicate a claimed false negative against the public record.
|
|
3
3
|
*
|
|
4
4
|
* Context. A comparative benchmark produces pairs another scanner found and vigievuln
|
|
5
5
|
* did not. It is tempting to treat that list as a recall backlog and start widening the
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* vulnerability to that coordinate AND that version.
|
|
9
9
|
*
|
|
10
10
|
* This module answers, per pair, which of those it is — using the SAME range evaluation
|
|
11
|
-
* the scanner itself uses (`lib/osv
|
|
11
|
+
* the scanner itself uses (`lib/providers/osv/db`.vulnAffectsVersion), so a verdict of
|
|
12
12
|
* CONFIRMED_MISS means "fad had the data and still didn't report it", never "the two
|
|
13
13
|
* implementations disagree".
|
|
14
14
|
*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @author: N.BRAUN
|
|
24
24
|
* @email: pp9ping@gmail.com
|
|
25
25
|
*/
|
|
26
|
-
const { vulnAffectsVersion } = require("
|
|
26
|
+
const { vulnAffectsVersion } = require("../providers/osv/db");
|
|
27
27
|
|
|
28
28
|
const VERDICT = {
|
|
29
29
|
// OSV has no such advisory. Usually a vendor-proprietary id, but NOT a claim that no
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// Shared native-record package matching. A typed PURL is required; neither
|
|
3
3
|
// product names nor advisory identifiers establish a package identity.
|
|
4
|
-
const {explicitPackage,identity}=require('
|
|
5
|
-
const {osvEcosystemFor,osvPkgName}=require('
|
|
6
|
-
const {packageName}=require('./
|
|
7
|
-
const nativeVersions=require('
|
|
4
|
+
const {explicitPackage,identity}=require('../providers/gcve/local-index');
|
|
5
|
+
const {osvEcosystemFor,osvPkgName}=require('../providers/osv/query');
|
|
6
|
+
const {packageName}=require('./store');
|
|
7
|
+
const nativeVersions=require('../system-inventory/versions');
|
|
8
8
|
function systemPackage(a){
|
|
9
9
|
const raw=typeof a?.packageURL==='string'?a.packageURL:typeof a?.purl==='string'?a.purl:null;
|
|
10
10
|
if(!raw){
|
|
@@ -26,7 +26,7 @@ function systemPackage(a){
|
|
|
26
26
|
return {ecosystem:`system:${type}:${namespace}:${release}`,name,manager:type,distribution:namespace,release,arch};
|
|
27
27
|
}catch{return null;}
|
|
28
28
|
}
|
|
29
|
-
function explicitNativePackage(a,context){return systemPackage(a)||require('
|
|
29
|
+
function explicitNativePackage(a,context){return systemPackage(a)||require('../providers/cveproject/cna-identities').cnaSystemPackage(a,context,context?.cnaIdentities)||explicitPackage(a)||require('./native').explicitNpmPackage(a);}
|
|
30
30
|
function depIdentity(dep){
|
|
31
31
|
if(dep.ecosystem==='system'){
|
|
32
32
|
const manager=({dpkg:'deb',deb:'deb',apk:'apk',rpm:'rpm'})[dep.manager||dep.packageType],d=dep.distribution;
|
|
@@ -41,8 +41,8 @@ function typeComparator(type,ecosystem){
|
|
|
41
41
|
const manager=ecosystem.split(':')[1],valid={deb:['deb','debian','dpkg'],apk:['apk','alpine'],rpm:['rpm']}[manager];
|
|
42
42
|
return valid?.includes(type)?nativeVersions[manager==='deb'?'debian':manager]:null;
|
|
43
43
|
}
|
|
44
|
-
if(type==='maven'&&ecosystem==='Maven')return require('
|
|
45
|
-
if(type==='semver')return require('
|
|
44
|
+
if(type==='maven'&&ecosystem==='Maven')return require('../providers/cveproject/version-verdict').comparator('maven');
|
|
45
|
+
if(type==='semver')return require('../providers/osv/db').compareSemver;
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
function versionVerdict(version,a,ecosystem){
|
|
@@ -89,7 +89,16 @@ function sourceReferences(record,source){
|
|
|
89
89
|
}
|
|
90
90
|
return {references,relatedAdvisories:[...new Map(relatedAdvisories.map(item=>[item.url,item])).values()]};
|
|
91
91
|
}
|
|
92
|
-
function metric(
|
|
92
|
+
function metric(containers) {
|
|
93
|
+
for(const c of containers)for(const m of c.metrics || [])for(const k of ['cvssV4_0','cvssV3_1','cvssV3_0','cvssV2_0']){
|
|
94
|
+
const v=m?.[k],score=v?.baseScore;
|
|
95
|
+
if(!Number.isFinite(score) || score<0 || score>10)continue;
|
|
96
|
+
const severity=v.baseSeverity || (k==='cvssV2_0' ? (score>=7?'HIGH':score>=4?'MEDIUM':'LOW') :
|
|
97
|
+
score>=9?'CRITICAL':score>=7?'HIGH':score>=4?'MEDIUM':score>0?'LOW':'NONE');
|
|
98
|
+
return {score,severity:String(severity).toUpperCase(),cvssVector:v.vectorString||null,cvssVersion:'CVSS:'+k.slice(5).replace('_','.')};
|
|
99
|
+
}
|
|
100
|
+
return {score:null,severity:'UNKNOWN'};
|
|
101
|
+
}
|
|
93
102
|
function loadRecords(store,sources){
|
|
94
103
|
if(!store?.db?.prepare || typeof store.getRecord!=='function')return [];
|
|
95
104
|
const sql=`SELECT source,id FROM advisory_records WHERE source IN (${sources.map(()=>'?').join(',')}) ORDER BY source,id`;
|
|
@@ -110,6 +119,7 @@ function matchNativePackages(deps,store,opts={}){
|
|
|
110
119
|
}
|
|
111
120
|
for(const rec of records()){
|
|
112
121
|
const recordKey=rec.source+'\0'+rec.id;if(seenRecords.has(recordKey))continue;seenRecords.add(recordKey);
|
|
122
|
+
if (seenRecords.size % 5000 === 0) opts.onProgress?.(seenRecords.size);
|
|
113
123
|
const raw=rec.document;if(raw?.cveMetadata?.state!=='PUBLISHED')continue;
|
|
114
124
|
let gcve=null;if(rec.source==='gcve'){
|
|
115
125
|
try{gcve=identity(raw,rec.provenance?.gna);if(gcve.recordType!=='advisory')continue;}catch{continue;}
|
|
@@ -139,7 +149,6 @@ function matchNativePackages(deps,store,opts={}){
|
|
|
139
149
|
if(p.manager && p.arch==='source'){
|
|
140
150
|
if(!dep.sourceName||dep.sourceName!==p.name||!dep.sourceVersion)reason='source identity or version unavailable';else version=dep.sourceVersion;
|
|
141
151
|
} else if(p.manager && !dep.architecture)reason='architecture unavailable';
|
|
142
|
-
if(a.platforms?.length)reason='platform constraints unsupported';
|
|
143
152
|
const result=reason?null:versionVerdict(version,a,p.ecosystem);
|
|
144
153
|
entry.verdicts.push(result);if(result===null)entry.reason=reason||'version semantics unknown';
|
|
145
154
|
}
|
|
@@ -151,9 +160,9 @@ function matchNativePackages(deps,store,opts={}){
|
|
|
151
160
|
if(!values.includes(true))continue;
|
|
152
161
|
const aliases=gcve?.aliases||[],cveId=aliases.find(id=>/^CVE-\d{4}-\d{4,}$/i.test(id))||rec.id;
|
|
153
162
|
const dep=entry.installedVersion===entry.dep.version?entry.dep:{...entry.dep,version:entry.installedVersion};
|
|
154
|
-
matches.push({dep,source:rec.source==='gcve'?`GCVE:GNA-${gcve.gna}`:'CVEProject',confidence:'exact',cve:{id:cveId,...metric(cs),...sourceReferences(raw,rec.source),description:String(description),published:raw.cveMetadata.datePublished||null,modified:raw.cveMetadata.dateUpdated||null,fixVersion:null,...(gcve?{gcve:gcve.id,gcveSource:rec.provenance?.sourceUrl||null,gcveRecordType:gcve.recordType,gcveRelationships:gcve.relationships,aliases}: {})}});
|
|
163
|
+
matches.push({dep,source:rec.source==='gcve'?`GCVE:GNA-${gcve.gna}`:'CVEProject',confidence:'exact',cve:{id:cveId,sourceAdvisoryId:rec.id,...metric(cs),...sourceReferences(raw,rec.source),description:String(description),published:raw.cveMetadata.datePublished||null,modified:raw.cveMetadata.dateUpdated||null,fixVersion:null,...(gcve?{gcve:gcve.id,gcveSource:rec.provenance?.sourceUrl||null,gcveRecordType:gcve.recordType,gcveRelationships:gcve.relationships,aliases}: {})}});
|
|
155
164
|
}
|
|
156
165
|
}
|
|
157
166
|
return {matches,unknown,coverage:{status:unknown.length?'incomplete':'partial',sources,reason:unknown.length?'native comparisons undecidable':'native source completeness must be evaluated separately'}};
|
|
158
167
|
}
|
|
159
|
-
module.exports={systemPackage,explicitNativePackage,depIdentity,versionVerdict,matchNativePackages};
|
|
168
|
+
module.exports={metric,systemPackage,explicitNativePackage,depIdentity,versionVerdict,matchNativePackages};
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
// Prepare the native source stores independently of OSV/NVD. Failed refreshes
|
|
3
3
|
// keep earlier observations and are returned as coverage, never clean verdicts.
|
|
4
4
|
const path=require('node:path');
|
|
5
|
-
const {openAdvisoryStore}=require('./
|
|
5
|
+
const {openAdvisoryStore}=require('./store');
|
|
6
6
|
function selectedNativeSources(options={}){
|
|
7
7
|
const requested=options.nativeSources||['cveproject','gcve'];if(!Array.isArray(requested)||requested.some(s=>!['cveproject','gcve'].includes(s)))throw Error('invalid native source selection');
|
|
8
8
|
return [...new Set(requested)].filter(s=>s==='cveproject'?!options.disableCveProject:!options.disableGcve&&options.gcve!==false);
|
|
9
9
|
}
|
|
10
10
|
async function prepareNativeSources(deps,options={}){
|
|
11
|
-
const cacheDir=options.cacheDir||require('
|
|
11
|
+
const cacheDir=options.cacheDir||require('../cache/directory').getCacheDir(),store=options.store||openAdvisoryStore({cacheDir}),close=!options.store;
|
|
12
12
|
const sources=selectedNativeSources(options),coverage=[],warnings=[],ttlMs=options.advisoryQueryTtlMs??4*3600000;
|
|
13
13
|
try{
|
|
14
|
+
const packages=require('../providers/cveproject/packages-proxy').packageIdentities(deps);
|
|
15
|
+
if(!packages.length)return {sources:[],coverage:[],warnings:[]};
|
|
14
16
|
for(const source of sources){
|
|
15
17
|
let refreshError=null;
|
|
16
18
|
const existing=store.getSourceCoverage(source,'*');
|
|
@@ -20,27 +22,28 @@ async function prepareNativeSources(deps,options={}){
|
|
|
20
22
|
try{
|
|
21
23
|
if(options.nativeSourceAdapters?.[source]) await options.nativeSourceAdapters[source]({deps,store,cacheDir,options});
|
|
22
24
|
else if(source==='gcve'){
|
|
23
|
-
const feed=require('
|
|
24
|
-
} else if(require('
|
|
25
|
+
const feed=require('../providers/gcve/feed');await feed.updateGcveIndex({...(options.gcveOptions||{}),cacheFile:path.join(cacheDir,'gcve-data','index.json'),fetcher:require('../providers').hasProxyRoute()?feed.proxyGcveFetcher:(options.fetcher||globalThis.fetch)});
|
|
26
|
+
} else if(require('../providers').hasProxyRoute()){
|
|
27
|
+
options.onCveProgress?.('Querying package advisories via proxy');
|
|
25
28
|
// Ask the fleet's typed native package index for all ecosystems. Older
|
|
26
29
|
// servers can still supply their legacy npm/Maven projections, while a
|
|
27
30
|
// failed generic lookup remains an explicit incomplete source.
|
|
28
|
-
try{await require('
|
|
31
|
+
try{await require('../providers/cveproject/packages-proxy').refreshPackageCves(deps,store,{ttlMs});}
|
|
29
32
|
catch(error){
|
|
30
|
-
if(require('
|
|
31
|
-
if([...deps.values()].some(d=>d.ecosystem==='maven' && d.provenance!=='binary')){const scanner=(require('
|
|
33
|
+
if(require('../providers/cveproject/npm-proxy').packageNames(deps).length)await require('../providers/cveproject/npm-proxy').refreshNpmCves(deps,store,{ttlMs});
|
|
34
|
+
if([...deps.values()].some(d=>d.ecosystem==='maven' && d.provenance!=='binary')){const scanner=(require('../codecs/maven.codec').nativeScanners||[]).find(x=>x.kind==='cve');if(scanner?.scan)await scanner.scan(deps,{hostedProxy:true,offline:false,queryTtlMs:ttlMs});}
|
|
32
35
|
throw error;
|
|
33
36
|
}
|
|
34
37
|
} else {
|
|
35
|
-
await require('
|
|
38
|
+
await require('../providers/cveproject/download').ensureCveIndex({force:!!options.forceUpdate,offline:false,ttlMs,cacheDir,onProgress:options.onCveProgress});
|
|
36
39
|
}
|
|
37
40
|
}catch(e){refreshError=e.message;warnings.push({type:'source-unavailable',code:'source-request-failed',source,status:e.status||null,reason:e.message,resources:[source],message:`${source} refresh failed: ${e.message}`});}
|
|
38
41
|
}
|
|
39
42
|
const current=store.getSourceCoverage(source,'*');
|
|
40
43
|
const exists=!!store.db.prepare('SELECT 1 AS n FROM advisory_records WHERE source=? LIMIT 1').get(source);
|
|
41
|
-
const identities=new Map(
|
|
44
|
+
const identities=new Map(packages.map(p=>[JSON.stringify([p.ecosystem,p.name]),{source,ecosystem:p.ecosystem,name:p.name,version:'*'}]));
|
|
42
45
|
const queries=[...identities.values()].map(tuple=>store.getQuery(tuple,{ttlMs})).filter(Boolean);
|
|
43
|
-
const scoped=identities.size>0 && queries.length===identities.size;
|
|
46
|
+
const scoped=identities.size>0 && queries.length===identities.size && queries.every(q=>q.complete!==false);
|
|
44
47
|
const scopedAt=scoped?Math.min(...queries.map(q=>q.fetchedAt)):null;
|
|
45
48
|
const fetchedAt=current?.fetchedAt || scopedAt;
|
|
46
49
|
const age=fetchedAt && Date.now()-fetchedAt;
|
|
@@ -49,10 +52,10 @@ async function prepareNativeSources(deps,options={}){
|
|
|
49
52
|
const available=exists || !!current || scoped;
|
|
50
53
|
const issue=refreshError?'refresh-failed':!available?'missing-source':invalidDate?'invalid-timestamp':declaredStale||(!offline&&expired)?'stale-source':null;
|
|
51
54
|
const complete=!!current?.complete&&!expired&&!declaredStale&&!invalidDate&&!refreshError;
|
|
52
|
-
const reason=refreshError || (!available?
|
|
55
|
+
const reason=refreshError || (!available?(offline ? `The offline auditor cache contains no ${source} snapshot or verified lookup for the selected packages.` : `${source} returned no verifiable package consultation.`):invalidDate?'Source collection timestamp is in the future':declaredStale?'The provider marked its source data stale':!offline&&expired?'Source evidence could not be refreshed':scoped?'Selected package identities checked':!current?.complete?'Prepared advisory records checked':expired?'Prepared source snapshot used offline':'Source snapshot consulted');
|
|
53
56
|
coverage.push({source,status:complete?'complete':available?'incomplete':'missing',complete,
|
|
54
57
|
execution:issue?(available?'partial':'not-run'):'completed',result:issue?'indeterminate':'available',
|
|
55
|
-
scope:scoped?'consulted-packages':'available-native-records',issue,fetchedAt:fetchedAt||null,freshness:expired?'expired':'current',reason});
|
|
58
|
+
scope:scoped?'consulted-packages':'available-native-records',issue,fetchedAt:fetchedAt||null,freshness:!fetchedAt?'unknown':expired?'expired':'current',reason});
|
|
56
59
|
}
|
|
57
60
|
return {sources,coverage,warnings};
|
|
58
61
|
} finally {if(close)store.close();}
|
|
@@ -6,7 +6,7 @@ const path = require('node:path');
|
|
|
6
6
|
const MAX_RECORD = 16 * 1024 * 1024;
|
|
7
7
|
|
|
8
8
|
function explicitNpmPackage(affected) {
|
|
9
|
-
const p=require('
|
|
9
|
+
const p=require('../providers/gcve/local-index').explicitPackage(affected);
|
|
10
10
|
if(p?.ecosystem==='npm')return p;
|
|
11
11
|
if(affected?.packageURL!=null || affected?.purl!=null)return null;
|
|
12
12
|
// Some CNA records use a package name with an explicit npm registry
|
|
@@ -23,7 +23,7 @@ function cveEnvelope(raw, { fetchedAt, provenance = {transport:'direct'} } = {})
|
|
|
23
23
|
if (!/^CVE-\d{4}-\d{4,}$/i.test(String(id || '')) || !['PUBLISHED','REJECTED','RESERVED'].includes(raw?.cveMetadata?.state)) throw new Error('invalid native CVEProject record');
|
|
24
24
|
const packages = [];
|
|
25
25
|
if (raw.cveMetadata.state === 'PUBLISHED') {
|
|
26
|
-
const projected = require('
|
|
26
|
+
const projected = require('../providers/cveproject/download').extractMavenRelevantCve(raw);
|
|
27
27
|
for (const a of projected?.affected || []) {
|
|
28
28
|
for (const name of (a.packageNames || [])) packages.push({ecosystem:'Maven',name});
|
|
29
29
|
if (a.product) packages.push({ecosystem:'CVEProduct',name:String(a.product).toLowerCase()});
|
|
@@ -39,7 +39,7 @@ function cveEnvelope(raw, { fetchedAt, provenance = {transport:'direct'} } = {})
|
|
|
39
39
|
return {source:'cveproject',id:id.toUpperCase(),document:raw,fetchedAt,provenance,packages};
|
|
40
40
|
}
|
|
41
41
|
function gcveEnvelope(stored, { provenance = {transport:'direct'} } = {}) {
|
|
42
|
-
const {identity}=require('
|
|
42
|
+
const {identity}=require('../providers/gcve/local-index');
|
|
43
43
|
const raw=stored?.raw, ident=identity(raw,stored?.gna), at=Date.parse(stored.collectedAt);
|
|
44
44
|
if (!Number.isSafeInteger(at) || at <= 0 || at > Date.now()+300000) throw new Error('invalid GCVE collection date');
|
|
45
45
|
const packages=[];
|
|
@@ -80,9 +80,10 @@ async function importGcveIndex(store,index,{provenance={transport:'direct'}}={})
|
|
|
80
80
|
await store.importEnvelopes(entries(),{coverages:[{source:'gcve',ecosystem:'*',fetchedAt,complete,provenance}]});
|
|
81
81
|
return {count:index.records.length,complete};
|
|
82
82
|
}
|
|
83
|
-
async function importCveDirectory(store, root, {fetchedAt=Date.now(),provenance={transport:'direct'}}={}) {
|
|
83
|
+
async function importCveDirectory(store, root, {fetchedAt=Date.now(),provenance={transport:'direct'},onProgress}={}) {
|
|
84
84
|
async function* entries() {
|
|
85
85
|
const dirs=[root];
|
|
86
|
+
let processed=0;
|
|
86
87
|
while (dirs.length) {
|
|
87
88
|
const dir=dirs.pop();
|
|
88
89
|
for (const entry of await fs.promises.readdir(dir,{withFileTypes:true})) {
|
|
@@ -93,6 +94,7 @@ async function importCveDirectory(store, root, {fetchedAt=Date.now(),provenance=
|
|
|
93
94
|
const raw=JSON.parse(await fs.promises.readFile(file,'utf8'));
|
|
94
95
|
if (raw?.cveMetadata?.cveId?.toLowerCase() !== entry.name.slice(0,-5).toLowerCase()) throw new Error('CVEProject record filename mismatch');
|
|
95
96
|
yield cveEnvelope(raw,{fetchedAt,provenance});
|
|
97
|
+
if (++processed % 5000 === 0) onProgress?.(processed);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
}
|
|
@@ -117,7 +119,7 @@ module.exports.projectedCveEnvelope=projectedCveEnvelope;
|
|
|
117
119
|
* for which any native revision or rejection is known. Legacy lacks per-record
|
|
118
120
|
* revision stamps, so its coverage remains explicitly partial. */
|
|
119
121
|
function matchCveStore(deps, store, legacyIndex = null) {
|
|
120
|
-
const {newIndex,addToIndex,extractMavenRelevantCve}=require('
|
|
122
|
+
const {newIndex,addToIndex,extractMavenRelevantCve}=require('../providers/cveproject/download');
|
|
121
123
|
const {matchDepsAgainstCves}=require('./cve-match');
|
|
122
124
|
const index=newIndex(), legacyStoreIndex=newIndex(), seen=new Set(), legacySeen=new Set();
|
|
123
125
|
for (const dep of deps.values()) {
|
|
@@ -160,13 +162,13 @@ module.exports.matchCveStore=matchCveStore;
|
|
|
160
162
|
// version strictly above every affected upper bound, a matching independent
|
|
161
163
|
// OSV advisory can corroborate the negative without changing CVE semantics.
|
|
162
164
|
function corroboratedNpmNegative(store, record, name, version, entries) {
|
|
163
|
-
const compare=require('
|
|
165
|
+
const compare=require('../providers/osv/db').compareSemver;
|
|
164
166
|
if (!entries.length || entries.some(a => a.platforms?.length || a.defaultStatus !== 'unaffected' ||
|
|
165
167
|
!Array.isArray(a.versions) || !a.versions.length || a.versions.some(v =>
|
|
166
168
|
!v || v.status !== 'affected' || String(v.versionType || '').toLowerCase() !== 'custom' ||
|
|
167
169
|
v.changes?.length || (!!v.lessThan === !!v.lessThanOrEqual) ||
|
|
168
170
|
compare(String(version), String(v.lessThan || v.lessThanOrEqual)) !== 1))) return false;
|
|
169
|
-
const {packageName}=require('./
|
|
171
|
+
const {packageName}=require('./store'), {vulnVerdict}=require('../providers/osv/db');
|
|
170
172
|
const docs=store.getPackageRecords('npm',name,{source:'osv'}).filter(item => {
|
|
171
173
|
const doc=item.document;
|
|
172
174
|
return !item.withdrawnAt && !doc?.withdrawn && [doc?.id,...(doc?.aliases || [])].includes(record.id);
|
|
@@ -182,10 +184,10 @@ function corroboratedNpmNegative(store, record, name, version, entries) {
|
|
|
182
184
|
/** Match explicit npm PURLs in native CVEProject records. A missing package
|
|
183
185
|
* or undecidable range is never interpreted as proof that it is unaffected. */
|
|
184
186
|
function matchNativeNpmCves(deps, store) {
|
|
185
|
-
const {extractAffectedRanges}=require('
|
|
186
|
-
const {affectedVerdict}=require('
|
|
187
|
-
const {osvPkgName}=require('
|
|
188
|
-
const {packageName}=require('./
|
|
187
|
+
const {extractAffectedRanges}=require('../providers/cveproject/download');
|
|
188
|
+
const {affectedVerdict}=require('../providers/cveproject/version-verdict');
|
|
189
|
+
const {osvPkgName}=require('../providers/osv/query');
|
|
190
|
+
const {packageName}=require('./store');
|
|
189
191
|
const matches=[], unknown=[], seen=new Set();
|
|
190
192
|
for(const dep of deps.values()) {
|
|
191
193
|
if(!['npm','yarn'].includes(dep.ecosystem) || dep.provenance==='binary')continue;
|
|
@@ -232,8 +234,8 @@ module.exports.matchNativeNpmCves=matchNativeNpmCves;
|
|
|
232
234
|
/** Use the existing GCVE matcher on native candidates and filter legacy IDs
|
|
233
235
|
* superseded by any native revision, including rejected records. */
|
|
234
236
|
function matchGcveStore(deps, store, legacyIndex = null) {
|
|
235
|
-
const {buildGcveIndex,matchGcveDeps}=require('
|
|
236
|
-
const {osvEcosystemFor,osvPkgName}=require('
|
|
237
|
+
const {buildGcveIndex,matchGcveDeps}=require('../providers/gcve/local-index');
|
|
238
|
+
const {osvEcosystemFor,osvPkgName}=require('../providers/osv/query');
|
|
237
239
|
const native=new Map();
|
|
238
240
|
for (const dep of deps.values()) {
|
|
239
241
|
if (dep.provenance === 'binary') continue;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
const fs=require('node:fs');
|
|
4
4
|
const path=require('node:path');
|
|
5
|
-
const {openCacheDb}=require('
|
|
6
|
-
const {compress,decompress}=require('
|
|
7
|
-
const rules=require('./
|
|
5
|
+
const {openCacheDb}=require('../cache/db');
|
|
6
|
+
const {compress,decompress}=require('../cache/advisory-compression');
|
|
7
|
+
const rules=require('./store');
|
|
8
8
|
const {validateRecord,validateQuery,validateCoverage,packageName,packageKeys,queryKey,coverageKey,advisoryId,queryCoversRecord,isWithdrawn,revision,wins,hash,key}=rules;
|
|
9
9
|
const DEFAULT_QUERY_TTL_MS=4 * 3600e3;
|
|
10
10
|
const parse=value=>JSON.parse(value);
|
|
11
11
|
const text=value=>JSON.stringify(value);
|
|
12
12
|
|
|
13
13
|
class SqliteAdvisoryStore {
|
|
14
|
-
constructor({cacheDir=require('
|
|
14
|
+
constructor({cacheDir=require('../cache/directory').getCacheDir()}={}){
|
|
15
15
|
this.cacheDir=cacheDir;
|
|
16
16
|
this.db=openCacheDb({cacheDir});
|
|
17
17
|
}
|
|
@@ -103,7 +103,7 @@ class SqliteAdvisoryStore {
|
|
|
103
103
|
let coverageEcosystem=tuple.ecosystem;
|
|
104
104
|
let current=this.db.prepare("SELECT * FROM advisory_coverage WHERE source=? AND ecosystem=? AND slot='current'").get(source,coverageEcosystem);
|
|
105
105
|
if(!current && source==='osv' && tuple.name){
|
|
106
|
-
coverageEcosystem=require('
|
|
106
|
+
coverageEcosystem=require('../cache/airgap-project').packageScope(tuple.ecosystem,tuple.name);
|
|
107
107
|
current=this.db.prepare("SELECT * FROM advisory_coverage WHERE source=? AND ecosystem=? AND slot='current'").get(source,coverageEcosystem);
|
|
108
108
|
}
|
|
109
109
|
if(!current)return null;
|
|
@@ -147,7 +147,7 @@ function* journalTransactions(file, { allowTail = false } = {}) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
class AdvisoryStore {
|
|
150
|
-
constructor({ cacheDir = require('
|
|
150
|
+
constructor({ cacheDir = require('../cache/directory').getCacheDir() } = {}) {
|
|
151
151
|
this.directory = path.join(cacheDir, 'advisory-store');
|
|
152
152
|
this.journal = path.join(this.directory, 'events.jsonl');
|
|
153
153
|
this.checkpoint = path.join(this.directory, 'checkpoint.json');
|
|
@@ -480,5 +480,5 @@ class AdvisoryStore {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
function openAdvisoryStore(options) { return require('./
|
|
483
|
+
function openAdvisoryStore(options) { return require('./store-sqlite').openAdvisoryStore(options); }
|
|
484
484
|
module.exports = { openAdvisoryStore, AdvisoryStore, DEFAULT_QUERY_TTL_MS, validateRecord, validateQuery, validateCoverage, packageName, packageKeys, queryKey, coverageKey, recordKey, advisoryId, queryCoversRecord, isWithdrawn, selectAdvisoryRecord, revision, wins, hash, key, journalTransactions };
|
|
@@ -53,7 +53,9 @@ function buildApplicationRelations(srcRoot, applications = [], components = [],
|
|
|
53
53
|
depCoordKey: item.dep.coordKey, version: item.occurrence.version,
|
|
54
54
|
manifestPath: item.occurrence.manifestPath,
|
|
55
55
|
applicationRelation: !component ? "unknown" :
|
|
56
|
-
component.coord?.toLowerCase() === item.coord && TARGET_KINDS.has(component.kind)
|
|
56
|
+
(component.coord?.toLowerCase() === item.coord && TARGET_KINDS.has(component.kind)) ||
|
|
57
|
+
(["core","framework"].includes(component.kind) && path.posix.dirname(item.relManifest) === app.root &&
|
|
58
|
+
item.occurrence.managerRelation === "direct") ? "direct" : "indirect",
|
|
57
59
|
attributionStatus: component ? "confirmed" : "unknown", proof,
|
|
58
60
|
dependencyPath,
|
|
59
61
|
});
|