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
|
@@ -18,7 +18,8 @@ function uniqueFindings(matches = []) {
|
|
|
18
18
|
const prior = unique.get(key);
|
|
19
19
|
if (match.source) {
|
|
20
20
|
const sources = new Set([...(prior.source || "").split("+"), ...String(match.source).split("+")].filter(Boolean));
|
|
21
|
-
unique.set(key, { ...prior, source: [...sources].sort().join("+")
|
|
21
|
+
unique.set(key, { ...prior, source: [...sources].sort().join("+"),
|
|
22
|
+
...(!prior.cve?.distributionUrgency && match.cve?.distributionUrgency ? {cve:{...prior.cve,distributionUrgency:match.cve.distributionUrgency}} : {}) });
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
return [...unique.values()];
|
|
@@ -70,6 +71,7 @@ function summarizeFindings(matches = []) {
|
|
|
70
71
|
const byApplication = {};
|
|
71
72
|
const byApplicationRelation = { direct: 0, indirect: 0, unknown: 0 };
|
|
72
73
|
const excluded = { suppressed: 0, cpeFiltered: 0 };
|
|
74
|
+
const advisories = new Set();
|
|
73
75
|
let total = 0;
|
|
74
76
|
let kev = 0;
|
|
75
77
|
let applicationUnique = 0;
|
|
@@ -78,6 +80,7 @@ function summarizeFindings(matches = []) {
|
|
|
78
80
|
if (m.suppressed) { excluded.suppressed++; continue; }
|
|
79
81
|
if (m.cpeFiltered) { excluded.cpeFiltered++; continue; }
|
|
80
82
|
total++;
|
|
83
|
+
if (m.cve?.id) advisories.add(m.cve.id);
|
|
81
84
|
if (m.cve?.kev) kev++;
|
|
82
85
|
const severity = String(m.cve?.severity || "unknown").toLowerCase();
|
|
83
86
|
bySeverity[severity in bySeverity ? severity : "unknown"]++;
|
|
@@ -90,7 +93,7 @@ function summarizeFindings(matches = []) {
|
|
|
90
93
|
byApplicationRelation[relation in byApplicationRelation ? relation : "unknown"]++;
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
|
-
return { total, kev, applicationUnique, bySeverity, byApplication, byApplicationRelation, applicationExposureOverlaps, excluded };
|
|
96
|
+
return { total, distinctAdvisories: advisories.size, kev, applicationUnique, bySeverity, byApplication, byApplicationRelation, applicationExposureOverlaps, excluded };
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
module.exports = { summarizeFindings, uniqueFindings, coalescePhysicalFindings };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/suppress.js — triage: suppress accepted-risk / false-positive findings so
|
|
2
|
+
* lib/findings/suppress.js — triage: suppress accepted-risk / false-positive findings so
|
|
3
3
|
* re-audits of the same codebase stay signal-rich.
|
|
4
4
|
*
|
|
5
5
|
* Two inputs:
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @author: N.BRAUN
|
|
18
18
|
* @email: pp9ping@gmail.com
|
|
19
19
|
*/
|
|
20
|
-
const { purlFor } = require("
|
|
20
|
+
const { purlFor } = require("../inventory/purl");
|
|
21
21
|
|
|
22
22
|
function coordOf(dep) {
|
|
23
23
|
const ns = dep.namespace || dep.groupId || "";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const http = require('node:http');
|
|
4
|
+
const os = require('node:os');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const {pipeline} = require('node:stream/promises');
|
|
7
|
+
const {Transform} = require('node:stream');
|
|
8
|
+
|
|
9
|
+
function get(socketPath, resource) {
|
|
10
|
+
return new Promise((resolve,reject) => {
|
|
11
|
+
const req = http.get({socketPath, path:resource, agent:false}, res => {
|
|
12
|
+
if (res.statusCode === 200) return resolve(res);
|
|
13
|
+
res.destroy();
|
|
14
|
+
reject(Object.assign(Error('Docker Engine returned HTTP ' + res.statusCode),{status:res.statusCode}));
|
|
15
|
+
});
|
|
16
|
+
req.on('error',reject);
|
|
17
|
+
req.setTimeout(120000, () => req.destroy(Error('Docker Engine stopped responding')));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function openImage(reference,socketPath='/var/run/docker.sock'){
|
|
22
|
+
let image;
|
|
23
|
+
try{
|
|
24
|
+
const response=await get(socketPath,'/images/'+encodeURIComponent(reference)+'/json');
|
|
25
|
+
const chunks=[];let bytes=0;
|
|
26
|
+
for await(const part of response){bytes+=part.length;if(bytes>16*1024*1024)throw Error('Docker metadata exceeds size limit');chunks.push(part);}
|
|
27
|
+
image=JSON.parse(Buffer.concat(chunks));
|
|
28
|
+
}catch(error){if(error.status===404 || ['ENOENT','ECONNREFUSED'].includes(error.code))return null;throw error;}
|
|
29
|
+
if(!/^sha256:[a-f0-9]{64}$/.test(image.Id||''))throw Error('Invalid Docker image identity');
|
|
30
|
+
const dir=require('./temp-roots').track(await fs.promises.mkdtemp(path.join(os.tmpdir(),'vigievuln-docker-'))),file=path.join(dir,'image.tar');
|
|
31
|
+
const cleanup=async()=>{await fs.promises.rm(dir,{recursive:true,force:true});require('./temp-roots').untrack(dir);};
|
|
32
|
+
try{
|
|
33
|
+
let size=0;
|
|
34
|
+
const limit=new Transform({transform(chunk,encoding,done){size+=chunk.length;done(size>20*1024**3?Error('Docker archive exceeds size limit'):null,chunk);}});
|
|
35
|
+
await pipeline(await get(socketPath,'/images/'+encodeURIComponent(image.Id)+'/get'),limit,fs.createWriteStream(file,{flags:'wx',mode:0o600}));
|
|
36
|
+
return {path:file,metadata:{id:image.Id,tags:image.RepoTags||[],repoDigests:image.RepoDigests||[]},cleanup};
|
|
37
|
+
}catch(error){await cleanup();throw error;}
|
|
38
|
+
}
|
|
39
|
+
async function collectImages(socketPath, addImage, failed, selected = () => true) {
|
|
40
|
+
if (!path.isAbsolute(socketPath)) throw Error('a local absolute Docker socket path is required');
|
|
41
|
+
const response = await get(socketPath, '/images/json?all=1');
|
|
42
|
+
const chunks = [];
|
|
43
|
+
let bytes = 0;
|
|
44
|
+
for await (const chunk of response) {
|
|
45
|
+
bytes += chunk.length;
|
|
46
|
+
if (bytes > 32 * 1024 * 1024) throw Error('Docker image list exceeds size limit');
|
|
47
|
+
chunks.push(chunk);
|
|
48
|
+
}
|
|
49
|
+
const images = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
50
|
+
if (!Array.isArray(images)) throw Error('invalid Docker image list');
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
for (const image of images) {
|
|
53
|
+
if (!selected(image)) continue;
|
|
54
|
+
if (!/^sha256:[a-f0-9]{64}$/.test(image.Id)) throw Error('invalid local image ID');
|
|
55
|
+
if (seen.has(image.Id)) continue;
|
|
56
|
+
seen.add(image.Id);
|
|
57
|
+
const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(),'vigievuln-docker-'));
|
|
58
|
+
try {
|
|
59
|
+
const file = path.join(dir, 'image.tar');
|
|
60
|
+
let size = 0;
|
|
61
|
+
const limit = new Transform({transform(chunk, encoding, cb) {
|
|
62
|
+
size += chunk.length;
|
|
63
|
+
cb(size > 20 * 1024 ** 3 ? Error('Docker archive exceeds size limit') : null, chunk);
|
|
64
|
+
}});
|
|
65
|
+
const stream = await get(socketPath, '/images/' + encodeURIComponent(image.Id) + '/get');
|
|
66
|
+
await pipeline(stream,limit,fs.createWriteStream(file,{flags:'wx',mode:0o600}));
|
|
67
|
+
await addImage(file, image.Id, {id:image.Id, tags:image.RepoTags || [], repoDigests:image.RepoDigests || []});
|
|
68
|
+
} catch (error) {failed(image.Id, error);}
|
|
69
|
+
finally {await fs.promises.rm(dir,{recursive:true,force:true});}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
module.exports = {collectImages,openImage};
|
|
@@ -4,20 +4,27 @@
|
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const crypto = require('node:crypto');
|
|
6
6
|
const fs = require('node:fs');
|
|
7
|
-
const config = require('
|
|
8
|
-
const { loadLayers, applyLayers } = require('
|
|
9
|
-
const { proxyScope, proxyOrigin, requireHttpConsent } = require('
|
|
10
|
-
const { resolveHostedProxy } = require('
|
|
11
|
-
const { applySourceProfile, proxyOnlyFetch } = require('
|
|
12
|
-
const { configureResourceRoute } = require('
|
|
13
|
-
const { setActiveCacheDir, getCacheDir } = require('
|
|
7
|
+
const config = require('../config');
|
|
8
|
+
const { loadLayers, applyLayers } = require('../options-env');
|
|
9
|
+
const { proxyScope, proxyOrigin, requireHttpConsent } = require('../cache/proxy-scope');
|
|
10
|
+
const { resolveHostedProxy } = require('../service/hosted-proxy');
|
|
11
|
+
const { applySourceProfile, proxyOnlyFetch } = require('../scan/source-profile');
|
|
12
|
+
const { configureResourceRoute } = require('../providers');
|
|
13
|
+
const { setActiveCacheDir, getCacheDir } = require('../cache/directory');
|
|
14
|
+
|
|
15
|
+
function imageResourceStore(cacheDir, options) {
|
|
16
|
+
const directory=options.vigievulnProxy && options.proxyCache
|
|
17
|
+
? path.join(cacheDir,'hosted-resources',crypto.createHash('sha256').update(options.proxyCache).digest('hex'))
|
|
18
|
+
: path.join(cacheDir,'resource-cache');
|
|
19
|
+
return require('../cache/resource/sqlite-store').createCacheStore(directory);
|
|
20
|
+
}
|
|
14
21
|
|
|
15
22
|
function configureImageNetwork(command, injected = {}) {
|
|
16
23
|
const initial=command.opts(),layers=loadLayers({cwd:process.cwd(),configPath:initial.config,program:command});
|
|
17
24
|
const options=applyLayers(command,layers,config.load());
|
|
18
25
|
if(options.forceUpdate && options.offline)throw Error('--force-update requires an online scan or cache preparation.');
|
|
19
26
|
if(options.stableAdvisoryAgeDays!==undefined && (!Number.isSafeInteger(options.stableAdvisoryAgeDays)||options.stableAdvisoryAgeDays<1||options.stableAdvisoryAgeDays>36500))throw Error('--stable-advisory-age-days must be an integer from 1 to 36500.');
|
|
20
|
-
const previousForce=require('
|
|
27
|
+
const previousForce=require('../cache/policy').shouldForceUpdate();
|
|
21
28
|
Object.assign(options,resolveHostedProxy(options));
|
|
22
29
|
const inherited = command.getOptionValueSource('proxyCacheToken') !== 'cli' &&
|
|
23
30
|
!Object.hasOwn(layers.fileLayer,'proxyCacheToken') && !Object.hasOwn(layers.envLayer,'proxyCacheToken') &&
|
|
@@ -38,17 +45,20 @@ function configureImageNetwork(command, injected = {}) {
|
|
|
38
45
|
setActiveCacheDir(proxyScope(origin,scopeOpts));
|
|
39
46
|
} else if(options.cacheDir) setActiveCacheDir(path.resolve(options.cacheDir));
|
|
40
47
|
const cacheDir=getCacheDir();
|
|
41
|
-
const
|
|
48
|
+
const {guardedFetch,createSourceHealth,displaySourceRetry,getRetryAttempts,setRetryAttempts} = require('../scan/source-health');
|
|
49
|
+
const health = createSourceHealth();
|
|
50
|
+
const previousRetries = getRetryAttempts();
|
|
51
|
+
const retries = setRetryAttempts(options.retries ?? 5);
|
|
52
|
+
const guarded=options.offline ? async()=>{throw Error('offline: network request blocked');} : options.proxyCache ? proxyOnlyFetch(baseFetch,options.proxyCache) : guardedFetch({health, fetch:baseFetch, retries, onRetry:displaySourceRetry});
|
|
42
53
|
if(options.proxyCache && !options.offline){
|
|
43
|
-
const {createCacheStore}=require('./proxy-cache');
|
|
44
54
|
const hosted=!!options.vigievulnProxy;
|
|
45
55
|
configureResourceRoute({proxyUrl:options.proxyCache,hosted,resetRateLimit:true,proxyRateLimitMaxWaitMs:options.proxyRateLimitWaitMs,token:options.proxyCacheToken || process.env.VIGIEVULN_PROXY_CACHE_TOKEN || process.env.FAD_PROXY_CACHE_TOKEN || null,
|
|
46
|
-
fetcher:guarded,store:hosted?null:
|
|
47
|
-
hostedStore:hosted?
|
|
48
|
-
}else configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null});
|
|
49
|
-
require('
|
|
56
|
+
fetcher:guarded,health,onRetry:displaySourceRetry,store:hosted?null:imageResourceStore(cacheDir,options),
|
|
57
|
+
hostedStore:hosted?imageResourceStore(cacheDir,options):null});
|
|
58
|
+
}else configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null,health:null,onRetry:null});
|
|
59
|
+
require('../cache/policy').setForceUpdate(!!options.forceUpdate);
|
|
50
60
|
globalThis.fetch=guarded;
|
|
51
61
|
return {options:{...options,...injected,cacheDir,fetcher:guarded,registryFetcher:options.offline?guarded:(injected.registryFetcher||baseFetch)},warnings:profile.warnings,notices:profile.notices,
|
|
52
|
-
restore(){globalThis.fetch=originalFetch;configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null});setActiveCacheDir(null);require('
|
|
62
|
+
restore(){setRetryAttempts(previousRetries);globalThis.fetch=originalFetch;configureResourceRoute({proxyUrl:null,hosted:false,token:null,store:null,hostedStore:null,fetcher:null,health:null,onRetry:null});setActiveCacheDir(null);require('../cache/policy').setForceUpdate(previousForce);}};
|
|
53
63
|
}
|
|
54
|
-
module.exports={configureImageNetwork};
|
|
64
|
+
module.exports={configureImageNetwork,imageResourceStore};
|
|
@@ -4,7 +4,7 @@ const fs = require('node:fs');
|
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const crypto = require('node:crypto');
|
|
6
6
|
const yaml = require('js-yaml');
|
|
7
|
-
const { makeDirFilter } = require('
|
|
7
|
+
const { makeDirFilter } = require('../inventory/path-filter');
|
|
8
8
|
|
|
9
9
|
function resolveVariables(value, variables) {
|
|
10
10
|
const unresolved = new Set();
|
|
@@ -24,7 +24,7 @@ function classifyImageReference(item) {
|
|
|
24
24
|
if (item.unresolved?.length || /\$[{A-Za-z_]/.test(item.reference || '')) return {...item,classification:'unresolved',scanEligible:false,blockReason:'unresolved-variables'};
|
|
25
25
|
if (item.platformInvalid || (item.platform != null && !/^[A-Za-z0-9][A-Za-z0-9._-]*\/[A-Za-z0-9][A-Za-z0-9._-]*(?:\/[A-Za-z0-9][A-Za-z0-9._-]*)?$/.test(item.platform))) return {...item,classification:'non-scannable',scanEligible:false,blockReason:'invalid-platform'};
|
|
26
26
|
if (!item.reference || item.reason) return {...item,classification:'non-scannable',scanEligible:false,blockReason:item.reason||'missing-reference'};
|
|
27
|
-
try { require('./
|
|
27
|
+
try { require('./registry').parseReference(item.reference); return {...item,classification:'registry',scanEligible:true,blockReason:null}; }
|
|
28
28
|
catch { return {...item,classification:'non-scannable',scanEligible:false,blockReason:'invalid-reference'}; }
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -63,8 +63,11 @@ function dockerfileReferences(text, context = {}) {
|
|
|
63
63
|
for (const match of body.matchAll(/<<(-?)\s*(['"]?)([A-Za-z_][\w.-]*)\2/g)) heredocs.push({ delimiter: match[3], stripTabs: !!match[1] });
|
|
64
64
|
}
|
|
65
65
|
if (command === 'ARG' && stage < 0) {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// One ARG may declare several `name[=value]` words; quoted values may contain spaces.
|
|
67
|
+
for (const [word] of body.matchAll(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g)) {
|
|
68
|
+
const arg = /^([A-Za-z_]\w*)(?:=([\s\S]*))?$/.exec(word);
|
|
69
|
+
if (arg && !Object.hasOwn(variables, arg[1]) && arg[2] !== undefined) variables[arg[1]] = arg[2].replace(/"([^"]*)"|'([^']*)'/g, '$1$2');
|
|
70
|
+
}
|
|
68
71
|
}
|
|
69
72
|
if (command !== 'FROM') continue;
|
|
70
73
|
const from = /^(?:--platform=(\S+)\s+)?(\S+)(?:\s+AS\s+(\S+))?\s*$/i.exec(body);
|
|
@@ -84,12 +87,18 @@ function dockerfileReferences(text, context = {}) {
|
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
function yamlReferences(text, context = {}) {
|
|
87
|
-
const documents = yaml.loadAll(text, undefined, { schema: yaml.JSON_SCHEMA, json: false });
|
|
88
90
|
const out = [], visited = new WeakSet();
|
|
89
91
|
const maxNodes = context.maxNodes ?? 100000;
|
|
90
92
|
let nodes = 0;
|
|
91
93
|
const file=String(context.filePath||'').replace(/\\/g,'/');
|
|
92
94
|
const ci=context.ci === true || /(^|\/)\.gitlab-ci\.ya?ml$/i.test(file) || /(^|\/)\.gitlab\/.*\.ya?ml$/i.test(file) || /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(file);
|
|
95
|
+
// Whole filesystems contain translation catalogues, package locks and test
|
|
96
|
+
// data. Only parse YAML as an image definition when the file or deployment
|
|
97
|
+
// keys provide evidence. Project scans retain their generic extractor.
|
|
98
|
+
if (context.deploymentYamlOnly && !ci &&
|
|
99
|
+
!/(?:^|\/)(?:docker-)?compose(?:[.-][^/]*)?\.ya?ml$/i.test(file) &&
|
|
100
|
+
!/(?:^|[\n{,])\s*['"]?(?:services|containers|initContainers|ephemeralContainers|jobs|docker|apiVersion)['"]?\s*:/m.test(text)) return [];
|
|
101
|
+
const documents = yaml.loadAll(text, undefined, {schema:yaml.JSON_SCHEMA,json:false});
|
|
93
102
|
function walk(value, parts, variables, localImages) {
|
|
94
103
|
if (!value || typeof value !== 'object' || visited.has(value)) return;
|
|
95
104
|
if (++nodes > maxNodes || parts.length > 128) throw Error('YAML image discovery exceeds configured traversal limits');
|
|
@@ -137,10 +146,10 @@ function discoverImageReferences(root, options = {}) {
|
|
|
137
146
|
const dir = stack.pop();
|
|
138
147
|
let entries;
|
|
139
148
|
try { entries = fs.readdirSync(dir, { withFileTypes: true }); }
|
|
140
|
-
catch (error) { warnings.push({ type: 'dependency-coverage', reason: 'image-reference-read-error', message: `Cannot inspect image declarations: ${error.message}` }); continue; }
|
|
149
|
+
catch (error) { warnings.push({ type: 'dependency-coverage', reason: 'image-reference-read-error', ...(error?.code ? { code: error.code } : {}), message: `Cannot inspect image declarations: ${error.message}` }); continue; }
|
|
141
150
|
for (const entry of entries) {
|
|
142
151
|
const file = path.join(dir, entry.name), relative = path.relative(root, file).split(path.sep).join('/');
|
|
143
|
-
if (entry.isDirectory()) { if (!skip(file, entry.name)) stack.push(file); continue; }
|
|
152
|
+
if (entry.isDirectory()) { if (!skip(file, entry.name) && !options.skipInventoryDir?.(file)) stack.push(file); continue; }
|
|
144
153
|
if (!entry.isFile()) continue;
|
|
145
154
|
for (const extractor of extractors) {
|
|
146
155
|
if (!extractor.accepts(entry.name, relative)) continue;
|
|
@@ -149,11 +158,20 @@ function discoverImageReferences(root, options = {}) {
|
|
|
149
158
|
const items = extractor.extract(fs.readFileSync(file, 'utf8'), {...options,filePath:relative});
|
|
150
159
|
for (const item of items) {
|
|
151
160
|
const id = 'image-reference:' + crypto.createHash('sha256').update(JSON.stringify([relative, extractor.id, item.line, item.location, item.declared])).digest('hex');
|
|
152
|
-
|
|
161
|
+
const ref = classifyImageReference(item);
|
|
162
|
+
if (options.redactParseErrors && (!ref.reference || ref.blockReason === 'invalid-reference' ||
|
|
163
|
+
[ref.declared, ref.reference, ref.platform].some(v=>v && (v.length > 1024 || /[\s?#]|:\/\//.test(v))))) {
|
|
164
|
+
ref.declared = '[unparsed image reference]';
|
|
165
|
+
ref.reference = null;
|
|
166
|
+
ref.platform = null;
|
|
167
|
+
ref.scanEligible = false;
|
|
168
|
+
ref.contentVerified = false;
|
|
169
|
+
}
|
|
170
|
+
references.push({ ...ref, id, path: relative, extractor: extractor.id, evidence: 'reference-only', contentVerified: false });
|
|
153
171
|
}
|
|
154
172
|
} catch (error) {
|
|
155
173
|
warnings.push({ type: 'dependency-coverage', reason: 'image-reference-parse-error', manifestPath: relative,
|
|
156
|
-
message: `Image references could not be fully parsed in ${relative}: ${error.message}` });
|
|
174
|
+
message: options.redactParseErrors ? `Image references could not be fully parsed in ${relative}` : `Image references could not be fully parsed in ${relative}: ${error.message}` });
|
|
157
175
|
}
|
|
158
176
|
}
|
|
159
177
|
}
|
|
@@ -208,11 +226,11 @@ function unpinnedImageWarnings(references=[]) {
|
|
|
208
226
|
for(const ref of references){
|
|
209
227
|
if(ref.localBuild || ref.classification==='local-build' || !ref.reference)continue;
|
|
210
228
|
// Invalid or unresolved references cannot establish whether a pin is valid.
|
|
211
|
-
let parsed;try{parsed=require('./
|
|
229
|
+
let parsed;try{parsed=require('./registry').parseReference(ref.reference);}catch{continue;}
|
|
212
230
|
if(parsed.reference.includes(':'))continue;
|
|
213
231
|
const key=JSON.stringify([ref.reference,ref.path,ref.line,ref.location]);if(seen.has(key))continue;seen.add(key);
|
|
214
232
|
const location=ref.path ? `${ref.path}${ref.line?':'+ref.line:''}${ref.location?' ('+ref.location+')':''}` : null;
|
|
215
|
-
items.push({id:ref.reference,reference:ref.reference,declared:ref.declared||ref.reference,
|
|
233
|
+
items.push({id:ref.reference,reference:ref.reference,...(ref.declaredInTargetId && {declaredInTargetId:ref.declaredInTargetId}),declared:ref.declared||ref.reference,
|
|
216
234
|
...(ref.path?{manifestPaths:[ref.path]}:{}),...(ref.line?{line:ref.line}:{}),...(ref.location?{location:ref.location}:{}),
|
|
217
235
|
...(location?{detail:location}:{})});
|
|
218
236
|
}
|
|
@@ -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
|
// OCI transport only: no image execution, Docker client or credential helper.
|
|
4
8
|
const fs = require('node:fs');
|
|
@@ -72,9 +76,14 @@ function createRegistryTransport(ref, options, limits) {
|
|
|
72
76
|
const origin = `${options.insecure ? 'http' : 'https'}://${ref.registry}`;
|
|
73
77
|
const base = `${origin}/v2/${ref.repository}`;
|
|
74
78
|
const fetcher = options.fetcher || globalThis.fetch;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
// Credentials bound to a registry host are sent to that host only: a CI secret for a
|
|
80
|
+
// private registry must not reach Docker Hub when a public image is scanned.
|
|
81
|
+
const bound = String(options.credentials?.registry || '').trim().toLowerCase().replace(/^https?:\/\//, '').replace(/\/+$/, '');
|
|
82
|
+
const hosts = host => host === 'docker.io' || host === 'index.docker.io' ? 'registry-1.docker.io' : host;
|
|
83
|
+
const credentials = bound && hosts(bound) !== String(ref.registry).toLowerCase() ? null : options.credentials;
|
|
84
|
+
let authorization = credentials?.token ? `Bearer ${credentials.token}` : null;
|
|
85
|
+
const basic = credentials?.username !== undefined
|
|
86
|
+
? 'Basic ' + Buffer.from(`${credentials.username}:${credentials.password || ''}`).toString('base64') : null;
|
|
78
87
|
async function request(url, headers = {}) {
|
|
79
88
|
let current = new URL(url), requestHeaders = { ...headers };
|
|
80
89
|
for (let count = 0; count <= limits.redirects; count++) {
|
|
@@ -205,7 +214,7 @@ async function fetchRegistryImage(reference, options = {}) {
|
|
|
205
214
|
const type = document.mediaType || response.headers.get('content-type')?.split(';')[0];
|
|
206
215
|
if (Array.isArray(document.manifests)) {
|
|
207
216
|
const children = document.manifests.filter(d => {
|
|
208
|
-
const attestation = d.artifactType || d.annotations?.['vnd.docker.reference.type'] === 'attestation-manifest' || (d.platform?.os === 'unknown' && d.platform?.architecture === 'unknown');
|
|
217
|
+
const attestation = foreignArtifact(d.artifactType) || d.annotations?.['vnd.docker.reference.type'] === 'attestation-manifest' || (d.platform?.os === 'unknown' && d.platform?.architecture === 'unknown');
|
|
209
218
|
if (attestation) { diagnostics.push({ kind: 'non-image-artifact', digest: d.digest, artifactType: d.artifactType || d.annotations?.['vnd.docker.reference.type'] || 'unknown-platform' }); return false; }
|
|
210
219
|
return platformMatches(d.platform);
|
|
211
220
|
});
|
|
@@ -218,7 +227,7 @@ async function fetchRegistryImage(reference, options = {}) {
|
|
|
218
227
|
// A selected-platform layout has its own index; original registry digest remains evidence.
|
|
219
228
|
return { mediaType: type, digest, size: buffer.length, children: manifests };
|
|
220
229
|
}
|
|
221
|
-
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))) {
|
|
230
|
+
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))) {
|
|
222
231
|
diagnostics.push({ kind: 'non-image-artifact', digest, artifactType: document.artifactType || document.config?.mediaType || 'subject' });
|
|
223
232
|
return null;
|
|
224
233
|
}
|
|
@@ -284,13 +293,13 @@ async function fetchRegistrySboms(reference, options = {}) {
|
|
|
284
293
|
for (const child of doc.manifests) {
|
|
285
294
|
const annotation = child.annotations || {};
|
|
286
295
|
if (annotation['vnd.docker.reference.type'] === 'attestation-manifest') { attached.push(child); continue; }
|
|
287
|
-
if (child.artifactType || (child.platform?.os === 'unknown' && child.platform?.architecture === 'unknown')) { fail('unclassified-index-artifact', { digest: child.digest }); continue; }
|
|
296
|
+
if (foreignArtifact(child.artifactType) || (child.platform?.os === 'unknown' && child.platform?.architecture === 'unknown')) { fail('unclassified-index-artifact', { digest: child.digest }); continue; }
|
|
288
297
|
if (child.platform && !matches(child.platform)) continue;
|
|
289
298
|
await walk(child.digest, child, child.platform || platform, depth + 1);
|
|
290
299
|
}
|
|
291
300
|
return fetched.digest;
|
|
292
301
|
}
|
|
293
|
-
if (doc.artifactType || doc.subject || !doc.config || !Array.isArray(doc.layers)) { fail('not-image-manifest', { digest: fetched.digest }); return fetched.digest; }
|
|
302
|
+
if (foreignArtifact(doc.artifactType) || doc.subject || !doc.config || !Array.isArray(doc.layers)) { fail('not-image-manifest', { digest: fetched.digest }); return fetched.digest; }
|
|
294
303
|
const config = parse((await blob(doc.config)).body);
|
|
295
304
|
const actual = { os: config.os, architecture: config.architecture, ...(config.variant ? { variant: config.variant } : {}) };
|
|
296
305
|
if (platform && (platform.os !== actual.os || platform.architecture !== actual.architecture || (platform.variant && platform.variant !== actual.variant))) throw Error('image platform descriptor/config mismatch');
|
|
@@ -367,11 +376,11 @@ async function fetchRegistryTagPlatform(reference,platform,options={}) {
|
|
|
367
376
|
if(expected&&expected!==digest)throw Error('image manifest digest mismatch');const doc=JSON.parse(buffer.toString('utf8'));
|
|
368
377
|
if(doc.schemaVersion!==2)throw Error('unsupported image manifest schema');
|
|
369
378
|
if(Array.isArray(doc.manifests)){
|
|
370
|
-
for(const d of doc.manifests){if(d.artifactType||d.annotations?.['vnd.docker.reference.type']==='attestation-manifest'||(d.platform&&!matches(d.platform)))continue;
|
|
379
|
+
for(const d of doc.manifests){if(foreignArtifact(d.artifactType)||d.annotations?.['vnd.docker.reference.type']==='attestation-manifest'||(d.platform&&!matches(d.platform)))continue;
|
|
371
380
|
const child=await readManifest(d.digest,depth+1,d.size,d.platform||declaredPlatform);if(child)return {digest,platformDigest:child.platformDigest};}
|
|
372
381
|
return null;
|
|
373
382
|
}
|
|
374
|
-
if(doc.artifactType||doc.subject||!doc.config||!Array.isArray(doc.layers))return null;
|
|
383
|
+
if(foreignArtifact(doc.artifactType)||doc.subject||!doc.config||!Array.isArray(doc.layers))return null;
|
|
375
384
|
const descriptor=doc.config;digestParts(descriptor.digest);if(!Number.isSafeInteger(descriptor.size)||descriptor.size<0||descriptor.size>limits.metadataBytes)throw Error('invalid image config size');
|
|
376
385
|
const resConfig=await registryGet(`${base}/blobs/${descriptor.digest}`),bytes=await readBounded(resConfig,limits.metadataBytes);
|
|
377
386
|
if(bytes.length!==descriptor.size||`sha256:${crypto.createHash('sha256').update(bytes).digest('hex')}`!==descriptor.digest)throw Error('image config digest/size mismatch');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// This layer reuses the existing OCI acquisition and inventory cache; source
|
|
4
4
|
// declarations are attached only after acquisition so cached inventories
|
|
5
5
|
// never acquire another project's paths.
|
|
6
|
-
const {parseReference}=require('./
|
|
7
|
-
const {acquireInventories,assessInventories}=require('
|
|
6
|
+
const {parseReference}=require('./registry');
|
|
7
|
+
const {acquireInventories,assessInventories}=require('../artifacts/scan');
|
|
8
8
|
|
|
9
9
|
function declaration(ref,digest){return {id:ref.id,path:ref.path,line:ref.line??null,location:ref.location??null,declared:ref.declared,
|
|
10
10
|
reference:ref.reference,role:ref.role,stage:ref.stage??null,stageName:ref.stageName??null,finalStage:ref.finalStage??null,
|
|
@@ -13,7 +13,7 @@ function eligible(ref){return ref?.scanEligible!==false && (!ref?.classification
|
|
|
13
13
|
async function scanSourceImages(input,options={}){
|
|
14
14
|
const references=(input||[]).map(ref=>({...ref,boundArtifactIds:[]})),warnings=[],notices=[],empty={artifacts:[],matches:[],resolvedDeps:new Map(),warnings,notices,references};
|
|
15
15
|
if(options.images===false)return empty;
|
|
16
|
-
warnings.push(...require('./
|
|
16
|
+
warnings.push(...require('./references').unpinnedImageWarnings(references));
|
|
17
17
|
const groups=new Map();
|
|
18
18
|
for(const ref of references){
|
|
19
19
|
if(!eligible(ref)){ref.scanStatus='not-scannable';ref.imageScan={status:'not-scannable',reasonCode:ref.classification||'unresolved',message:ref.blockReason||'The image declaration cannot be resolved to a registry image.',artifactIds:[]};continue;}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Extraction roots can hold a whole image. An interrupted scan (Ctrl-C, a caller's
|
|
3
|
+
// timeout) removes the ones still registered before the process ends; normal completion
|
|
4
|
+
// unregisters them through their own cleanup.
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const roots = new Set();
|
|
7
|
+
let installed = false;
|
|
8
|
+
|
|
9
|
+
function removeAll() {
|
|
10
|
+
for (const dir of roots) { try { fs.rmSync(dir, { recursive: true, force: true }); } catch { /* best effort on the way out */ } }
|
|
11
|
+
roots.clear();
|
|
12
|
+
}
|
|
13
|
+
function install() {
|
|
14
|
+
if (installed) return;
|
|
15
|
+
installed = true;
|
|
16
|
+
for (const [signal, code] of [['SIGINT', 130], ['SIGTERM', 143]]) {
|
|
17
|
+
process.once(signal, () => { removeAll(); process.exit(code); });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function track(dir) { install(); roots.add(dir); return dir; }
|
|
21
|
+
function untrack(dir) { roots.delete(dir); }
|
|
22
|
+
|
|
23
|
+
module.exports = { track, untrack, removeAll };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const crypto=require('node:crypto');
|
|
3
|
-
const {createCacheRepository}=require('
|
|
4
|
-
const {getCacheDir}=require('
|
|
5
|
-
const {parseReference,fetchRegistryTags,fetchRegistryTagPlatform}=require('./
|
|
3
|
+
const {createCacheRepository}=require('../cache/repository');
|
|
4
|
+
const {getCacheDir}=require('../cache/directory');
|
|
5
|
+
const {parseReference,fetchRegistryTags,fetchRegistryTagPlatform}=require('./registry');
|
|
6
6
|
|
|
7
7
|
// Only patch releases with an exact major.minor branch and suffix are ordered.
|
|
8
8
|
// A suffix is treated as an opaque variant, never as a guessed version.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/dep-record.js — contrat de données unifié partagé par tous les codecs.
|
|
2
|
+
* lib/inventory/dep-record.js — contrat de données unifié partagé par tous les codecs.
|
|
3
3
|
*
|
|
4
4
|
* `coordKey` est la clé de la Map résolue ; elle ne collisionne jamais entre
|
|
5
5
|
* écosystèmes grâce au préfixe `ecosystem:`. `groupId`/`artifactId`/`pomPaths`
|
|
@@ -62,7 +62,7 @@ function makeDepRecord(input) {
|
|
|
62
62
|
// coord: on a scan root spanning several independent projects (A pins
|
|
63
63
|
// jackson-databind 2.15.3, B pins 2.17.0) both projects are reported as holding
|
|
64
64
|
// BOTH versions and each version's CVEs land on both. Maintained on merge by the
|
|
65
|
-
// collectors; consumed by lib/attribution.js.
|
|
65
|
+
// collectors; consumed by lib/findings/attribution.js.
|
|
66
66
|
versionPaths: concrete && manifestPath ? { [concrete]: [manifestPath] } : {},
|
|
67
67
|
coordKey,
|
|
68
68
|
provenance,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/deps-descriptor.js — serialize / deserialize an *anonymized* descriptor of
|
|
2
|
+
* lib/inventory/deps-descriptor.js — serialize / deserialize an *anonymized* descriptor of
|
|
3
3
|
* the resolved dependency set, for air-gapped offline→online→offline audits.
|
|
4
4
|
*
|
|
5
5
|
* Phase 1 (offline): collect deps → serializeDeps → write JSON. Remove manifest
|
|
@@ -80,7 +80,7 @@ function serializeImageReferences(items, {images=true}={}) {
|
|
|
80
80
|
if(!item || item.scanEligible===false || item.localBuild || (item.classification && item.classification!=='registry') || (Array.isArray(item.unresolved)&&item.unresolved.length))continue;
|
|
81
81
|
const reference=typeof item.reference==='string'?item.reference.trim():'';
|
|
82
82
|
if(!reference || reference.length>1024 || /[$\x00-\x20\x7f]/.test(reference))continue;
|
|
83
|
-
try{require('
|
|
83
|
+
try{require('../images/registry').parseReference(reference)}catch{continue}
|
|
84
84
|
const platform=item.platform == null ? null : typeof item.platform==='string' && /^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)?$/.test(item.platform) ? item.platform : false;
|
|
85
85
|
if(platform===false)continue;
|
|
86
86
|
const record={reference,...(platform?{platform}:{})};
|
|
@@ -210,7 +210,7 @@ function deserializeDeps(descriptor, opts = {}) {
|
|
|
210
210
|
externalParents: Array.isArray(mvn.externalParents) ? mvn.externalParents : [],
|
|
211
211
|
importBoms: Array.isArray(mvn.importBoms) ? mvn.importBoms : [],
|
|
212
212
|
propertyOverrides: (mvn.propertyOverrides && typeof mvn.propertyOverrides === "object") ? mvn.propertyOverrides : {},
|
|
213
|
-
reactor: mvn.reactor ? require('
|
|
213
|
+
reactor: mvn.reactor ? require('../codecs/maven/airgap').restoreReactorHints(mvn.reactor) : null,
|
|
214
214
|
applications,
|
|
215
215
|
imageReferences: serializeImageReferences(descriptor.imageReferences,{images:opts.images}),
|
|
216
216
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/descriptor-refs.js — WHERE, inside a descriptor, a dependency is declared.
|
|
2
|
+
* lib/inventory/descriptor-refs.js — WHERE, inside a descriptor, a dependency is declared.
|
|
3
3
|
*
|
|
4
4
|
* A finding's "defined in" names the module; an auditor who has to act on it needs the
|
|
5
5
|
* file AND the line. `findDeclarations(file, dep)` re-reads the descriptor and returns
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/embedded.js — inventory of Maven coordinates discovered inside committed
|
|
2
|
+
* lib/inventory/embedded.js — inventory of Maven coordinates discovered inside committed
|
|
3
3
|
* .jar/.war/.ear archives (provenance:"embedded"), whether or not they carry a CVE.
|
|
4
4
|
*
|
|
5
5
|
* This is a governance / cyber-hygiene signal: the JAR twin of the native-binary
|
|
6
|
-
* inventory (lib/unmanaged.js → chapter 1C) and the vendored-JS inventory
|
|
7
|
-
* (lib/retire.js → chapter 1D). Code that ships inside a committed binary which no
|
|
6
|
+
* inventory (lib/inventory/unmanaged.js → chapter 1C) and the vendored-JS inventory
|
|
7
|
+
* (lib/providers/retire/scan.js → chapter 1D). Code that ships inside a committed binary which no
|
|
8
8
|
* pom.xml declares has unknown provenance and patch story even when not vulnerable.
|
|
9
9
|
*
|
|
10
10
|
* Pure: shared by the HTML report (chapter 1B) and the JSON export so both list the
|
|
@@ -37,6 +37,7 @@ function buildEmbeddedInventory(resolvedDeps, embeddedMatches) {
|
|
|
37
37
|
const archive = String(manifestPath).split("!/")[0];
|
|
38
38
|
const cve = cveByCoord.get(dep.coordKey);
|
|
39
39
|
out.push({
|
|
40
|
+
...(dep.artifactTargetId ? {artifactTargetId:dep.artifactTargetId} : {}),
|
|
40
41
|
archive,
|
|
41
42
|
groupId: dep.groupId || dep.namespace || "",
|
|
42
43
|
artifactId: dep.artifactId || dep.name || "",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/license-policy.js — normalize free-form license strings to SPDX ids and
|
|
2
|
+
* lib/inventory/license-policy.js — normalize free-form license strings to SPDX ids and
|
|
3
3
|
* classify them into policy categories (permissive / copyleft / proprietary).
|
|
4
4
|
*
|
|
5
5
|
* Data-driven: data/license-policy.json holds the id→category table and an
|
|
@@ -16,7 +16,7 @@ const POLICY = (() => {
|
|
|
16
16
|
try {
|
|
17
17
|
// require() (not fs.readFileSync) so bun --compile bundles the data file
|
|
18
18
|
// into the standalone binary instead of reading it off disk at runtime.
|
|
19
|
-
const raw = require("
|
|
19
|
+
const raw = require("../../data/license-policy.json");
|
|
20
20
|
return { categories: raw.categories || {}, aliases: raw.aliases || {} };
|
|
21
21
|
} catch { return { categories: {}, aliases: {} }; }
|
|
22
22
|
})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/manifest-copy.js — when writing a cleaned tree (`-t`), copy every NON-Maven
|
|
2
|
+
* lib/inventory/manifest-copy.js — when writing a cleaned tree (`-t`), copy every NON-Maven
|
|
3
3
|
* ecosystem manifest / lockfile from the source into the target at the same relative
|
|
4
4
|
* path, so `snyk test --all-projects` on the cleaned tree scans every ecosystem — not
|
|
5
5
|
* just the cleaned Maven POMs (which are written separately by core.rewritePoms).
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const fs = require("fs");
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const { makeDirFilter } = require("./path-filter");
|
|
14
|
-
const { allCodecs } = require("
|
|
14
|
+
const { allCodecs } = require("../codecs");
|
|
15
15
|
|
|
16
16
|
// Ecosystems whose manifests/lockfiles Snyk reads off disk.
|
|
17
17
|
const COPY_ECOSYSTEMS = new Set(["npm", "nuget", "composer", "pypi", "go", "ruby"]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/module-names.js — the display name of one of the SCANNED PROJECT's OWN descriptors.
|
|
2
|
+
* lib/inventory/module-names.js — the display name of one of the SCANNED PROJECT's OWN descriptors.
|
|
3
3
|
*
|
|
4
4
|
* This is about the modules being audited (a reactor's poms, a monorepo's package.json
|
|
5
5
|
* files), never about the dependencies they pull in. It exists so the report can say
|
|
@@ -33,9 +33,9 @@ function valid(r) {
|
|
|
33
33
|
function filename(r) { return `${identityKey(r)}-${r.sha256}.json`; }
|
|
34
34
|
function relativePath(r) {const f=filename(r);return path.join(f.slice(0,2),f);}
|
|
35
35
|
function readRecord(file) { try {const r=JSON.parse(fs.readFileSync(file,'utf8'));return valid(r) && path.basename(file)===filename(r) ? r : null;} catch {return null;} }
|
|
36
|
-
function getVersion(ecosystem,name,version,{cacheDir=require('
|
|
36
|
+
function getVersion(ecosystem,name,version,{cacheDir=require('../cache/directory').getCacheDir()}={}) {
|
|
37
37
|
const origin=origins[ecosystem];if(!origin)return null;
|
|
38
|
-
const rows=require('
|
|
38
|
+
const rows=require('../cache/db').getCacheDb(cacheDir).prepare(
|
|
39
39
|
'SELECT sha256,collected_at,source_url,format,body FROM package_versions WHERE origin=? AND ecosystem=? AND name=? AND version=?'
|
|
40
40
|
).all(origin,ecosystem,name,version);
|
|
41
41
|
const records=[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/parallel-walk.js — bounded-concurrency recursive directory walk.
|
|
2
|
+
* lib/inventory/parallel-walk.js — bounded-concurrency recursive directory walk.
|
|
3
3
|
*
|
|
4
4
|
* A serial readdirSync walk is fine on a fast local disk, but on a high-latency
|
|
5
5
|
* filesystem (WSL/9p, network mounts, the air-gapped VM in the field) each readdir
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/path-filter.js — directory-walk pruning policy shared by every codec walker.
|
|
2
|
+
* lib/inventory/path-filter.js — directory-walk pruning policy shared by every codec walker.
|
|
3
3
|
*
|
|
4
4
|
* Two layers:
|
|
5
5
|
* - default skips: each walker's own basename set (node_modules, vendor, target,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/private-deps.js — "this coordinate exists in no registry we asked", for every
|
|
2
|
+
* lib/inventory/private-deps.js — "this coordinate exists in no registry we asked", for every
|
|
3
3
|
* ecosystem that has a registry.
|
|
4
4
|
*
|
|
5
5
|
* Maven has had this since the beginning: a coordinate absent from every configured
|
|
@@ -15,6 +15,9 @@ function buildProjectDescriptor(resolved, {generator="vigievuln", imageReference
|
|
|
15
15
|
if (Array.isArray(relation)) relation = relation.includes("direct") ? "direct"
|
|
16
16
|
: relation.length && relation.every(r => r === "transitive") ? "transitive" : "unknown";
|
|
17
17
|
if (!["direct","transitive","unknown"].includes(relation)) relation = "unknown";
|
|
18
|
+
// A Maven dependency declared without its own version takes the managed one. With a
|
|
19
|
+
// single resolved version there is nothing else the declaration could designate.
|
|
20
|
+
if (relation === "unknown" && dep.declaredDirect === true && dep.ecosystem === "maven" && version && versions.length === 1) relation = "direct";
|
|
18
21
|
// Managed pins and embedded binaries cannot be direct declarations.
|
|
19
22
|
if (dep.managedOnly || ["embedded","binary"].includes(dep.provenance)) relation = "unknown";
|
|
20
23
|
const ecosystemType = typeof dep.ecosystemType === "string" && /^[A-Za-z0-9._-]+$/.test(dep.ecosystemType) ? dep.ecosystemType : dep.ecosystem;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/purl.js — build Package URL (purl) strings from a depRecord.
|
|
2
|
+
* lib/inventory/purl.js — build Package URL (purl) strings from a depRecord.
|
|
3
3
|
*
|
|
4
4
|
* purl spec: pkg:<type>/<namespace>/<name>@<version>?qualifiers#subpath
|
|
5
5
|
* We only emit type/namespace/name@version — enough for CycloneDX `bom-ref`
|
|
6
6
|
* and CSAF `product_identification_helper.purl`.
|
|
7
7
|
*
|
|
8
|
-
* Pure (no I/O). Shared by lib/sbom-export.js and lib/csaf-export.js.
|
|
8
|
+
* Pure (no I/O). Shared by lib/reports/sbom-export.js and lib/reports/csaf-export.js.
|
|
9
9
|
*
|
|
10
10
|
* @author: N.BRAUN
|
|
11
11
|
* @email: pp9ping@gmail.com
|