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/artifacts/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
// An OCI 1.1 manifest or descriptor may state its artifactType. One that names the image config
|
|
3
|
+
// type is an ordinary image (cgr.dev publishes its indexes that way); any other is an artifact.
|
|
4
|
+
const IMAGE_CONFIG_TYPES = ['application/vnd.oci.image.config.v1+json', 'application/vnd.docker.container.image.v1+json'];
|
|
5
|
+
const foreignArtifact = type => !!type && !IMAGE_CONFIG_TYPES.includes(type);
|
|
2
6
|
|
|
3
7
|
// Image archives are untrusted data. Nothing in them is executed, and no archive
|
|
4
8
|
// path is ever handed directly to a host filesystem API.
|
|
@@ -19,8 +23,12 @@ function limits(options) {
|
|
|
19
23
|
for (const [k, v] of Object.entries(result)) if (!Number.isSafeInteger(v) || v < 1) throw new Error(`Invalid artifact limit ${k}`);
|
|
20
24
|
return result;
|
|
21
25
|
}
|
|
26
|
+
// Backslashes and drive prefixes are ordinary file name characters on POSIX
|
|
27
|
+
// (systemd ships `system-systemd\x2dcryptsetup.slice`); on Windows they would
|
|
28
|
+
// be separators or drives, so such entries are skipped there before extraction.
|
|
29
|
+
const hostUnsafe = value => path.sep !== '/' && (value.includes('\\') || /^[A-Za-z]:/.test(value));
|
|
22
30
|
function cleanName(value, lim) {
|
|
23
|
-
if (typeof value !== 'string' || value.includes('\0') || value
|
|
31
|
+
if (typeof value !== 'string' || value.includes('\0') || hostUnsafe(value) || value.startsWith('/')) throw new Error(`Unsafe archive path: ${value}`);
|
|
24
32
|
const parts = value.split('/').filter(p => p && p !== '.');
|
|
25
33
|
if (parts.includes('..') || parts.length > lim.maxDepth) throw new Error(`Unsafe archive path: ${value}`);
|
|
26
34
|
return parts.join('/');
|
|
@@ -66,12 +74,14 @@ async function readTar(file, workspace, state, options, expectedDiffId) {
|
|
|
66
74
|
const entries = []; const extract = tar.extract(); let failure;
|
|
67
75
|
extract.on('entry', (header, stream, next) => {
|
|
68
76
|
(async () => {
|
|
69
|
-
const
|
|
77
|
+
const skip = typeof header.name === 'string' && (hostUnsafe(header.name) || (['symlink', 'link'].includes(header.type) && hostUnsafe(String(header.linkname || ''))));
|
|
78
|
+
const name = skip ? header.name : cleanName(header.name, state.limits);
|
|
70
79
|
if (Buffer.byteLength(header.name) + Buffer.byteLength(header.linkname || '') + Buffer.byteLength(JSON.stringify(header.pax || {})) > state.limits.maxMetadataBytes) throw new Error('Archive metadata size limit exceeded');
|
|
71
80
|
if (++state.entries > state.limits.maxEntries) throw new Error('Archive entry limit exceeded');
|
|
72
81
|
if (!Number.isSafeInteger(header.size) || header.size < 0 || header.size > state.limits.maxFileBytes) throw new Error(`Archive file size limit exceeded: ${name}`);
|
|
73
82
|
state.bytes += header.size;
|
|
74
83
|
if (state.bytes > state.limits.maxBytes) throw new Error('Archive decompressed size limit exceeded');
|
|
84
|
+
if (skip) { state.warnings.push(`Skipped archive entry whose name cannot be represented on this host: ${header.name}`); for await (const _ of stream) {} next(); return; }
|
|
75
85
|
const entry = { name, type: header.type, linkname: header.linkname, size: header.size };
|
|
76
86
|
if (header.type === 'file' || header.type === 'contiguous-file') {
|
|
77
87
|
entry.file = path.join(workspace, `entry-${state.serial++}`);
|
|
@@ -92,14 +102,15 @@ async function safePath(root, name, lim, followFinal = false) {
|
|
|
92
102
|
let parts = cleanName(name, lim).split('/').filter(Boolean), resolved = [], hops = 0;
|
|
93
103
|
while (parts.length) {
|
|
94
104
|
const p = parts.shift();
|
|
95
|
-
|
|
105
|
+
// Like Linux at `/`, `..` at the artifact root stays at the root.
|
|
106
|
+
if (p === '..') { resolved.pop(); continue; }
|
|
96
107
|
if (!p || p === '.') continue;
|
|
97
108
|
const candidate = path.join(root, ...resolved, p); let st;
|
|
98
109
|
try { st = await fsp.lstat(candidate); } catch (e) { if (e.code !== 'ENOENT' && e.code !== 'ENOTDIR') throw e; }
|
|
99
110
|
if (st && st.isSymbolicLink() && (parts.length || followFinal)) {
|
|
100
111
|
if (++hops > 40) throw new Error('Too many symbolic links');
|
|
101
112
|
const link = await fsp.readlink(candidate);
|
|
102
|
-
if (link
|
|
113
|
+
if (hostUnsafe(link) || link.includes('\0')) throw new Error('Unsafe symbolic link');
|
|
103
114
|
if (link.startsWith('/')) resolved = [];
|
|
104
115
|
parts = [...link.split('/'), ...parts]; continue;
|
|
105
116
|
}
|
|
@@ -123,8 +134,12 @@ async function applyLayer(root, entries, state, whiteouts) {
|
|
|
123
134
|
if (whiteouts) for (const e of entries) {
|
|
124
135
|
const base = path.posix.basename(e.name), dir = path.posix.dirname(e.name);
|
|
125
136
|
if (!base.startsWith('.wh.')) continue;
|
|
126
|
-
const parent = await safePath(root, dir === '.' ? '' : dir, lim, true);
|
|
127
137
|
if (base === '.wh..wh..opq') {
|
|
138
|
+
// An opaque directory replaces what lower layers had at `dir`. A lower symlink
|
|
139
|
+
// there is replaced by the directory itself, never followed to its target.
|
|
140
|
+
const parent = await safePath(root, dir === '.' ? '' : dir, lim); let st;
|
|
141
|
+
try { st = await fsp.lstat(parent); } catch (err) { if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') throw err; }
|
|
142
|
+
if (st && !st.isDirectory()) { await remove(parent); await fsp.mkdir(parent, { mode: 0o700 }); continue; }
|
|
128
143
|
let names = []; try { names = await fsp.readdir(parent); } catch (err) { if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') throw err; }
|
|
129
144
|
for (const n of names) await remove(path.join(parent, n));
|
|
130
145
|
} else {
|
|
@@ -135,6 +150,8 @@ async function applyLayer(root, entries, state, whiteouts) {
|
|
|
135
150
|
const deferred = new Map();
|
|
136
151
|
for (const e of entries) {
|
|
137
152
|
if (!e.name || (whiteouts && path.posix.basename(e.name).startsWith('.wh.'))) continue;
|
|
153
|
+
// Device nodes, pipes and sockets (dev/null, dev/console, dev/initctl) hold no content to inventory.
|
|
154
|
+
if (['character-device', 'block-device', 'fifo', 'socket'].includes(e.type)) continue;
|
|
138
155
|
if (!['file', 'contiguous-file', 'directory', 'symlink', 'link'].includes(e.type)) { state.warnings.push(`Unsupported archive entry type ${e.type}: ${e.name}`); continue; }
|
|
139
156
|
deferred.delete(e.name);
|
|
140
157
|
await parents(root, e.name, lim);
|
|
@@ -153,10 +170,10 @@ async function applyLayer(root, entries, state, whiteouts) {
|
|
|
153
170
|
} else {
|
|
154
171
|
await remove(p);
|
|
155
172
|
if (e.type === 'symlink') {
|
|
156
|
-
if (typeof e.linkname !== 'string' || e.linkname.includes('\0') || e.linkname
|
|
157
|
-
// Store absolute container links as relative host links;
|
|
173
|
+
if (typeof e.linkname !== 'string' || e.linkname.includes('\0') || hostUnsafe(e.linkname)) throw new Error(`Unsafe link: ${e.name}`);
|
|
174
|
+
// Store absolute container links as relative host links; `..` clamps at the root as on Linux.
|
|
158
175
|
const targetParts = e.linkname.startsWith('/') ? [] : e.name.split('/').slice(0, -1);
|
|
159
|
-
for (const segment of e.linkname.split('/')) { if (!segment || segment === '.') continue; if (segment === '..')
|
|
176
|
+
for (const segment of e.linkname.split('/')) { if (!segment || segment === '.') continue; if (segment === '..') targetParts.pop(); else targetParts.push(segment); }
|
|
160
177
|
const target = path.join(root, ...targetParts); await fsp.symlink(path.relative(path.dirname(p), target) || '.', p);
|
|
161
178
|
} else await fsp.copyFile(e.file, p);
|
|
162
179
|
}
|
|
@@ -192,9 +209,9 @@ async function openArtifact(input, options = {}) {
|
|
|
192
209
|
return result;
|
|
193
210
|
}
|
|
194
211
|
}
|
|
195
|
-
const temp = await fsp.mkdtemp(path.join(options.tmpdir || os.tmpdir(), 'vigievuln-artifact-'));
|
|
212
|
+
const temp = require('../images/temp-roots').track(await fsp.mkdtemp(path.join(options.tmpdir || os.tmpdir(), 'vigievuln-artifact-')));
|
|
196
213
|
const state = { limits: lim, entries: 0, bytes: 0, serial: 0, warnings: [] }; let cleaned = false;
|
|
197
|
-
const cleanup = async () => { if (!cleaned) { cleaned = true; await remove(temp); } };
|
|
214
|
+
const cleanup = async () => { if (!cleaned) { cleaned = true; await remove(temp); require('../images/temp-roots').untrack(temp); } };
|
|
198
215
|
try {
|
|
199
216
|
const targets = [];
|
|
200
217
|
const root = async () => { const dir = path.join(temp, `root-${targets.length}`); await fsp.mkdir(dir); return dir; };
|
|
@@ -245,13 +262,13 @@ async function openArtifact(input, options = {}) {
|
|
|
245
262
|
};
|
|
246
263
|
const index = await readJson(await get('index.json'), state), globalWarnings = [];
|
|
247
264
|
const visit = async (desc, ancestry = [], platform) => {
|
|
248
|
-
if (desc.artifactType || desc.annotations?.['vnd.docker.reference.type'] === 'attestation-manifest' || (desc.platform?.os === 'unknown' && desc.platform?.architecture === 'unknown')) {
|
|
265
|
+
if (foreignArtifact(desc.artifactType) || desc.annotations?.['vnd.docker.reference.type'] === 'attestation-manifest' || (desc.platform?.os === 'unknown' && desc.platform?.architecture === 'unknown')) {
|
|
249
266
|
globalWarnings.push(`Skipped non-image artifact ${desc.digest || '(unknown digest)'}`); return;
|
|
250
267
|
}
|
|
251
268
|
if (ancestry.includes(desc.digest) || ancestry.length >= lim.maxDepth) throw new Error('OCI index cycle or depth limit');
|
|
252
269
|
const document = await readJson(await blob(desc), state);
|
|
253
270
|
if (Array.isArray(document.manifests)) { for (const child of document.manifests) await visit(child, [...ancestry, desc.digest], child.platform || platform); return; }
|
|
254
|
-
if (document.artifactType || document.subject || (document.config?.mediaType && !['application/vnd.oci.image.config.v1+json', 'application/vnd.docker.container.image.v1+json'].includes(document.config.mediaType))) {
|
|
271
|
+
if (foreignArtifact(document.artifactType) || document.subject || (document.config?.mediaType && !['application/vnd.oci.image.config.v1+json', 'application/vnd.docker.container.image.v1+json'].includes(document.config.mediaType))) {
|
|
255
272
|
globalWarnings.push(`Skipped non-image artifact ${desc.digest}`); return;
|
|
256
273
|
}
|
|
257
274
|
if (!document.config || !Array.isArray(document.layers)) throw new Error('Invalid OCI image manifest');
|
|
@@ -267,6 +284,12 @@ async function openArtifact(input, options = {}) {
|
|
|
267
284
|
for (const target of targets) target.metadata.warnings.push(...globalWarnings);
|
|
268
285
|
}
|
|
269
286
|
return { targets, cleanup };
|
|
270
|
-
} catch (e) {
|
|
287
|
+
} catch (e) {
|
|
288
|
+
await cleanup();
|
|
289
|
+
if (e.code === 'ENOSPC') throw Object.assign(new Error(
|
|
290
|
+
'Temporary space exhausted while extracting the image in ' + path.dirname(temp) +
|
|
291
|
+
'. Set TMPDIR to a filesystem with more free space.', { cause: e }), { code: e.code });
|
|
292
|
+
throw e;
|
|
293
|
+
}
|
|
271
294
|
}
|
|
272
295
|
module.exports = { openArtifact, DEFAULT_LIMITS };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path').posix;
|
|
5
|
+
const { safeFile } = require('../system-inventory/collect');
|
|
6
|
+
|
|
7
|
+
// Read installed build configuration as data, never as a script. Both the
|
|
8
|
+
// expected layout and linker identity must agree with the observed launcher.
|
|
9
|
+
function installedVersion(root, location, metadata, product) {
|
|
10
|
+
const needed = metadata.needed || [];
|
|
11
|
+
if (!product || !location || path.basename(path.dirname(location)) !== 'bin') return null;
|
|
12
|
+
const prefix = path.dirname(path.dirname(location));
|
|
13
|
+
function text(relative) {
|
|
14
|
+
const file = safeFile(root, path.join(prefix, relative));
|
|
15
|
+
if (!file) return '';
|
|
16
|
+
const stat = fs.statSync(file);
|
|
17
|
+
return stat.isFile() && stat.size <= 128 * 1024 ? fs.readFileSync(file, 'utf8') : '';
|
|
18
|
+
}
|
|
19
|
+
if (product.id === 'java' && needed.includes('libjli.so')) {
|
|
20
|
+
const release = text('release');
|
|
21
|
+
const version = /^JAVA_VERSION="(\d[\w.+-]{0,50})"\r?$/m.exec(release)?.[1];
|
|
22
|
+
if (version && /^IMPLEMENTOR="[^"\r\n]+"\r?$/m.test(release))
|
|
23
|
+
return { id: 'java', version, source: 'jdk-release', path: path.join(prefix, 'release') };
|
|
24
|
+
}
|
|
25
|
+
if (product.id === 'tcl') {
|
|
26
|
+
for (const soname of needed) {
|
|
27
|
+
const match = /^libtcl(\d+\.\d+)\.so(?:\.\d+)*$/.exec(soname);
|
|
28
|
+
if (!match) continue;
|
|
29
|
+
const config = path.join('lib', 'tcl' + match[1], 'tclConfig.sh');
|
|
30
|
+
const doc = text(config);
|
|
31
|
+
const minor = /^TCL_VERSION='(\d+\.\d+)'\r?$/m.exec(doc)?.[1];
|
|
32
|
+
const patch = /^TCL_PATCH_LEVEL='(\.\d+)'\r?$/m.exec(doc)?.[1];
|
|
33
|
+
if (match[1] === minor && patch && /^TCL_LIB_FILE='([^'\r\n]+)'\r?$/m.exec(doc)?.[1] === soname)
|
|
34
|
+
return {
|
|
35
|
+
id: 'tcl',
|
|
36
|
+
version: minor + patch,
|
|
37
|
+
source: 'tcl-build-config',
|
|
38
|
+
path: path.join(prefix, config)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
module.exports = { installedVersion };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// A saved inventory is validated before this transformation. Filtering an old
|
|
4
4
|
// snapshot cannot reconstruct descriptors that its collectors never observed.
|
|
5
|
-
const { IMAGE_COMPONENT_SCOPE, isNpmPackageDescriptor, imageComponentRole, imageComponentSource } = require('./component-scope');
|
|
5
|
+
const { IMAGE_COMPONENT_SCOPE, isSystemProjectPath, isNpmPackageDescriptor, imageComponentRole, imageComponentSource } = require('./component-scope');
|
|
6
6
|
const SCOPE_REASON = 'image-inventory-scope-outdated';
|
|
7
7
|
const SCOPE_MESSAGE = 'The saved image inventory predates the current component scope or contains package metadata fragments. Reacquire the image to establish its current inventory.';
|
|
8
8
|
|
|
@@ -22,12 +22,62 @@ function applyComponentScope(target, { checkPolicy = true } = {}) {
|
|
|
22
22
|
const result = structuredClone(target);
|
|
23
23
|
// Publisher SBOM contents are explicit evidence, not filesystem descriptors.
|
|
24
24
|
if (result.kind === 'sbom') return result;
|
|
25
|
+
const systemApps = result.metadata?.systemApplications;
|
|
26
|
+
if (systemApps) {
|
|
27
|
+
// Older collectors used the same result for completed enumeration and failed
|
|
28
|
+
// reads. Only a completed inventory with an explicit count can be normalized.
|
|
29
|
+
const enumerators = new Set(['dpkg','apk','rpm','installed-applications','native-binaries','project-lockfiles']);
|
|
30
|
+
for (const check of result.coverage || []) {
|
|
31
|
+
if (check.capability==='inventory' && check.execution==='completed' && check.result==='indeterminate' &&
|
|
32
|
+
!check.reason && Number.isSafeInteger(check.count) && check.count>=0 && enumerators.has(check.collector))
|
|
33
|
+
check.result='inventoried';
|
|
34
|
+
}
|
|
35
|
+
// Legacy collections could promote example manifests bundled in a gem to
|
|
36
|
+
// projects. The installed gemspec is the evidence for its installed version.
|
|
37
|
+
const storeProjects=new Set(systemApps.applications.filter(a=>a.type==='project' && !isSystemProjectPath(a.root)).map(a=>a.id));
|
|
38
|
+
if(storeProjects.size){
|
|
39
|
+
for(const field of ['applications','inventory','relations','diagnostics','coverage']){
|
|
40
|
+
if(systemApps[field])systemApps[field]=systemApps[field].filter(item=>!storeProjects.has(field==='applications'?item.id:item.applicationId));
|
|
41
|
+
}
|
|
42
|
+
result.coverage=(result.coverage || []).filter(item=>!storeProjects.has(item.applicationId));
|
|
43
|
+
for(const dep of result.deps || []){
|
|
44
|
+
if(dep.systemApplicationIds?.some(id=>storeProjects.has(id))){
|
|
45
|
+
dep.systemApplicationIds=dep.systemApplicationIds.filter(id=>!storeProjects.has(id));
|
|
46
|
+
if(!dep.systemApplicationIds.length){dep.systemSection='dependency';dep.imageRole='transitive';dep.scope='transitive';}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if(result.metadata.projectDescriptors)result.metadata.projectDescriptors=result.metadata.projectDescriptors.filter(isSystemProjectPath);
|
|
50
|
+
}
|
|
51
|
+
const replaced = require('../applications/layout').reconcileApplications(systemApps,result.deps || []);
|
|
52
|
+
if (replaced) {
|
|
53
|
+
require('../applications/layout').reparentAssessments(result,systemApps.embeddedApplications || []);
|
|
54
|
+
result.coverage=(result.coverage || []).filter(c=>!replaced.has(c.applicationId));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const layout = systemApps && require('../applications/layout').extensionLayout(systemApps.applications,systemApps.inventory);
|
|
58
|
+
const relations = new Map();
|
|
59
|
+
for (const item of systemApps?.inventory || []) {
|
|
60
|
+
if (!['direct','transitive','indirect'].includes(item.managerRelation) || !item.coord) continue;
|
|
61
|
+
for (const proof of item.evidence || []) relations.set(JSON.stringify([proof.path,item.coord,item.version]),item.managerRelation);
|
|
62
|
+
}
|
|
25
63
|
let filtered = false;
|
|
26
64
|
result.deps = (result.deps || []).filter(dep => {
|
|
65
|
+
if(systemApps && dep.provenance==='lockfile' && dep.artifactPath && !isSystemProjectPath(dep.artifactPath))return false;
|
|
27
66
|
if (isNpmFragment(dep)) { filtered = true; return false; }
|
|
28
|
-
dep.imageRole = imageComponentRole(dep);
|
|
67
|
+
if (!result.metadata?.systemApplications || !dep.systemSection) dep.imageRole = imageComponentRole(dep);
|
|
29
68
|
dep.imageSource = imageComponentSource(dep);
|
|
30
|
-
dep.
|
|
69
|
+
if (systemApps && dep.systemApplicationIds?.length && dep.provenance === 'lockfile') {
|
|
70
|
+
const coord = [dep.namespace, dep.name].filter(Boolean).join('/');
|
|
71
|
+
const npmDirect = !dep.managerRelation && dep.ecosystem === 'npm' &&
|
|
72
|
+
['prod','dev','optional','peer'].includes(dep.scope);
|
|
73
|
+
const relation = dep.managerRelation === 'unknown' || !dep.managerRelation
|
|
74
|
+
? relations.get(JSON.stringify([dep.artifactPath,coord,dep.version])) : dep.managerRelation;
|
|
75
|
+
if (relation) dep.managerRelation=relation;
|
|
76
|
+
if (npmDirect || relation === 'direct') { dep.systemSection = 'project'; dep.imageRole = 'direct'; }
|
|
77
|
+
if (relation === 'transitive' || relation === 'indirect') dep.imageRole = 'transitive';
|
|
78
|
+
}
|
|
79
|
+
if (layout) require('../applications/layout').applyExtensionScope(dep,layout);
|
|
80
|
+
if (dep.provenance !== 'lockfile') dep.scope = dep.imageRole === 'transitive' ? 'transitive' : 'runtime';
|
|
31
81
|
return true;
|
|
32
82
|
});
|
|
33
83
|
result.warnings = (result.warnings || []).filter(w => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { catalog } = require('./product-catalog');
|
|
4
|
+
const normalize = (value) => (typeof value === 'string' ? value.trim().toLowerCase() : '');
|
|
5
|
+
const listed = (values, value) => !!value && values?.some((v) => normalize(v) === normalize(value));
|
|
6
|
+
|
|
7
|
+
// Read one PE's own StringFileInfo tables. Exact product and publisher/original
|
|
8
|
+
// filename must agree within a table. Never borrow the enclosing EXE's version.
|
|
9
|
+
function versionResource(tables) {
|
|
10
|
+
const identities = new Set(),
|
|
11
|
+
versions = new Set();
|
|
12
|
+
for (const table of tables || []) {
|
|
13
|
+
const product = [...catalog.values()].find(
|
|
14
|
+
(p) =>
|
|
15
|
+
listed(p.peVersionInfo?.names, table.ProductName) &&
|
|
16
|
+
(listed(p.peVersionInfo?.originals, table.OriginalFilename) ||
|
|
17
|
+
listed(p.peVersionInfo?.vendors, table.CompanyName))
|
|
18
|
+
);
|
|
19
|
+
if (!product) return null;
|
|
20
|
+
identities.add(product.id);
|
|
21
|
+
const version = String(table.ProductVersion || '').trim();
|
|
22
|
+
versions.add(/^\d+(?:\.\d+){1,3}$/.test(version) && version.length <= 40 ? version : null);
|
|
23
|
+
}
|
|
24
|
+
if (identities.size !== 1) return null;
|
|
25
|
+
const [id] = identities;
|
|
26
|
+
return { id, version: versions.size === 1 ? [...versions][0] : null, source: 'pe-version-info' };
|
|
27
|
+
}
|
|
28
|
+
module.exports = { versionResource };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { imageProduct } = require('./product-catalog');
|
|
4
|
+
const { getApplicationPlugin } = require('../applications/plugins');
|
|
5
|
+
const { makeDepRecord } = require('../inventory/dep-record');
|
|
6
|
+
const { createCacheRepository } = require('../cache/repository');
|
|
7
|
+
const { extractFromNvdRecord } = require('../providers/nvd/enrich');
|
|
8
|
+
const { getResource } = require('../providers');
|
|
9
|
+
const { validateResourceJson, DEFAULT_MAX_BODY_BYTES } = require('../cache/resource/engine');
|
|
10
|
+
const { fresh } = require('../cache/policy');
|
|
11
|
+
|
|
12
|
+
const VERSION = /^\d{1,8}(?:\.\d{1,8}){1,3}$/;
|
|
13
|
+
const bounds = ['versionStartIncluding', 'versionStartExcluding', 'versionEndIncluding', 'versionEndExcluding'];
|
|
14
|
+
function compare(a, b) {
|
|
15
|
+
const x = a.split('.').map(Number),
|
|
16
|
+
y = b.split('.').map(Number);
|
|
17
|
+
for (let i = 0; i < Math.max(x.length, y.length); i++) {
|
|
18
|
+
const d = (x[i] || 0) - (y[i] || 0);
|
|
19
|
+
if (d) return Math.sign(d);
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Product/version applicability is independent of deployment prerequisites.
|
|
25
|
+
// Platform and build-environment restrictions remain in the source advisory.
|
|
26
|
+
function evaluateConfiguration(node, product, version) {
|
|
27
|
+
return require('../providers/nvd/cpe').evaluateProductConfiguration(node,
|
|
28
|
+
leaf => String(leaf.criteria).split(':').slice(0,5).join(':') === 'cpe:2.3:a:' + product,
|
|
29
|
+
leaf => {
|
|
30
|
+
const fields=String(leaf.criteria).split(':'),pin=fields[5];
|
|
31
|
+
// CPE update identifies the release itself (for example alpha1).
|
|
32
|
+
if(fields.length!==13 || !['*','-'].includes(fields[6]) ||
|
|
33
|
+
(pin!=='*' && !VERSION.test(pin)) || bounds.some(k=>leaf[k]!=null && !VERSION.test(leaf[k])))return null;
|
|
34
|
+
return (pin==='*' || compare(version,pin)===0) &&
|
|
35
|
+
(!leaf.versionStartIncluding || compare(version,leaf.versionStartIncluding)>=0) &&
|
|
36
|
+
(!leaf.versionStartExcluding || compare(version,leaf.versionStartExcluding)>0) &&
|
|
37
|
+
(!leaf.versionEndIncluding || compare(version,leaf.versionEndIncluding)<=0) &&
|
|
38
|
+
(!leaf.versionEndExcluding || compare(version,leaf.versionEndExcluding)<0);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function assessProductAdvisories(target, options) {
|
|
43
|
+
const matches = [],
|
|
44
|
+
coverage = [],
|
|
45
|
+
groups = new Map();
|
|
46
|
+
for (const dep of target.deps) {
|
|
47
|
+
const product = imageProduct(dep);
|
|
48
|
+
if (
|
|
49
|
+
!product ||
|
|
50
|
+
!dep.binaryEvidence?.product ||
|
|
51
|
+
dep.binaryEvidence.product !== product.id ||
|
|
52
|
+
dep.osPackageOwners?.length
|
|
53
|
+
)
|
|
54
|
+
continue;
|
|
55
|
+
// Slimmed distro images may discard dpkg .list files. When the matching
|
|
56
|
+
// system package exists, never apply upstream rules to a system-prefix binary.
|
|
57
|
+
if (
|
|
58
|
+
/^(?:usr\/)?(?:s?bin|lib(?:32|64)?)\//.test(dep.artifactPath || '') &&
|
|
59
|
+
target.packages.some((pkg) => product.pkg.test(pkg.name))
|
|
60
|
+
)
|
|
61
|
+
continue;
|
|
62
|
+
if (!product.cpe || !VERSION.test(dep.version)) {
|
|
63
|
+
coverage.push({
|
|
64
|
+
collector: 'image-product-applicability',
|
|
65
|
+
affectsCompleteness:false,
|
|
66
|
+
product: product.id,
|
|
67
|
+
version: dep.version,
|
|
68
|
+
execution: 'not-applicable',
|
|
69
|
+
result: 'indeterminate',
|
|
70
|
+
reason: dep.version
|
|
71
|
+
? 'No supported upstream CPE/version comparison.'
|
|
72
|
+
: 'No exact runtime version was identified.'
|
|
73
|
+
});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
for (const cpe of [product.cpe, ...(product.cpeAliases || [])]) {
|
|
77
|
+
const key = JSON.stringify([product.id, dep.version, cpe]);
|
|
78
|
+
const items = groups.get(key) || [];
|
|
79
|
+
items.push(dep);
|
|
80
|
+
groups.set(key, items);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const applications = target.metadata?.systemApplications;
|
|
84
|
+
for (const app of applications?.applications || []) {
|
|
85
|
+
const plugin = getApplicationPlugin(app.pluginId);
|
|
86
|
+
if (!plugin?.upstreamCpe || app.type !== plugin.id) continue;
|
|
87
|
+
const core = applications.inventory.find(c => c.applicationId === app.id && c.kind === 'core');
|
|
88
|
+
const file = core?.evidence?.[0]?.path;
|
|
89
|
+
if (!file || !VERSION.test(core.version)) continue;
|
|
90
|
+
const dep = makeDepRecord({
|
|
91
|
+
ecosystem: 'application', name: plugin.id, version: core.version, manifestPath: file,
|
|
92
|
+
scope: 'prod', provenance: 'application'
|
|
93
|
+
});
|
|
94
|
+
Object.assign(dep, {
|
|
95
|
+
coordKey: JSON.stringify([target.id, app.id, 'core']), artifactTargetId: target.id, artifactPath: file,
|
|
96
|
+
systemSection: 'project', systemApplicationIds: [app.id], applicationEvidence: core.evidence
|
|
97
|
+
});
|
|
98
|
+
const key = JSON.stringify([plugin.id, core.version, plugin.upstreamCpe]);
|
|
99
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
100
|
+
groups.get(key).push(dep);
|
|
101
|
+
}
|
|
102
|
+
for (const [key, items] of groups) {
|
|
103
|
+
const [id, version, cpe] = JSON.parse(key);
|
|
104
|
+
const check = {
|
|
105
|
+
collector: 'nvd-image-product',
|
|
106
|
+
product: id,
|
|
107
|
+
version,
|
|
108
|
+
cpe,
|
|
109
|
+
scope: 'upstream-cpe-version',
|
|
110
|
+
count: 0
|
|
111
|
+
};
|
|
112
|
+
coverage.push(check);
|
|
113
|
+
if (options.nvd === false || options.sourceProfile === 'eu') {
|
|
114
|
+
Object.assign(check, {
|
|
115
|
+
execution: 'not-applicable',
|
|
116
|
+
result: 'not-consulted',
|
|
117
|
+
expected: false,
|
|
118
|
+
reason: 'NVD excluded by configuration.'
|
|
119
|
+
});
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const repo = createCacheRepository(options.cacheDir);
|
|
124
|
+
const ns = 'image-product-nvd/2',
|
|
125
|
+
cacheKey = JSON.stringify([cpe, version]);
|
|
126
|
+
let saved = repo.get(ns, cacheKey),
|
|
127
|
+
error;
|
|
128
|
+
if (!options.offline && (!saved || saved.stale || !fresh(saved.fetchedAt) || options.forceUpdate)) {
|
|
129
|
+
try {
|
|
130
|
+
const params = { product: id, version, cpe };
|
|
131
|
+
const apiKey = !require('../providers').hasProxyRoute() && require('../config').getNvdApiKey();
|
|
132
|
+
const response = await getResource('nvd', 'image-product', params, {
|
|
133
|
+
...(apiKey ? {headers:{apiKey}} : {}),
|
|
134
|
+
fetcher: options.fetcher,
|
|
135
|
+
requestTimeoutMs: 30000,
|
|
136
|
+
forceRefresh: options.forceUpdate
|
|
137
|
+
});
|
|
138
|
+
if (!response.ok) throw Error('NVD HTTP ' + response.status);
|
|
139
|
+
const chunks = [];
|
|
140
|
+
let bytes = 0;
|
|
141
|
+
for await (const part of response.body) {
|
|
142
|
+
bytes += part.length;
|
|
143
|
+
if (bytes > DEFAULT_MAX_BODY_BYTES) throw Error('NVD product response exceeds the metadata budget');
|
|
144
|
+
chunks.push(Buffer.from(part));
|
|
145
|
+
}
|
|
146
|
+
const body = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
147
|
+
validateResourceJson({ provider: 'nvd', type: 'image-product', params }, body);
|
|
148
|
+
if (body.totalResults !== body.vulnerabilities.length || body.startIndex !== 0)
|
|
149
|
+
throw Error('Incomplete NVD product response');
|
|
150
|
+
const records = [],
|
|
151
|
+
unknown = [];
|
|
152
|
+
for (const { cve } of body.vulnerabilities) {
|
|
153
|
+
if (cve.vulnStatus === 'Rejected') continue;
|
|
154
|
+
const verdict = evaluateConfiguration({ nodes: cve.configurations }, cpe, version);
|
|
155
|
+
if (verdict === true) records.push(extractFromNvdRecord(cve));
|
|
156
|
+
if (verdict === null) unknown.push(cve.id);
|
|
157
|
+
}
|
|
158
|
+
const stamp = response.headers.get('x-fad-proxy-fetched-at');
|
|
159
|
+
const fetchedAt = stamp ? Date.parse(stamp) : Date.now();
|
|
160
|
+
if (
|
|
161
|
+
(require('../providers').hasProxyRoute() && !stamp) ||
|
|
162
|
+
!Number.isFinite(fetchedAt) ||
|
|
163
|
+
fetchedAt <= 0 ||
|
|
164
|
+
fetchedAt > Date.now() + 300000
|
|
165
|
+
)
|
|
166
|
+
throw Error('Invalid NVD observation timestamp');
|
|
167
|
+
const stale = response.headers.get('x-fad-proxy') === 'stale';
|
|
168
|
+
repo.put(ns, cacheKey, { records, unknown }, { fetchedAt, stale });
|
|
169
|
+
saved = { value: { records, unknown }, fetchedAt, stale };
|
|
170
|
+
} catch (e) {
|
|
171
|
+
error = e.message;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (!saved) throw Error(error || 'No cached NVD consultation for this product/version.');
|
|
175
|
+
const { records, unknown } = saved.value;
|
|
176
|
+
const stale = saved.stale || (!options.offline && !fresh(saved.fetchedAt) && !options.forceUpdate);
|
|
177
|
+
for (const dep of items)
|
|
178
|
+
for (const record of records)
|
|
179
|
+
matches.push({
|
|
180
|
+
dep,
|
|
181
|
+
source: 'nvd',
|
|
182
|
+
confidence: 'probable',
|
|
183
|
+
cve: {
|
|
184
|
+
...record,
|
|
185
|
+
nvdRecordEvidence: { status: 'available', fetchedAt: saved.fetchedAt, stale: !!stale },
|
|
186
|
+
fixVersion: null,
|
|
187
|
+
identityEvidence: dep.binaryEvidence || dep.applicationEvidence,
|
|
188
|
+
advisorySource: 'https://nvd.nist.gov/vuln/detail/' + record.id
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
Object.assign(check, {
|
|
192
|
+
execution: error || stale ? 'partial' : 'completed',
|
|
193
|
+
result: records.length ? 'affected' : error || stale || unknown.length ? 'indeterminate' : 'no-match',
|
|
194
|
+
fetchedAt: saved.fetchedAt,
|
|
195
|
+
count: records.length,
|
|
196
|
+
unknown: unknown.length,
|
|
197
|
+
...(unknown.length ? { undecidableIds: unknown, affectsAssessment: true } : {}),
|
|
198
|
+
reason:
|
|
199
|
+
error ||
|
|
200
|
+
(stale
|
|
201
|
+
? 'Saved NVD consultation is stale.'
|
|
202
|
+
: unknown.length
|
|
203
|
+
? 'Some CPE configuration conditions could not be established.'
|
|
204
|
+
: undefined)
|
|
205
|
+
});
|
|
206
|
+
} catch (e) {
|
|
207
|
+
Object.assign(check, { execution: 'not-run', result: 'indeterminate', reason: e.message });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return { matches, coverage };
|
|
211
|
+
}
|
|
212
|
+
module.exports = { assessProductAdvisories, evaluateConfiguration, VERSION };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Program names identify candidates for presentation. Only product-specific version
|
|
4
|
+
// evidence can authorize upstream matching. Package aliases refer to installed
|
|
5
|
+
// binary packages, never arbitrary npm, PyPI or Composer project names.
|
|
6
|
+
const fingerprints = require('../../data/fingerprints');
|
|
7
|
+
const catalog = new Map();
|
|
8
|
+
for (const rule of fingerprints) {
|
|
9
|
+
if (
|
|
10
|
+
rule.schemaVersion !== 1 ||
|
|
11
|
+
!/^[a-z][a-z0-9-]*$/.test(rule.id) ||
|
|
12
|
+
catalog.has(rule.id) ||
|
|
13
|
+
!['interpreter', 'service'].includes(rule.category)
|
|
14
|
+
)
|
|
15
|
+
throw Error('Invalid image fingerprint ' + rule.id);
|
|
16
|
+
catalog.set(rule.id, {
|
|
17
|
+
...rule,
|
|
18
|
+
executable: new RegExp(rule.executable),
|
|
19
|
+
pkg: new RegExp(rule.osPackage),
|
|
20
|
+
library: rule.elfLibrary ? new RegExp(rule.elfLibrary) : null,
|
|
21
|
+
banner: rule.elfBanner ? new RegExp(rule.elfBanner, 'g') : null
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function binaryProduct(name) {
|
|
26
|
+
if (typeof name !== 'string') return null;
|
|
27
|
+
if (/\.exe$/i.test(name)) name = name.slice(0, -4).toLowerCase();
|
|
28
|
+
for (const product of catalog.values())
|
|
29
|
+
if (product.executable.test(name) && name !== 'master') return product;
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const goServices = new Map(
|
|
34
|
+
[...catalog.values()].filter((p) => p.goMainModule).map((p) => [p.goMainModule, p.id])
|
|
35
|
+
);
|
|
36
|
+
function imageProduct(dep) {
|
|
37
|
+
if (dep.ecosystem === 'image-product') return catalog.get(dep.name);
|
|
38
|
+
if (dep.ecosystem === 'system') {
|
|
39
|
+
for (const product of catalog.values()) if (product.pkg.test(dep.name)) return product;
|
|
40
|
+
}
|
|
41
|
+
if (dep.ecosystem === 'binary') {
|
|
42
|
+
const proof = catalog.get(dep.binaryEvidence?.product);
|
|
43
|
+
if (proof) return proof;
|
|
44
|
+
for (const owner of dep.osPackageOwners || []) {
|
|
45
|
+
for (const product of catalog.values())
|
|
46
|
+
if (
|
|
47
|
+
product.pkg.test(owner.name) &&
|
|
48
|
+
(product.executable.test(dep.name) || ['smtpd', 'master'].includes(dep.name))
|
|
49
|
+
)
|
|
50
|
+
return product;
|
|
51
|
+
}
|
|
52
|
+
return binaryProduct(dep.name);
|
|
53
|
+
}
|
|
54
|
+
if (
|
|
55
|
+
dep.ecosystem === 'go' &&
|
|
56
|
+
(dep.binaryEvidence?.original?.kind === 'mod' || dep.binaryEvidence?.source === 'go-vcs-and-module-proxy')
|
|
57
|
+
) {
|
|
58
|
+
return catalog.get(goServices.get(String(dep.name).replace(/\/v\d+$/, '')));
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
// Application plugin identities are independent of executable/package-name heuristics.
|
|
63
|
+
const upstreamProducts = new Map(catalog);
|
|
64
|
+
for (const plugin of require('../applications/plugins').allApplicationPlugins()) {
|
|
65
|
+
if (plugin.upstreamCpe) upstreamProducts.set(plugin.id,{id:plugin.id,cpe:plugin.upstreamCpe});
|
|
66
|
+
}
|
|
67
|
+
module.exports = { upstreamProducts, catalog, binaryProduct, imageProduct };
|