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,10 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// Record retrieval is distinct from dependency/advisory discovery. These facts
|
|
3
|
-
// describe already identified CVEs
|
|
4
|
-
const {failureKey}=require('
|
|
3
|
+
// describe already identified CVEs. An uncovered ID invalidates the scan.
|
|
4
|
+
const {failureKey}=require('../providers/common');
|
|
5
5
|
const recordSources=new Set(['nvd','euvd','euvd-details']);
|
|
6
6
|
const cveIds=cve=>[...new Set([cve?.id,...(cve?.aliases||[]),...(cve?.upstream||[])]
|
|
7
7
|
.filter(id=>typeof id==='string' && /^CVE-\d{4}-\d{4,}$/i.test(id)).map(id=>id.toUpperCase()))];
|
|
8
|
+
function usableText(...values) {
|
|
9
|
+
return values.find(value=>typeof value==='string' && value.trim() &&
|
|
10
|
+
!/^(?:CVE-\d{4}-\d+|(?:no |missing |unknown )?description(?: available)?|n\/a|unknown|reserved|\*\* reserved \*\*)[.! ]*$/i.test(value.trim().replace(/^\[([^\]]+)\]$/, '$1')))?.trim() || '';
|
|
11
|
+
}
|
|
12
|
+
function advisoryDescription(cve,id,ids=cveIds(cve)) {
|
|
13
|
+
if(id!==String(cve.id).toUpperCase() && !(ids.length===1 && ids[0]===id))return '';
|
|
14
|
+
return usableText(cve.description,cve.summary);
|
|
15
|
+
}
|
|
8
16
|
function reasonOf(value,fallback='unavailable') {
|
|
9
17
|
const text=String(value?.reason||value?.failure?.reason||value||'');
|
|
10
18
|
const status=value?.failure?.status || value?.statusCode || (typeof value?.status==='number'?value.status:null);
|
|
@@ -42,7 +50,7 @@ function summarizeCveRecords(matches=[],opts={}) {
|
|
|
42
50
|
for(const id of ids){
|
|
43
51
|
const evidence=(cve.cveEvidence||[]).find(e=>String(e.id).toUpperCase()===id)||{};
|
|
44
52
|
const nvd=evidence.nvdRecordEvidence || (String(cve.id).toUpperCase()===id?cve.nvdRecordEvidence:null);
|
|
45
|
-
const nvdRecord=cve.nvdEvidence?.records?.
|
|
53
|
+
const nvdRecord=cve.nvdEvidence?.records?.find(r=>String(r.id).toUpperCase()===id);
|
|
46
54
|
const euvdEvidence=evidence.euvdDetailsEvidence || (ids.length===1?cve.euvdDetailsEvidence:null)||{};
|
|
47
55
|
const mapping=evidence.euvdEvidence || (ids.length===1?cve.euvdEvidence:null)||{};
|
|
48
56
|
const detail=evidence.euvdDetails || (ids.length===1?cve.euvdDetails:null);
|
|
@@ -53,6 +61,14 @@ function summarizeCveRecords(matches=[],opts={}) {
|
|
|
53
61
|
euvd:{status:hasDetail?'available':mapping.status==='no-match'?'no-match':'unavailable',stale:!!euvdEvidence.stale,
|
|
54
62
|
refreshFailed:!!mapping.refreshFailed || (hasDetail && !!euvdEvidence.failure),...((!hasDetail || euvdEvidence.stale || mapping.refreshFailed)?{reason:reasonOf(euvdReason)}:{})}};
|
|
55
63
|
for(const source of ['nvd','euvd']){const state=states[source];store(id,source,active[source]?{...state,...((state.reason || state.status!=='available')?{reason:reasonOf(state.reason,state.status==='no-match'?'not listed':'unavailable')}:{})}:{status:'disabled',reason:'disabled'});}
|
|
64
|
+
const ownDescription=advisoryDescription(cve,id,ids);
|
|
65
|
+
const text=usableText(nvdRecord?.description,detail?.description,evidence.descriptionEvidence?.description);
|
|
66
|
+
const record=byId.get(id);
|
|
67
|
+
if(ownDescription || text)record.hasDescription=true;
|
|
68
|
+
if(nvdRecord || hasDetail || evidence.descriptionEvidence?.source && text ||
|
|
69
|
+
(cve.sourceAdvisoryId && String(cve.id).toUpperCase()===id) ||
|
|
70
|
+
(cve.id===id && cve.riskEvidence?.source==='cveproject') ||
|
|
71
|
+
(ownDescription && match.source && match.source!=='cache'))record.hasRecord=true;
|
|
56
72
|
if(active.nvd){keys.add(failureKey('nvd','cve',{id}));keys.add(failureKey('nvd','cve-mirror',{id}));}
|
|
57
73
|
const euvdId=detail?.id || evidence.euvd?.id || (ids.length===1?cve.euvd?.id:null);
|
|
58
74
|
if(active.euvd && euvdId)keys.add(failureKey('euvd','vulnerability',{id:euvdId}));
|
|
@@ -61,49 +77,38 @@ function summarizeCveRecords(matches=[],opts={}) {
|
|
|
61
77
|
const records=[...byId.values()].sort((a,b)=>a.id.localeCompare(b.id));
|
|
62
78
|
const groups={neither:[],nvdOnly:[],euvdOnly:[],refreshFailed:[],stale:[]};
|
|
63
79
|
for(const r of records){const n=r.nvd.status==='available',e=r.euvd.status==='available';
|
|
64
|
-
if(!
|
|
80
|
+
if(!r.hasDescription)groups.neither.push(r);
|
|
81
|
+
if(n&&!e)groups.nvdOnly.push(r);else if(e&&!n)groups.euvdOnly.push(r);
|
|
65
82
|
if(r.nvd.refreshFailed||r.euvd.refreshFailed)groups.refreshFailed.push(r);
|
|
66
83
|
if(r.nvd.stale||r.euvd.stale)groups.stale.push(r);
|
|
67
84
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const warning=
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
// A distribution erratum can cite a CVE identifier that is reserved but not published yet.
|
|
86
|
+
// When a record source answered, up to date, that it holds no such CVE, there is no record
|
|
87
|
+
// to retrieve: that is a fact about the identifier, not a gap in this scan.
|
|
88
|
+
const answeredNone=state=>state.status==='no-match' && !state.stale && !state.refreshFailed;
|
|
89
|
+
const unpublished=records.filter(r=>!r.hasRecord && (active.nvd ? answeredNone(r.nvd) : active.euvd && answeredNone(r.euvd)));
|
|
90
|
+
const counts={...Object.fromEntries(Object.entries(groups).map(([key,rows])=>[key,rows.length])),unpublished:unpublished.length};
|
|
91
|
+
const missingRecords=records.filter(r=>!r.hasRecord && !unpublished.includes(r));
|
|
92
|
+
const undescribed=groups.neither.filter(r=>!unpublished.includes(r));
|
|
93
|
+
const failures=missingRecords.length ? missingRecords : undescribed.length ? undescribed : unpublished;
|
|
94
|
+
const onlyUnpublished=!missingRecords.length && !undescribed.length && unpublished.length>0;
|
|
95
|
+
const warning=failures.length ? {
|
|
96
|
+
type:'cve-enrichment-summary',severity:onlyUnpublished?'info':'warning',reliabilityFailure:!!missingRecords.length,affectsCompleteness:!!missingRecords.length,count:failures.length,consultedCount:records.length,
|
|
97
|
+
...(onlyUnpublished?{unpublished:true}:{}),
|
|
98
|
+
counts,records:failures,items:failures.map(r=>({id:r.id})),requestKeys:[...keys],
|
|
99
|
+
message:missingRecords.length ? `No usable source record for ${missingRecords.length} CVE(s).`
|
|
100
|
+
: undescribed.length ? `The advisories used for this assessment contain no description for ${failures.length} CVE(s).`
|
|
101
|
+
: `${failures.length} CVE identifier(s) cited by advisories are not published yet: the CVE record sources hold no entry for them.`
|
|
102
|
+
}:null;
|
|
103
|
+
return {warning,records,requestKeys:[...keys],coverage:{capability:'enrichment',collector:'cve-records',affectsCompleteness:!!missingRecords.length,
|
|
104
|
+
execution:records.length?(missingRecords.length?'partial':'completed'):'not-applicable',count:records.length,available:records.length-missingRecords.length,missing:missingRecords.length}};
|
|
105
|
+
|
|
82
106
|
}
|
|
83
107
|
// Report-owned wording only: never translate or reproduce upstream text.
|
|
84
108
|
function formatCveRecordWarning(warning, locale='en') {
|
|
85
109
|
if(!String(locale).toLowerCase().startsWith('fr'))return warning.message || '';
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const label=reason=>names[reason] || (/^HTTP \d{3}$/.test(reason||'')?reason:'indisponible');
|
|
90
|
-
const reasons=(rows,sources)=>{
|
|
91
|
-
const tally=new Map();
|
|
92
|
-
for(const r of rows)for(const source of sources)if(active(source)&&r[source]?.status!=='available'){
|
|
93
|
-
const text=`${source.toUpperCase()} : ${label(r[source]?.reason)}`;tally.set(text,(tally.get(text)||0)+1);
|
|
94
|
-
}
|
|
95
|
-
return [...tally].sort().map(([text,n])=>`${text} ${n}`).join(', ');
|
|
96
|
-
};
|
|
97
|
-
const groups={neither:records.filter(r=>r.nvd?.status!=='available'&&r.euvd?.status!=='available'),nvdOnly:records.filter(r=>r.nvd?.status==='available'&&r.euvd?.status!=='available'),euvdOnly:records.filter(r=>r.euvd?.status==='available'&&r.nvd?.status!=='available')};
|
|
98
|
-
const parts=[];
|
|
99
|
-
if(counts.neither)parts.push(`${counts.neither} fiche(s) CVE obtenue(s) ni auprès de NVD ni auprès d’EUVD (${reasons(groups.neither,['nvd','euvd'])})`);
|
|
100
|
-
if(active('euvd')&&counts.nvdOnly)parts.push(`${counts.nvdOnly} obtenue(s) uniquement auprès de NVD (${reasons(groups.nvdOnly,['euvd'])})`);
|
|
101
|
-
if(active('nvd')&&counts.euvdOnly)parts.push(`${counts.euvdOnly} obtenue(s) uniquement auprès d’EUVD (${reasons(groups.euvdOnly,['nvd'])})`);
|
|
102
|
-
if(counts.refreshFailed){
|
|
103
|
-
const why=[...new Set(records.flatMap(r=>['nvd','euvd'].flatMap(source=>(r[source]?.refreshFailureReasons||[]).map(reason=>`${source.toUpperCase()} : ${label(reason)}`))))].sort();
|
|
104
|
-
parts.push(`${counts.refreshFailed} actualisation(s) de fiche CVE échouée(s) (${why.join(', ')})`);
|
|
105
|
-
}
|
|
106
|
-
if(counts.stale)parts.push(`${counts.stale} CVE utilisent des fiches en cache dont l’actualisation n’est pas confirmée`);
|
|
107
|
-
return `Fiches CVE : ${parts.join(' ; ')}. Les résultats existants sont conservés ; cet avertissement concerne uniquement l’enrichissement.`;
|
|
110
|
+
if(warning.reliabilityFailure)return `Aucune fiche source exploitable pour ${warning.count} CVE.`;
|
|
111
|
+
if(warning.unpublished)return `${warning.count} identifiant(s) CVE cités par des avis ne sont pas encore publiés : les sources de fiches CVE n'en ont aucune.`;
|
|
112
|
+
return `Les avis utilisés pour cet audit ne contiennent aucune description pour ${warning.count} CVE.`;
|
|
108
113
|
}
|
|
109
|
-
module.exports={summarizeCveRecords,formatCveRecordWarning,cveIds,recordSources};
|
|
114
|
+
module.exports={summarizeCveRecords,formatCveRecordWarning,cveIds,recordSources,usableText,advisoryDescription};
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// Shared European context for already identified CVEs. This module does not
|
|
3
3
|
// discover package vulnerabilities or change version applicability.
|
|
4
|
-
const {createCacheRepository}=require('
|
|
5
|
-
const {getCacheDir}=require('
|
|
4
|
+
const {createCacheRepository}=require('../cache/repository');
|
|
5
|
+
const {getCacheDir}=require('../cache/directory');
|
|
6
6
|
const TTL=4*3600*1000;
|
|
7
7
|
const CVE=/^CVE-\d{4}-\d{4,}$/i;
|
|
8
8
|
const ids=c=>[...new Set([c?.id,...(c?.aliases||[]),...(c?.upstream||[])].filter(x=>typeof x==='string'&&CVE.test(x)).map(x=>x.toUpperCase()))];
|
|
@@ -15,7 +15,7 @@ function assign(matches,id,key,value){
|
|
|
15
15
|
}
|
|
16
16
|
function responseTime(res){const at=Date.parse(res.headers?.get?.('x-fad-proxy-fetched-at')||'');const valid=Number.isFinite(at)&&at>0&&at<=Date.now()+300000;return {fetchedAt:valid?at:null,stale:!valid||res.headers?.get?.('x-fad-proxy')==='stale'};}
|
|
17
17
|
function freshness(stamp,stale,offline=false){return !!stale || !stamp || (!offline && Date.now()-stamp>=TTL);}
|
|
18
|
-
|
|
18
|
+
const {severityFromScore}=require('./severity');
|
|
19
19
|
async function boundedJson(response,maxBytes){
|
|
20
20
|
const budgetError=()=>{const error=Error(`EUVD response exceeds the scanner's ${maxBytes}-byte metadata budget`);error.code='metadata-budget-exceeded';return error;};
|
|
21
21
|
const declared=Number(response.headers?.get?.('content-length'));if(declared>maxBytes){await response.body?.cancel();throw budgetError();}
|
|
@@ -32,12 +32,12 @@ function parseEuvdDetail(body,id,cve){
|
|
|
32
32
|
const text=(x,max)=>typeof x==='string' && x.length<=max ? x : null;
|
|
33
33
|
const rawRefs=Array.isArray(body.references)?body.references:typeof body.references==='string'?body.references.split(/\s+/):[];
|
|
34
34
|
const references=rawRefs.map(x=>typeof x==='string'?x:x?.url).filter(x=>typeof x==='string').slice(0,1000).filter(x=>{try{const u=new URL(x);return ['http:','https:'].includes(u.protocol)&&!u.username&&!u.password;}catch{return false;}});
|
|
35
|
-
const date=raw=>require('
|
|
35
|
+
const date=raw=>require('../providers/euvd/enrich').normalizeEuvdCalendarDate(text(raw,128));
|
|
36
36
|
return {id,source:'euvd',description:text(body.description,100000),score,severity:score===null?null:severityFromScore(score),cvssVersion:version,
|
|
37
37
|
cvssVector:text(body.baseScoreVector,1024),published:date(body.datePublished),modified:date(body.dateUpdated),publishedOriginal:text(body.datePublished,128),modifiedOriginal:text(body.dateUpdated,128),references};
|
|
38
38
|
}
|
|
39
39
|
function applyEuvdDetails(matches,id,detail){
|
|
40
|
-
detail=require('
|
|
40
|
+
detail=require('../providers/euvd/enrich').normalizeEuvdDetailDates(detail);
|
|
41
41
|
for(const m of matches){if(!ids(m.cve).includes(id))continue;const c=m.cve;record(c,id).euvdDetails=detail;
|
|
42
42
|
if(ids(c).length!==1)continue;
|
|
43
43
|
const identity=String(c.id||'').toUpperCase()===id || (c.aliases||[]).some(x=>String(x).toUpperCase()===id);
|
|
@@ -58,8 +58,8 @@ function applyEuvdDetails(matches,id,detail){
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const europeanAdapters=[
|
|
61
|
-
{id:'gcve',async run(matches,opts,context){for(const id of context.ids){const value=require('
|
|
62
|
-
for(const m of
|
|
61
|
+
{id:'gcve',async run(matches,opts,context){for(const id of context.ids){const value=require('../providers/gcve/id').gcveId(id);if(!value)continue;
|
|
62
|
+
for(const m of context.byId.get(id)){const c=m.cve;const entry=record(c,id);entry.gcveAlias=value;entry.gcveEvidence={kind:'derived-alias',source:'gcve-rules'};
|
|
63
63
|
const identity=String(c.id||'').toUpperCase()===id || (ids(c).length===1 && (c.aliases||[]).some(x=>String(x).toUpperCase()===id));
|
|
64
64
|
if(identity && !c.gcve){c.gcve=value;c.gcveEvidence=entry.gcveEvidence;}
|
|
65
65
|
}
|
|
@@ -67,15 +67,15 @@ const europeanAdapters=[
|
|
|
67
67
|
{id:'euvd',async run(matches,opts,context){
|
|
68
68
|
const copies=context.ids.map(id=>({cve:{id}}));
|
|
69
69
|
let failure=null;
|
|
70
|
-
await require('
|
|
70
|
+
await require('../providers/euvd/enrich').enrichEuvd(copies,{...opts,hostedProxy:context.hosted,onEuvdFailure:error=>{failure=error.message;}});
|
|
71
71
|
const targeted=context.repo.get('catalogue','euvd-targeted')?.value?.entries || {},bulkEntry=context.repo.get('catalogue','euvd'),bulk=bulkEntry?.value;
|
|
72
72
|
let consulted=0,stale=0,matched=0;
|
|
73
73
|
for(const copy of copies){const id=copy.cve.id,entry=targeted[id];let available=false,old=false;
|
|
74
74
|
if(entry && (opts.offline || context.hosted)){available=true;old=freshness(entry.fetchedAt,entry.stale,opts.offline);}
|
|
75
75
|
else if(bulk?.body?.byCve && typeof bulk.body.byCve==='object'){available=true;old=freshness(bulk._fetchedAt,bulkEntry.stale,opts.offline);}
|
|
76
|
-
if(!available){assign(
|
|
77
|
-
assign(
|
|
78
|
-
if(copy.cve.euvd){assign(
|
|
76
|
+
if(!available){assign(context.byId.get(id),id,'euvdEvidence',{status:'unavailable',reason:failure || (opts.offline?'offline':'unavailable')});continue;}consulted++;if(old)stale++;
|
|
77
|
+
assign(context.byId.get(id),id,'euvdEvidence',{status:copy.cve.euvd?'enriched':'no-match',stale:old,...(failure?{reason:failure,refreshFailed:true}:{})});
|
|
78
|
+
if(copy.cve.euvd){assign(context.byId.get(id),id,'euvd',copy.cve.euvd);matched++;}
|
|
79
79
|
}
|
|
80
80
|
return {result:matched?'enriched':consulted===context.ids.length?'no-match':'unavailable',count:matched,consulted,missing:context.ids.length-consulted,stale};
|
|
81
81
|
}},
|
|
@@ -85,35 +85,43 @@ const europeanAdapters=[
|
|
|
85
85
|
// exceed 12 MiB. Keep a configurable finite bound without truncating them.
|
|
86
86
|
const limit=opts.maxEuvdDetails ?? 10000,maxBytes=opts.maxEuvdMetadataBytes ?? 32*1024*1024;
|
|
87
87
|
if(!Number.isSafeInteger(limit)||limit<1||!Number.isSafeInteger(maxBytes)||maxBytes<1)throw Error('invalid EUVD metadata limits');
|
|
88
|
+
// One ENISA record per CVE, each up to several megabytes: ten thousand requests for a
|
|
89
|
+
// kernel package get the caller throttled, then refused. A record is requested where it
|
|
90
|
+
// adds something: a CVE still lacking a score, a severity or a description, or a finding
|
|
91
|
+
// reported in full detail (lib/reports/detail.js). A record already in the cache is always used.
|
|
92
|
+
const beyond=require('../reports/detail').beyondDetailLimit(matches);
|
|
93
|
+
const lacking=c=>c.score==null||!c.severity||c.severity==='UNKNOWN'||!c.description;
|
|
94
|
+
const worthRecord=related=>related.some(m=>!beyond.has(m)||lacking(m.cve));
|
|
88
95
|
for(const id of context.ids){
|
|
89
|
-
const related=
|
|
96
|
+
const related=context.byId.get(id);
|
|
90
97
|
const euvd=related.map(m=>m.cve.cveEvidence?.find(x=>x.id===id)?.euvd?.id).find(Boolean);
|
|
91
|
-
if(!euvd){assign(
|
|
98
|
+
if(!euvd){assign(context.byId.get(id),id,'euvdDetailsEvidence',{status:'not-consulted'});continue;}
|
|
92
99
|
const old=stored.entries[id],detail=old?.details;
|
|
93
|
-
const stable=detail && !old?.detailsStale && old?.detailsFetchedAt > 0 && old.detailsFetchedAt <= Date.now() && old?.detailsOrigin === require('
|
|
94
|
-
if(detail && detail.id===euvd && (opts.offline || stable || (!opts.forceUpdate && (opts.reuseStableAdvisories === false || old.detailsOrigin === require('
|
|
95
|
-
if(
|
|
96
|
-
if(
|
|
100
|
+
const stable=detail && !old?.detailsStale && old?.detailsFetchedAt > 0 && old.detailsFetchedAt <= Date.now() && old?.detailsOrigin === require('../providers').resourceOrigin() && require('../cache/record-freshness').stableRecord('euvd',detail,opts);
|
|
101
|
+
if(detail && detail.id===euvd && (opts.offline || stable || (!opts.forceUpdate && (opts.reuseStableAdvisories === false || old.detailsOrigin === require('../providers').resourceOrigin()) && !freshness(old.detailsFetchedAt,old.detailsStale)))){applyEuvdDetails(context.byId.get(id),id,detail);enriched++;const oldStamp=stable ? false : freshness(old.detailsFetchedAt,old.detailsStale,opts.offline);const failure=oldStamp && old.detailsFailure;if(failure)failures.push(failure);assign(context.byId.get(id),id,'euvdDetailsEvidence',{status:'enriched',stale:oldStamp,...(failure?{failure}:{}),...(stable?{reusedStable:true,fetchedAt:old.detailsFetchedAt}: {})});if(oldStamp)stale++;continue;}
|
|
102
|
+
if(!worthRecord(related)){assign(context.byId.get(id),id,'euvdDetailsEvidence',{status:'not-consulted',reason:'beyond-detail-limit'});continue;}
|
|
103
|
+
if(opts.offline){missing++;const failure=old?.detailsFailure;if(failure)failures.push(failure);assign(context.byId.get(id),id,'euvdDetailsEvidence',{status:'unavailable',...(failure?{failure}:{})});continue;}
|
|
104
|
+
if(pending.length>=limit){missing++;assign(context.byId.get(id),id,'euvdDetailsEvidence',{status:'unavailable',reason:'request-limit'});continue;}const observed=related.map(m=>m.cve.cveEvidence?.find(x=>x.id===id)?.euvd).find(Boolean);pending.push({id,euvd,observed});
|
|
97
105
|
}
|
|
98
106
|
let processed=0;
|
|
99
107
|
opts.onEnrichmentProgress?.({source:'euvd-details',completed:0,total:pending.length});
|
|
100
108
|
const limitWork=require('p-limit')(6);
|
|
101
109
|
await Promise.all(pending.map(item=>limitWork(async()=>{
|
|
102
110
|
try{
|
|
103
|
-
const res=await require('
|
|
104
|
-
if(!res.ok){await res.body?.cancel();throw require('
|
|
111
|
+
const res=await require('../providers').getResource('euvd','vulnerability',{id:item.euvd},{fetcher:opts.fetcher,streaming:true,noStore:true,forceRefresh:opts.forceUpdate || require('../cache/policy').shouldForceUpdate()});
|
|
112
|
+
if(!res.ok){await res.body?.cancel();throw require('../providers/request-failure').responseError('EUVD detail',res,{viaProxy:require('../providers').hasProxyRoute()});}
|
|
105
113
|
const detail=parseEuvdDetail(await boundedJson(res,maxBytes),item.euvd,item.id);
|
|
106
|
-
const stamp=require('
|
|
114
|
+
const stamp=require('../providers').hasProxyRoute()?responseTime(res):{fetchedAt:Date.now(),stale:false};
|
|
107
115
|
const scope=res.headers.get('x-fad-proxy-scope'),checked=res.headers.get('x-fad-proxy-checked-at'),rawStaleReason=res.headers.get('x-fad-proxy-stale-reason');
|
|
108
116
|
const staleReason=rawStaleReason && /^[a-z0-9-]{1,80}$/.test(rawStaleReason) ? rawStaleReason : null;
|
|
109
117
|
const checkedAt=checked && Number.isFinite(Date.parse(checked)) ? new Date(Date.parse(checked)).toISOString() : null;
|
|
110
|
-
detail.provenance={resource:require('
|
|
118
|
+
detail.provenance={resource:require('../providers/euvd').build('vulnerability',{id:item.euvd}).url,origin:require('../providers').resourceOrigin(),sourceScope:scope && scope.length<=256 ? scope : (require('../providers').hasProxyRoute() ? 'unspecified' : 'enisa-detail'),observedAt:stamp.fetchedAt ? new Date(stamp.fetchedAt).toISOString() : null,...(checkedAt?{checkedAt}:{}),...(staleReason?{staleReason}:{})};
|
|
111
119
|
const existing=stored.entries[item.id]||{},bulk=context.repo.get('catalogue','euvd')?.value;
|
|
112
120
|
const mappingAt=existing.fetchedAt || bulk?._fetchedAt || stamp.fetchedAt;
|
|
113
|
-
stored.entries[item.id]={...existing,item:existing.item || item.observed,fetchedAt:mappingAt,stale:existing.stale ?? freshness(mappingAt,false),details:detail,detailsFetchedAt:stamp.fetchedAt,detailsStale:stamp.stale,detailsOrigin:require('
|
|
114
|
-
let failure;if(stamp.stale && staleReason){const http=/^upstream-http-(\d{3})$/.exec(staleReason);failure={code:'source-refresh-failed',source:'euvd-details',status:http?Number(http[1]):null,requestKey:require('
|
|
115
|
-
applyEuvdDetails(
|
|
116
|
-
}catch(error){const old=stored.entries[item.id]||{},failure={code:error.code||'source-request-failed',source:'euvd-details',status:error.status||null,requestKey:require('
|
|
121
|
+
stored.entries[item.id]={...existing,item:existing.item || item.observed,fetchedAt:mappingAt,stale:existing.stale ?? freshness(mappingAt,false),details:detail,detailsFetchedAt:stamp.fetchedAt,detailsStale:stamp.stale,detailsOrigin:require('../providers').resourceOrigin()};delete stored.entries[item.id].detailsFailure;
|
|
122
|
+
let failure;if(stamp.stale && staleReason){const http=/^upstream-http-(\d{3})$/.exec(staleReason);failure={code:'source-refresh-failed',source:'euvd-details',status:http?Number(http[1]):null,requestKey:require('../providers/common').failureKey('euvd','vulnerability',{id:item.euvd}),reason:`EUVD mirror refresh failed (${staleReason}); cached detail retained`,resources:[item.euvd],attemptedAt:Date.now()};failures.push(failure);stored.entries[item.id].detailsFailure=failure;}
|
|
123
|
+
applyEuvdDetails(context.byId.get(item.id),item.id,detail);assign(context.byId.get(item.id),item.id,'euvdDetailsEvidence',{status:'enriched',stale:stamp.stale,...(failure?{failure}:{})});enriched++;if(stamp.stale)stale++;
|
|
124
|
+
}catch(error){const old=stored.entries[item.id]||{},failure={code:error.code||'source-request-failed',source:'euvd-details',status:error.status||null,requestKey:require('../providers/common').failureKey('euvd','vulnerability',{id:item.euvd}),...(error.layer?{layer:error.layer}:{}),...(error.retryAfterSeconds!=null?{retryAfterSeconds:error.retryAfterSeconds}:{}),reason:error.message,resources:[item.euvd],attemptedAt:Date.now()};failures.push(failure);stored.entries[item.id]={...old,item:old.item||item.observed,detailsFailure:failure};if(old.details?.id===item.euvd){applyEuvdDetails(context.byId.get(item.id),item.id,old.details);assign(context.byId.get(item.id),item.id,'euvdDetailsEvidence',{status:'enriched',stale:true,failure});enriched++;stale++;}else{missing++;assign(context.byId.get(item.id),item.id,'euvdDetailsEvidence',{status:'unavailable',failure});}}
|
|
117
125
|
processed++;opts.onEnrichmentProgress?.({source:'euvd-details',completed:processed,total:pending.length});
|
|
118
126
|
})));
|
|
119
127
|
if(pending.length)context.repo.put('catalogue','euvd-targeted',stored);
|
|
@@ -122,18 +130,18 @@ const europeanAdapters=[
|
|
|
122
130
|
{id:'certfr',async run(matches,opts,context){
|
|
123
131
|
const copies=context.ids.map(id=>({cve:{id}})),saved=context.repo.get('catalogue','certfr-targeted')?.value || {entries:{}};
|
|
124
132
|
if(context.hosted&&!opts.offline){
|
|
125
|
-
for(let i=0;i<context.ids.length;i+=100){const request=context.ids.slice(i,i+100),res=await require('
|
|
133
|
+
for(let i=0;i<context.ids.length;i+=100){const request=context.ids.slice(i,i+100),res=await require('../providers').getResource('certfr','cves',{ids:request},{fetcher:opts.fetcher,noStore:true,streaming:true});
|
|
126
134
|
if(!res.ok)throw Error(`hosted CERT-FR unavailable (HTTP ${res.status})`);const payload=await res.json();if(!Array.isArray(payload.items))throw Error('invalid hosted CERT-FR response');
|
|
127
135
|
const byId=new Map();for(const item of payload.items){if(!item||!request.includes(item.cve)||byId.has(item.cve)||!Array.isArray(item.advisories))throw Error('invalid hosted CERT-FR record');byId.set(item.cve,item.advisories);}
|
|
128
136
|
const stamp=responseTime(res);for(const id of request)saved.entries[id]={items:byId.get(id)||[],...stamp};
|
|
129
137
|
}
|
|
130
138
|
context.repo.put('catalogue','certfr-targeted',saved);
|
|
131
|
-
}else if(!opts.offline)await require('
|
|
132
|
-
const bulkEntry=context.repo.get('catalogue','certfr'),bulk=bulkEntry?.value;const bulkByCve=opts.offline && bulk?.entries ? require('
|
|
139
|
+
}else if(!opts.offline)await require('../providers/certfr/enrich').enrichCertFr(copies,{...opts,hostedProxy:false});
|
|
140
|
+
const bulkEntry=context.repo.get('catalogue','certfr'),bulk=bulkEntry?.value;const bulkByCve=opts.offline && bulk?.entries ? require('../providers/certfr/enrich').indexByCve(bulk.entries) : null;let consulted=0,stale=0,matched=0;
|
|
133
141
|
for(const copy of copies){const id=copy.cve.id,entry=saved.entries[id];let hits=copy.cve.certfr,available=false,old=false;
|
|
134
142
|
if(entry && (opts.offline||context.hosted)){available=true;old=freshness(entry.fetchedAt,entry.stale,opts.offline);hits=entry.items;}
|
|
135
143
|
else if(bulk?.entries && typeof bulk.entries==='object' && bulk.meta?.fetchedAt){available=true;old=freshness(bulk.meta.fetchedAt,bulkEntry.stale,opts.offline);if(opts.offline)hits=bulkByCve[id];}
|
|
136
|
-
if(!available){assign(
|
|
144
|
+
if(!available){assign(context.byId.get(id),id,'certfrEvidence',{status:'unavailable'});continue;}consulted++;if(old)stale++;assign(context.byId.get(id),id,'certfrEvidence',{status:hits?.length?'enriched':'no-match',stale:old});if(hits?.length){assign(context.byId.get(id),id,'certfr',hits);matched++;}
|
|
137
145
|
}
|
|
138
146
|
return {result:matched?'enriched':consulted===context.ids.length?'no-match':'unavailable',count:matched,consulted,missing:context.ids.length-consulted,stale};
|
|
139
147
|
}},
|
|
@@ -146,20 +154,25 @@ const europeanAdapters=[
|
|
|
146
154
|
*/
|
|
147
155
|
async function enrichEuropeanFindings(matches,opts={}){
|
|
148
156
|
const active=opts.europeanAdapters || europeanAdapters;if(!Array.isArray(active)||active.some(a=>!a || typeof a.id!=='string'||typeof a.run!=='function'))throw Error('Invalid European enrichment adapter registry');
|
|
149
|
-
const
|
|
157
|
+
const byId=new Map();
|
|
158
|
+
for(const match of matches||[])for(const id of ids(match.cve)){if(!byId.has(id))byId.set(id,[]);byId.get(id).push(match);}
|
|
159
|
+
const context={byId,ids:[...byId.keys()],hosted:opts.hostedProxy ?? require('../providers').hasHostedProxy()};
|
|
150
160
|
let repository;
|
|
151
161
|
Object.defineProperty(context,'repo',{get(){if(!repository)repository=createCacheRepository(opts.cacheDir||getCacheDir());return repository;}});
|
|
152
162
|
const coverage=[],warnings=[];
|
|
153
163
|
for(const adapter of active){const requestKeys=[];const adapterOpts={...opts,onEuvdRequest:key=>{requestKeys.push(key);opts.onEuvdRequest?.(key);}};const disabled=opts[adapter.id]===false || (adapter.parent && opts[adapter.parent]===false) || (adapter.id==='gcve' && opts.disableGcve), evidenceKey=adapter.id==='euvd-details'?'euvdDetailsEvidence':`${adapter.id}Evidence`;
|
|
154
|
-
if(disabled){for(const id of context.ids)assign(
|
|
164
|
+
if(disabled){for(const id of context.ids)assign(context.byId.get(id),id,evidenceKey,{status:'not-consulted'});coverage.push({capability:'sources',collector:adapter.id,execution:'not-applicable',result:'not-consulted',expected:false,reason:'Excluded by source configuration.'});continue;}
|
|
155
165
|
if(!context.ids.length){coverage.push({capability:'sources',collector:adapter.id,execution:'not-applicable',result:'not-applicable'});continue;}
|
|
166
|
+
const startedAt=Date.now();
|
|
156
167
|
try{opts.onEnrichmentProgress?.({source:adapter.id,completed:0,total:context.ids.length});const result=await adapter.run(matches,adapterOpts,context);opts.onEnrichmentProgress?.({source:adapter.id,completed:context.ids.length,total:context.ids.length});if(!result || typeof result.result!=='string')throw Error('Invalid European source result');
|
|
157
168
|
const incomplete=!!result.missing||!!result.stale||result.result==='unavailable';
|
|
158
169
|
const parts=[];if(result.consulted!=null)parts.push(`${result.consulted} of ${context.ids.length} CVEs consulted`);if(result.count!=null)parts.push(`${result.count} enriched`);if(result.missing)parts.push(`${result.missing} unavailable`);if(result.stale)parts.push(`${result.stale} stale`);
|
|
159
170
|
const reason=incomplete ? (result.reason || (parts.length?parts.join('; '):'Source data unavailable.')) : result.reason;
|
|
160
171
|
coverage.push({capability:'sources',collector:adapter.id,requestKeys,execution:incomplete?'partial':result.result==='not-applicable'?'not-applicable':'completed',...result,...(reason?{reason}:{})});
|
|
161
172
|
if(incomplete)warnings.push({type:'source-unavailable',capability:'sources',source:adapter.id,...(result.failures?.length?{code:result.failures[0].code,status:result.failures[0].status,resources:result.failures.flatMap(f=>f.resources),requestKeys:result.failures.map(f=>f.requestKey).filter(Boolean),reason}:{severity:'info'}),message:`${adapter.id.toUpperCase()}: ${reason}`});
|
|
162
|
-
}catch(error){for(const id of context.ids)assign(
|
|
173
|
+
}catch(error){for(const id of context.ids)assign(context.byId.get(id),id,evidenceKey,{status:'unavailable',reason:error.message});coverage.push({capability:'sources',collector:adapter.id,requestKeys,execution:'failed',result:'unavailable',reason:error.message});warnings.push({type:'source-unavailable',capability:'sources',source:adapter.id,message:`${adapter.id.toUpperCase()}: ${error.message}`});}
|
|
174
|
+
// How long each source took: the first thing to read when a scan is slow.
|
|
175
|
+
coverage.at(-1).durationMs=Date.now()-startedAt;
|
|
163
176
|
}
|
|
164
177
|
return {coverage,warnings};
|
|
165
178
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/eu-refs.js — the European references of one CVE (EUVD, GCVE, CERT-FR), as one
|
|
2
|
+
* lib/findings/eu-refs.js — the European references of one CVE (EUVD, GCVE, CERT-FR), as one
|
|
3
3
|
* list shared by the report and every export, so a reference reads the same in the
|
|
4
4
|
* HTML, the SBOM, the CSAF and the SARIF.
|
|
5
5
|
*
|
|
6
6
|
* @author: N.BRAUN
|
|
7
7
|
* @email: pp9ping@gmail.com
|
|
8
8
|
*/
|
|
9
|
-
const { gcveUrl } = require("
|
|
10
|
-
const { certfrUrl } = require("
|
|
9
|
+
const { gcveUrl } = require("../providers/gcve/id");
|
|
10
|
+
const { certfrUrl } = require("../providers/certfr/enrich");
|
|
11
11
|
|
|
12
12
|
/** cve → [{ id, source, url, title? }]: EUVD first, then GCVE, then CERT-FR newest first. */
|
|
13
13
|
function europeanReferences(cve) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/gate.js — CI gating: decide whether a finding set should fail the build.
|
|
2
|
+
* lib/findings/gate.js — CI gating: decide whether a finding set should fail the build.
|
|
3
3
|
*
|
|
4
4
|
* Levels: none | low | medium | high | critical | kev. A severity level fails
|
|
5
5
|
* when any (non-suppressed) match is at or above it; `kev` fails only on a CISA
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/malware.js — supply-chain risk lane: known-malicious advisories + typosquat
|
|
2
|
+
* lib/findings/malware.js — supply-chain risk lane: known-malicious advisories + typosquat
|
|
3
3
|
* heuristic. Pure + fully offline (no extra network; data/popular-packages.json is bundled).
|
|
4
4
|
*
|
|
5
5
|
* Two distinct signals:
|
|
@@ -44,7 +44,7 @@ function editDistance(a, b, max) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
let _popular = null;
|
|
47
|
-
function loadPopular(file = path.join(__dirname, "..", "data", "popular-packages.json")) {
|
|
47
|
+
function loadPopular(file = path.join(__dirname, "..", "..", "data", "popular-packages.json")) {
|
|
48
48
|
if (_popular) return _popular;
|
|
49
49
|
try {
|
|
50
50
|
const j = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
@@ -54,14 +54,37 @@ function loadPopular(file = path.join(__dirname, "..", "data", "popular-packages
|
|
|
54
54
|
return _popular;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
const isMaliciousAdvisory = m => String(m.cve?.id || "").startsWith("MAL-") ||
|
|
58
|
+
(m.cve?.aliases || []).some(a => String(a).startsWith("MAL-")) || m.cve?.malicious === true;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A malicious-package advisory designates the artifact published under that name on
|
|
62
|
+
* the public registry. A dependency the lockfile resolves from elsewhere (a Git forge
|
|
63
|
+
* tarball, git+…, file:, link:, workspace:) is another artifact that only shares the
|
|
64
|
+
* name — `flot-axis` from github.com/markrcote/flot-axislabels is not the npm squat
|
|
65
|
+
* of MAL-2023-1035.
|
|
66
|
+
*/
|
|
67
|
+
function resolvedOutsideRegistry(dep) {
|
|
68
|
+
const resolved = String(dep?.resolved || "");
|
|
69
|
+
if (!resolved) return false;
|
|
70
|
+
if (/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|workspace:|portal:)/i.test(resolved)) return true;
|
|
71
|
+
let url;
|
|
72
|
+
try { url = new URL(resolved); } catch { return false; }
|
|
73
|
+
return /^(?:codeload\.)?github\.com$|^gitlab\.com$|^bitbucket\.org$/i.test(url.hostname);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Split out malicious-package advisories matched by name on a dependency resolved outside the registry. */
|
|
77
|
+
function withoutForeignMalicious(matches) {
|
|
78
|
+
const kept = [], dropped = [];
|
|
79
|
+
for (const m of matches || []) (isMaliciousAdvisory(m) && resolvedOutsideRegistry(m.dep) ? dropped : kept).push(m);
|
|
80
|
+
return { matches: kept, dropped };
|
|
81
|
+
}
|
|
82
|
+
|
|
57
83
|
/** Mark matches that are known-malicious advisories. Mutates + returns the count. */
|
|
58
84
|
function flagMalicious(matches) {
|
|
59
85
|
let n = 0;
|
|
60
86
|
for (const m of matches || []) {
|
|
61
|
-
|
|
62
|
-
const aliases = m.cve?.aliases || [];
|
|
63
|
-
const isMal = id.startsWith("MAL-") || aliases.some(a => String(a).startsWith("MAL-")) || m.cve?.malicious === true;
|
|
64
|
-
if (isMal) { m.malicious = true; if (m.cve) m.cve.malicious = true; n++; }
|
|
87
|
+
if (isMaliciousAdvisory(m)) { m.malicious = true; if (m.cve) m.cve.malicious = true; n++; }
|
|
65
88
|
}
|
|
66
89
|
return n;
|
|
67
90
|
}
|
|
@@ -97,4 +120,4 @@ function detectTyposquats(resolvedDeps, opts = {}) {
|
|
|
97
120
|
return out;
|
|
98
121
|
}
|
|
99
122
|
|
|
100
|
-
module.exports = { flagMalicious, detectTyposquats, editDistance, loadPopular };
|
|
123
|
+
module.exports = { flagMalicious, withoutForeignMalicious, resolvedOutsideRegistry, detectTyposquats, editDistance, loadPopular };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/merge
|
|
2
|
+
* lib/findings/merge.js — merge two match arrays into one, deduped per physical finding.
|
|
3
3
|
*
|
|
4
4
|
* Extracted from vigievuln.js so the merge contract is unit-testable: it is the seam
|
|
5
5
|
* where every CVE source (CVEProject index, OSV.dev, OSV local DB, NVD CPE ranges,
|
|
@@ -24,7 +24,13 @@ function mergeBySource(existing, additions) {
|
|
|
24
24
|
const keyOf = (m, id) => `${coordOf(m)}:${m.dep.version}|${id}`;
|
|
25
25
|
const primary = m => keyOf(m, m.cve.id);
|
|
26
26
|
// Every id a finding answers to: its primary id, its aliases, and its GHSA.
|
|
27
|
-
|
|
27
|
+
// A distribution's per-CVE record (DEBIAN-CVE-2023-6246, UBUNTU-CVE-…, ALPINE-CVE-…) is
|
|
28
|
+
// that distribution's statement about exactly this CVE: both ids name one advisory.
|
|
29
|
+
const distroCve = id => /^[A-Z]+-(CVE-\d{4}-\d{4,})$/.exec(String(id || ""))?.[1] || null;
|
|
30
|
+
const idsOf = m => {
|
|
31
|
+
const ids = [m.cve.id, ...(m.cve.aliases || []), m.cve.ghsa].filter(Boolean);
|
|
32
|
+
return [...new Set([...ids, ...ids.map(distroCve).filter(Boolean)])];
|
|
33
|
+
};
|
|
28
34
|
|
|
29
35
|
const byKey = new Map(); // slot key → merged record
|
|
30
36
|
const aliasIndex = new Map(); // keyOf(m, id) → slot key, for every id the record answers to
|
|
@@ -49,6 +55,27 @@ function mergeBySource(existing, additions) {
|
|
|
49
55
|
return [...slots];
|
|
50
56
|
};
|
|
51
57
|
const isCve = id => /^CVE-/i.test(String(id || ""));
|
|
58
|
+
// The rating of ONE of the two sides, by a total order that never looks at arrival
|
|
59
|
+
// order: the higher qualitative rank wins (a gate must not be lowered by a second
|
|
60
|
+
// source), then a scored side over an unscored one, then the higher score, then a
|
|
61
|
+
// deterministic tie-break on the values themselves.
|
|
62
|
+
const RATING_FIELDS = ["cvssVersion", "severityScheme", "severityOriginal", "severitySource", "scoreSource"];
|
|
63
|
+
const SEV_RANK = { CRITICAL: 4, HIGH: 3, MEDIUM: 2, LOW: 1, NONE: 0 };
|
|
64
|
+
const scoreOf = c => (typeof c.score === "number" && Number.isFinite(c.score)) ? c.score : null;
|
|
65
|
+
const rankOf = c => SEV_RANK[String(c.severity || "").toUpperCase()] ?? -1;
|
|
66
|
+
const cmpStr = (x, y) => { x = String(x ?? ""); y = String(y ?? ""); return x < y ? -1 : x > y ? 1 : 0; };
|
|
67
|
+
const compareRating = (a, b) => {
|
|
68
|
+
const sa = scoreOf(a), sb = scoreOf(b);
|
|
69
|
+
return (rankOf(a) - rankOf(b)) || ((sa != null) - (sb != null)) || ((sa ?? 0) - (sb ?? 0))
|
|
70
|
+
|| ((!!a.cvssVector) - (!!b.cvssVector)) || cmpStr(a.cvssVector, b.cvssVector) || cmpStr(a.severity, b.severity)
|
|
71
|
+
|| RATING_FIELDS.reduce((r, k) => r || cmpStr(a[k], b[k]), 0);
|
|
72
|
+
};
|
|
73
|
+
const ratingOf = (a, b) => {
|
|
74
|
+
const w = compareRating(a, b) >= 0 ? a : b;
|
|
75
|
+
const out = { score: w.score, cvssVector: w.cvssVector || null, severity: w.severity };
|
|
76
|
+
for (const k of RATING_FIELDS) if (k in a || k in b) out[k] = w[k] ?? null;
|
|
77
|
+
return out;
|
|
78
|
+
};
|
|
52
79
|
|
|
53
80
|
for (const m of existing || []) {
|
|
54
81
|
const rec = { ...m, source: m.source || "cache" };
|
|
@@ -79,7 +106,7 @@ function mergeBySource(existing, additions) {
|
|
|
79
106
|
references: [...new Map([...(prev.cve.references||[]),...(m.cve.references||[])].map(ref=>[typeof ref==='string'?ref:ref?.url,ref]).filter(([url])=>url)).values()],
|
|
80
107
|
relatedAdvisories: [...new Map([...(prev.cve.relatedAdvisories||[]),...(m.cve.relatedAdvisories||[])].map(ref=>[ref?.url,ref]).filter(([url])=>url)).values()],
|
|
81
108
|
applicabilityEvidence: require('./applicability-evidence').applicabilityEvidence(prev.cve,m.cve),
|
|
82
|
-
...require('
|
|
109
|
+
...require('../advisories/fixes').mergeAdvisoryFixes(prev.cve,m.cve),
|
|
83
110
|
id,
|
|
84
111
|
// an advisory's identity is the UNION of its ids — dropping the
|
|
85
112
|
// previous aliases on merge would unlink the alias index. Both primary
|
|
@@ -87,11 +114,10 @@ function mergeBySource(existing, additions) {
|
|
|
87
114
|
aliases: [...new Set([...(prev.cve.aliases || []), ...(m.cve.aliases || []),
|
|
88
115
|
prev.cve.id, m.cve.id, prev.cve.ghsa, m.cve.ghsa].filter(Boolean))].filter(a => a !== id),
|
|
89
116
|
ghsa: prev.cve.ghsa || m.cve.ghsa || null,
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
severity: (prev.cve.severity && prev.cve.severity !== "UNKNOWN") ? prev.cve.severity : m.cve.severity,
|
|
117
|
+
// severity, score and vector come TOGETHER from one source (see ratingOf):
|
|
118
|
+
// mixing the first label with the max score and the last vector made the
|
|
119
|
+
// --fail-on result depend on source arrival order.
|
|
120
|
+
...ratingOf(prev.cve, m.cve),
|
|
95
121
|
// prefer the longer description
|
|
96
122
|
description: ((prev.cve.description || "").length > (m.cve.description || "").length) ? prev.cve.description : m.cve.description,
|
|
97
123
|
},
|
|
@@ -127,4 +153,26 @@ function mergeBySource(existing, additions) {
|
|
|
127
153
|
return merged;
|
|
128
154
|
}
|
|
129
155
|
|
|
130
|
-
|
|
156
|
+
/**
|
|
157
|
+
* A distribution announcement (DSA, DLA, USN…) names the CVEs it fixes. When every one of
|
|
158
|
+
* them is already a finding on the same package, the announcement adds no vulnerability:
|
|
159
|
+
* it is folded into those findings as a related advisory instead of a second row of
|
|
160
|
+
* unknown severity. An announcement covering a CVE not otherwise reported is kept.
|
|
161
|
+
*/
|
|
162
|
+
function foldAnnouncements(matches) {
|
|
163
|
+
const coordOf = m => `${m.dep?.coordKey || m.dep?.name || ""}:${m.dep?.version || ""}`;
|
|
164
|
+
const isCve = id => /^CVE-\d{4}-\d{4,}$/.test(String(id || ""));
|
|
165
|
+
const byCve = new Map();
|
|
166
|
+
for (const m of matches || []) if (isCve(m.cve?.id)) byCve.set(`${coordOf(m)}|${m.cve.id}`, m);
|
|
167
|
+
return (matches || []).filter(m => {
|
|
168
|
+
if (isCve(m.cve?.id) || m.malicious || m.cve?.malicious) return true;
|
|
169
|
+
const covered = [...new Set((m.cve?.upstream || []).filter(isCve))];
|
|
170
|
+
if (!covered.length) return true;
|
|
171
|
+
const targets = covered.map(id => byCve.get(`${coordOf(m)}|${id}`));
|
|
172
|
+
if (targets.some(t => !t)) return true;
|
|
173
|
+
for (const target of targets) target.cve.related = [...new Set([...(target.cve.related || []), m.cve.id])];
|
|
174
|
+
return false;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = { mergeBySource, foldAnnouncements };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/priority.js — composite prioritisation of a CVE match.
|
|
2
|
+
* lib/findings/priority.js — composite prioritisation of a CVE match.
|
|
3
3
|
*
|
|
4
4
|
* Blends three independent signals the report already carries:
|
|
5
5
|
* - CVSS base score (severity of the flaw if exploited)
|
|
6
|
-
* - EPSS percentile (likelihood it WILL be exploited — lib/epss.js)
|
|
7
|
-
* - CISA KEV membership (it IS being exploited in the wild — lib/kev.js)
|
|
6
|
+
* - EPSS percentile (likelihood it WILL be exploited — lib/providers/epss/enrich.js)
|
|
7
|
+
* - CISA KEV membership (it IS being exploited in the wild — lib/providers/kev/enrich.js)
|
|
8
8
|
*
|
|
9
9
|
* KEV always wins (band "exploited", score floored at 90). Otherwise the score
|
|
10
10
|
* is an 80/20 blend of CVSS and EPSS percentile. Pure — no I/O.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// A related upstream CVE is evidence about that CVE, not an alias or a
|
|
3
|
+
// package-level applicability assertion for every issue in an advisory.
|
|
4
|
+
function relatedRisk(cve, sourceField) {
|
|
5
|
+
return cve?.riskEvidence?.relationship === 'upstream' && cve?.[sourceField] === cve.riskEvidence.source;
|
|
6
|
+
}
|
|
7
|
+
function relatedSignal(cve, field) {
|
|
8
|
+
const evidence=cve?.[field+'Evidence'];
|
|
9
|
+
if(evidence?.relationship)return evidence.relationship==='upstream';
|
|
10
|
+
const own=[cve?.id,...(cve?.aliases||[])].some(id=>typeof id==='string' && /^CVE-\d{4}-\d{4,}$/i.test(id));
|
|
11
|
+
return !own && (cve?.upstream||[]).some(id=>typeof id==='string' && /^CVE-\d{4}-\d{4,}$/i.test(id));
|
|
12
|
+
}
|
|
13
|
+
// Exported with every vulnerability (SBOM property, SARIF result, CSAF note): it carries the
|
|
14
|
+
// identifiers and scores that justify a rating, not the advisory texts. Descriptions,
|
|
15
|
+
// reference lists and CWE names stay on the vulnerability entry itself; embedding them here
|
|
16
|
+
// again made one kernel announcement weigh 5 MB in a CycloneDX document.
|
|
17
|
+
const brief=record=>{if(!record||typeof record!=='object')return record;const {description,references,cwes,...rest}=record;return rest;};
|
|
18
|
+
const withoutDescription=record=>{if(!record||typeof record!=='object')return record;const {description,...rest}=record;return rest;};
|
|
19
|
+
function evidenceObject(cve) {
|
|
20
|
+
return { ...(cve?.riskEvidence?{risk:cve.riskEvidence}:{}),...(cve?.nvdEvidence?.records?.length?{nvd:cve.nvdEvidence.records.map(brief)}:{}),
|
|
21
|
+
...(cve?.cveEvidence?.length?{cves:cve.cveEvidence.map(e=>e?{...e,...(e.euvdDetails?{euvdDetails:brief(e.euvdDetails)}:{}),...(Array.isArray(e.certfr)?{certfr:e.certfr.map(a=>a?.ref||a)}:{})}:e)}:{}),...(cve?.euvdDetails?{euvd:withoutDescription(cve.euvdDetails)}:{}),...(cve?.kevEvidence?{kev:cve.kevEvidence}:{}),...(cve?.epssEvidence?{epss:cve.epssEvidence}:{}),
|
|
22
|
+
...(cve?.upstream?.length?{upstream:cve.upstream}:{}),...(cve?.related?.length?{related:cve.related}:{}) };
|
|
23
|
+
}
|
|
24
|
+
module.exports={relatedRisk,relatedSignal,evidenceObject};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// The CVSS v3/v4 qualitative rating scale, in one place.
|
|
3
|
+
|
|
4
|
+
/** Rating of a base score; `absent` when there is no usable score. */
|
|
5
|
+
function severityFromScore(score, absent = null) {
|
|
6
|
+
if (score == null) return absent;
|
|
7
|
+
const n = Number(score);
|
|
8
|
+
if (!Number.isFinite(n)) return absent;
|
|
9
|
+
if (n >= 9) return 'CRITICAL';
|
|
10
|
+
if (n >= 7) return 'HIGH';
|
|
11
|
+
if (n >= 4) return 'MEDIUM';
|
|
12
|
+
if (n > 0) return 'LOW';
|
|
13
|
+
return 'NONE';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = { severityFromScore };
|