vigievuln 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.md +34 -19
- package/completions/vigievuln.bash +14 -3
- package/completions/vigievuln.zsh +11 -8
- package/data/fingerprints/index.js +80 -0
- package/data/fingerprints/interpreters/javascript/bun.json +23 -0
- package/data/fingerprints/interpreters/javascript/deno.json +10 -0
- package/data/fingerprints/interpreters/javascript/electron.json +20 -0
- package/data/fingerprints/interpreters/javascript/gjs.json +8 -0
- package/data/fingerprints/interpreters/javascript/javascriptcore.json +14 -0
- package/data/fingerprints/interpreters/javascript/jscgtk.json +10 -0
- package/data/fingerprints/interpreters/javascript/node.json +26 -0
- package/data/fingerprints/interpreters/javascript/nwjs.json +8 -0
- package/data/fingerprints/interpreters/javascript/webkitgtk.json +10 -0
- package/data/fingerprints/interpreters/javascript/wpewebkit.json +10 -0
- package/data/fingerprints/interpreters/languages/dotnet.json +8 -0
- package/data/fingerprints/interpreters/languages/erlang.json +9 -0
- package/data/fingerprints/interpreters/languages/gawk.json +10 -0
- package/data/fingerprints/interpreters/languages/guile.json +9 -0
- package/data/fingerprints/interpreters/languages/java.json +8 -0
- package/data/fingerprints/interpreters/languages/julia.json +9 -0
- package/data/fingerprints/interpreters/languages/lua.json +11 -0
- package/data/fingerprints/interpreters/languages/luajit.json +10 -0
- package/data/fingerprints/interpreters/languages/perl.json +11 -0
- package/data/fingerprints/interpreters/languages/php.json +22 -0
- package/data/fingerprints/interpreters/languages/powershell.json +17 -0
- package/data/fingerprints/interpreters/languages/pypy.json +8 -0
- package/data/fingerprints/interpreters/languages/python.json +24 -0
- package/data/fingerprints/interpreters/languages/r.json +9 -0
- package/data/fingerprints/interpreters/languages/racket.json +9 -0
- package/data/fingerprints/interpreters/languages/raku.json +8 -0
- package/data/fingerprints/interpreters/languages/ruby.json +21 -0
- package/data/fingerprints/interpreters/languages/tcl.json +9 -0
- package/data/fingerprints/interpreters/shells/bash.json +10 -0
- package/data/fingerprints/interpreters/shells/dash.json +8 -0
- package/data/fingerprints/interpreters/shells/fish.json +9 -0
- package/data/fingerprints/interpreters/shells/ksh.json +8 -0
- package/data/fingerprints/interpreters/shells/zsh.json +9 -0
- package/data/fingerprints/services/databases/clickhouse.json +8 -0
- package/data/fingerprints/services/databases/elasticsearch.json +8 -0
- package/data/fingerprints/services/databases/etcd.json +9 -0
- package/data/fingerprints/services/databases/mariadb.json +9 -0
- package/data/fingerprints/services/databases/memcached.json +9 -0
- package/data/fingerprints/services/databases/mongo.json +8 -0
- package/data/fingerprints/services/databases/mysql.json +9 -0
- package/data/fingerprints/services/databases/opensearch.json +8 -0
- package/data/fingerprints/services/databases/postgres.json +18 -0
- package/data/fingerprints/services/databases/redis.json +9 -0
- package/data/fingerprints/services/databases/valkey.json +8 -0
- package/data/fingerprints/services/dns-directory/bind.json +8 -0
- package/data/fingerprints/services/dns-directory/dnsmasq.json +8 -0
- package/data/fingerprints/services/dns-directory/slapd.json +8 -0
- package/data/fingerprints/services/dns-directory/unbound.json +8 -0
- package/data/fingerprints/services/mail/cyrus.json +8 -0
- package/data/fingerprints/services/mail/dovecot.json +8 -0
- package/data/fingerprints/services/mail/exim.json +9 -0
- package/data/fingerprints/services/mail/opendkim.json +8 -0
- package/data/fingerprints/services/mail/opensmtpd.json +8 -0
- package/data/fingerprints/services/mail/postfix.json +8 -0
- package/data/fingerprints/services/mail/rspamd.json +8 -0
- package/data/fingerprints/services/mail/sendmail.json +8 -0
- package/data/fingerprints/services/messaging/kafka.json +8 -0
- package/data/fingerprints/services/messaging/mosquitto.json +8 -0
- package/data/fingerprints/services/messaging/nats.json +9 -0
- package/data/fingerprints/services/messaging/rabbitmq.json +8 -0
- package/data/fingerprints/services/remote-access/dropbear.json +8 -0
- package/data/fingerprints/services/remote-access/openssh.json +10 -0
- package/data/fingerprints/services/remote-access/proftpd.json +8 -0
- package/data/fingerprints/services/remote-access/samba.json +8 -0
- package/data/fingerprints/services/remote-access/vsftpd.json +8 -0
- package/data/fingerprints/services/web-proxies/apache.json +18 -0
- package/data/fingerprints/services/web-proxies/caddy.json +9 -0
- package/data/fingerprints/services/web-proxies/envoy.json +8 -0
- package/data/fingerprints/services/web-proxies/haproxy.json +10 -0
- package/data/fingerprints/services/web-proxies/lighttpd.json +8 -0
- package/data/fingerprints/services/web-proxies/nginx.json +14 -0
- package/data/fingerprints/services/web-proxies/squid.json +8 -0
- package/data/fingerprints/services/web-proxies/tomcat.json +8 -0
- package/data/fingerprints/services/web-proxies/traefik.json +9 -0
- package/data/fingerprints/services/web-proxies/varnish.json +8 -0
- package/lib/README.md +51 -0
- package/lib/{coverage-diagnostics.js → advisories/coverage-diagnostics.js} +1 -1
- package/lib/{cve-match.js → advisories/cve-match.js} +17 -12
- package/lib/{advisory-fixes.js → advisories/fixes.js} +1 -1
- package/lib/{advisory-freshness.js → advisories/freshness.js} +5 -1
- package/lib/{gap-adjudicate.js → advisories/gap-adjudicate.js} +3 -3
- package/lib/{native-package-match.js → advisories/native-package-match.js} +20 -11
- package/lib/{native-source-prepare.js → advisories/native-source-prepare.js} +15 -12
- package/lib/{native-advisories.js → advisories/native.js} +15 -13
- package/lib/{advisory-store-sqlite.js → advisories/store-sqlite.js} +5 -5
- package/lib/{advisory-store.js → advisories/store.js} +2 -2
- package/lib/{application-exports.js → applications/exports.js} +1 -1
- package/lib/{application-inventory.js → applications/inventory.js} +3 -1
- package/lib/applications/layout.js +199 -0
- package/lib/{application-providers → applications}/live-snapshot.js +10 -10
- package/lib/{application-plugins → applications/plugins}/drupal.js +2 -2
- package/lib/applications/plugins/ghost.js +36 -0
- package/lib/{application-plugins → applications/plugins}/index.js +1 -1
- package/lib/{application-plugins → applications/plugins}/prestashop.js +73 -15
- package/lib/applications/plugins/redmine.js +24 -0
- package/lib/{application-plugins → applications/plugins}/runner.js +89 -59
- package/lib/{application-plugins → applications/plugins}/spip.js +4 -4
- package/lib/{application-plugins → applications/plugins}/symfony.js +1 -1
- package/lib/{application-plugins → applications/plugins}/typo3.js +2 -2
- package/lib/{application-plugins → applications/plugins}/wave2-common.js +1 -1
- package/lib/{application-plugins → applications/plugins}/wordpress.js +52 -18
- package/lib/{application-providers → applications}/snapshot-cache.js +1 -1
- package/lib/{cms-snapshot-warm.js → applications/snapshot-warm.js} +21 -8
- package/lib/artifacts/access-warnings.js +24 -0
- package/lib/artifacts/applications.js +39 -8
- package/lib/artifacts/component-scope.js +12 -3
- package/lib/artifacts/cve-view.js +8 -5
- package/lib/artifacts/disk-wasm.mjs +3 -0
- package/lib/artifacts/disk.js +188 -0
- package/lib/artifacts/elf-product.js +215 -0
- package/lib/artifacts/enrichment.js +31 -17
- package/lib/artifacts/go-main-identity.js +135 -36
- package/lib/artifacts/go-publisher-advisories.js +4 -3
- package/lib/artifacts/image-products.js +181 -0
- package/lib/artifacts/index.js +36 -13
- package/lib/artifacts/install-version.js +44 -0
- package/lib/artifacts/inventory-scope.js +53 -3
- package/lib/artifacts/pe-product.js +28 -0
- package/lib/artifacts/product-advisories.js +212 -0
- package/lib/artifacts/product-catalog.js +67 -0
- package/lib/artifacts/release-catalogues.js +149 -0
- package/lib/artifacts/release-versions.js +101 -0
- package/lib/artifacts/remediation-report.js +1 -1
- package/lib/artifacts/report-inventory.js +17 -2
- package/lib/artifacts/report-path.js +29 -0
- package/lib/artifacts/report.js +85 -32
- package/lib/artifacts/retire.js +3 -3
- package/lib/artifacts/risk-report.js +12 -8
- package/lib/artifacts/sbom.js +33 -4
- package/lib/artifacts/scan.js +316 -69
- package/lib/artifacts/system-apps.js +98 -0
- package/lib/artifacts/system-maintenance.js +101 -0
- package/lib/artifacts/system-module-updates.js +104 -0
- package/lib/artifacts/system-report.js +232 -0
- package/lib/{airgap-project.js → cache/airgap-project.js} +25 -10
- package/lib/{cache-archive-sqlite.js → cache/archive.js} +6 -5
- package/lib/{cache-db.js → cache/db.js} +1 -1
- package/lib/{dump-format.js → cache/dump-format.js} +2 -2
- package/lib/{json-cache.js → cache/json.js} +1 -1
- package/lib/{proxy-cache.js → cache/proxy-cache.js} +9 -9
- package/lib/{proxy-scope.js → cache/proxy-scope.js} +1 -1
- package/lib/{record-freshness.js → cache/record-freshness.js} +1 -1
- package/lib/{cache-repository.js → cache/repository.js} +1 -1
- package/lib/{resource-cache → cache/resource}/engine.js +23 -16
- package/lib/{resource-cache → cache/resource}/fs-store.js +2 -2
- package/lib/{resource-cache → cache/resource}/sqlite-store.js +3 -3
- package/lib/{resource-cache → cache/resource}/validate.js +20 -5
- package/lib/{sqlite-driver.js → cache/sqlite-driver.js} +7 -5
- package/lib/certs/scan.js +17 -11
- package/lib/cli-collect.js +262 -0
- package/lib/cli-command-routing.js +30 -13
- package/lib/cli-groups.js +1 -1
- package/lib/cli-image.js +158 -47
- package/lib/cli-project-commands.js +10 -10
- package/lib/cli-setup.js +8 -8
- package/lib/cli-watch.js +3 -3
- package/lib/codecs/binary/elf-metadata.js +6 -0
- package/lib/codecs/binary/metadata.js +1 -1
- package/lib/codecs/binary/pe-metadata.js +47 -11
- package/lib/codecs/binary/scan.js +12 -4
- package/lib/codecs/binary.codec.js +1 -1
- package/lib/codecs/composer/platform.js +2 -2
- package/lib/codecs/composer/registry.js +12 -18
- package/lib/codecs/composer.codec.js +6 -5
- package/lib/codecs/go/parse.js +1 -1
- package/lib/codecs/go/registry.js +7 -7
- package/lib/codecs/go.codec.js +2 -2
- package/lib/codecs/gradle/parse.js +1 -1
- package/lib/codecs/gradle/versionless.js +2 -2
- package/lib/codecs/gradle.codec.js +7 -7
- package/lib/codecs/index.js +1 -1
- package/lib/{maven-airgap.js → codecs/maven/airgap.js} +4 -4
- package/lib/{maven-bom.js → codecs/maven/bom.js} +3 -3
- package/lib/codecs/maven/jar-scan.js +4 -4
- package/lib/{maven-license.js → codecs/maven/license.js} +2 -2
- package/lib/{core.js → codecs/maven/pom.js} +22 -11
- package/lib/{maven-reactor.js → codecs/maven/reactor.js} +18 -12
- package/lib/{transitive.js → codecs/maven/transitive.js} +79 -34
- package/lib/{maven-version.js → codecs/maven/version.js} +1 -1
- package/lib/codecs/maven.codec.js +18 -14
- package/lib/codecs/npm/collect.js +55 -8
- package/lib/codecs/npm/manifest-kind.js +16 -0
- package/lib/codecs/npm/parse.js +23 -7
- package/lib/codecs/npm/registry.js +28 -14
- package/lib/codecs/npm.codec.js +5 -5
- package/lib/codecs/nuget/registry.js +7 -7
- package/lib/codecs/nuget.codec.js +4 -4
- package/lib/codecs/pypi/registry.js +7 -7
- package/lib/codecs/pypi.codec.js +4 -4
- package/lib/codecs/recipes.js +2 -2
- package/lib/codecs/ruby/registry.js +7 -7
- package/lib/codecs/ruby.codec.js +2 -2
- package/lib/config.js +1 -1
- package/lib/{attribution.js → findings/attribution.js} +3 -3
- package/lib/findings/cve-descriptions.js +144 -0
- package/lib/{cve-record-coverage.js → findings/cve-record-coverage.js} +46 -41
- package/lib/{diff.js → findings/diff.js} +0 -0
- package/lib/{finding-enrichment.js → findings/enrichment.js} +45 -32
- package/lib/{eu-refs.js → findings/eu-refs.js} +3 -3
- package/lib/{gate.js → findings/gate.js} +1 -1
- package/lib/{malware.js → findings/malware.js} +30 -7
- package/lib/{merge-sources.js → findings/merge.js} +57 -9
- package/lib/{priority.js → findings/priority.js} +3 -3
- package/lib/findings/risk-evidence.js +24 -0
- package/lib/findings/severity.js +16 -0
- package/lib/{finding-summary.js → findings/summary.js} +5 -2
- package/lib/{suppress.js → findings/suppress.js} +2 -2
- package/lib/images/local-docker.js +72 -0
- package/lib/{image-network.js → images/network.js} +26 -16
- package/lib/{image-references.js → images/references.js} +29 -11
- package/lib/{image-registry.js → images/registry.js} +18 -9
- package/lib/{source-image-scan.js → images/source-scan.js} +3 -3
- package/lib/images/temp-roots.js +23 -0
- package/lib/{image-update.js → images/update.js} +3 -3
- package/lib/{dep-record.js → inventory/dep-record.js} +2 -2
- package/lib/{deps-descriptor.js → inventory/deps-descriptor.js} +3 -3
- package/lib/{descriptor-refs.js → inventory/descriptor-refs.js} +1 -1
- package/lib/{embedded.js → inventory/embedded.js} +4 -3
- package/lib/{license-policy.js → inventory/license-policy.js} +2 -2
- package/lib/{manifest-copy.js → inventory/manifest-copy.js} +2 -2
- package/lib/{module-names.js → inventory/module-names.js} +1 -1
- package/lib/{package-versions.js → inventory/package-versions.js} +2 -2
- package/lib/{parallel-walk.js → inventory/parallel-walk.js} +1 -1
- package/lib/{path-filter.js → inventory/path-filter.js} +1 -1
- package/lib/{private-deps.js → inventory/private-deps.js} +1 -1
- package/lib/{project-descriptor.js → inventory/project-descriptor.js} +3 -0
- package/lib/{purl.js → inventory/purl.js} +2 -2
- package/lib/{unmanaged.js → inventory/unmanaged.js} +6 -3
- package/lib/{commercial-support.js → maintenance/commercial-support.js} +5 -5
- package/lib/{outdated.js → maintenance/outdated.js} +20 -20
- package/lib/options-env.js +1 -1
- package/lib/{system-inventory/alpine-tracker.js → providers/alpine/tracker.js} +27 -7
- package/lib/{certfr.js → providers/certfr/enrich.js} +9 -9
- package/lib/{cve-download.js → providers/cveproject/download.js} +56 -36
- package/lib/{cve-legacy-ranges.js → providers/cveproject/legacy-ranges.js} +1 -1
- package/lib/{cve-npm-proxy.js → providers/cveproject/npm-proxy.js} +5 -5
- package/lib/{cve-packages-proxy.js → providers/cveproject/packages-proxy.js} +6 -6
- package/lib/{cve-version-verdict.js → providers/cveproject/version-verdict.js} +2 -2
- package/lib/{system-inventory/current-debian.js → providers/debian/current.js} +6 -6
- package/lib/{system-inventory/historical-debian.js → providers/debian/historical.js} +6 -6
- package/lib/providers/{debian.js → debian/index.js} +1 -0
- package/lib/{application-providers/drupal-advisories.js → providers/drupal/advisories.js} +13 -36
- package/lib/providers/{drupal.js → drupal/index.js} +4 -0
- package/lib/providers/{eol.js → eol/index.js} +1 -1
- package/lib/{epss.js → providers/epss/enrich.js} +16 -13
- package/lib/providers/{epss.js → epss/index.js} +2 -2
- package/lib/{euvd.js → providers/euvd/enrich.js} +13 -13
- package/lib/{system-inventory/freexian-ela.js → providers/freexian/ela.js} +6 -6
- package/lib/providers/{freexian.js → freexian/index.js} +3 -3
- package/lib/{system-inventory/freexian-release-evidence.js → providers/freexian/release-evidence.js} +8 -5
- package/lib/{system-inventory/freexian-tracker.js → providers/freexian/tracker.js} +33 -9
- package/lib/{gcve-feed.js → providers/gcve/feed.js} +4 -4
- package/lib/{gcve.js → providers/gcve/id.js} +1 -1
- package/lib/{gcve-index.js → providers/gcve/local-index.js} +4 -4
- package/lib/{application-providers/github-advisories.js → providers/github/advisories.js} +6 -2
- package/lib/providers/{github.js → github/index.js} +3 -1
- package/lib/{github-publisher-maven.js → providers/github/publisher-maven.js} +1 -1
- package/lib/providers/{go.js → go/index.js} +1 -1
- package/lib/{hash-id.js → providers/hashid/identify.js} +7 -7
- package/lib/providers/{hashid.js → hashid/index.js} +1 -1
- package/lib/providers/index.js +18 -13
- package/lib/{kev.js → providers/kev/enrich.js} +12 -9
- package/lib/{maven-cache.js → providers/maven/cache.js} +3 -3
- package/lib/providers/{maven.js → maven/index.js} +5 -3
- package/lib/{maven-presence.js → providers/maven/presence.js} +5 -5
- package/lib/{maven-repo.js → providers/maven/repo.js} +38 -21
- package/lib/providers/mit-kerberos/index.js +6 -0
- package/lib/{system-inventory/nginx-advisories.js → providers/nginx/advisories.js} +3 -3
- package/lib/providers/{npm.js → npm/index.js} +1 -1
- package/lib/providers/{nuget.js → nuget/index.js} +1 -1
- package/lib/{cpe.js → providers/nvd/cpe.js} +35 -47
- package/lib/{nvd.js → providers/nvd/enrich.js} +41 -40
- package/lib/providers/{nvd.js → nvd/index.js} +18 -4
- package/lib/{nvd-package-ranges.js → providers/nvd/package-ranges.js} +38 -22
- package/lib/{osv-db.js → providers/osv/db.js} +18 -16
- package/lib/providers/{osv.js → osv/index.js} +1 -1
- package/lib/{osv.js → providers/osv/query.js} +150 -80
- package/lib/providers/package-releases/index.js +26 -0
- package/lib/{packagist-audit.js → providers/packagist/audit.js} +31 -11
- package/lib/providers/{packagist.js → packagist/index.js} +1 -1
- package/lib/{proxy-throttle.js → providers/proxy-throttle.js} +17 -9
- package/lib/providers/{pypi.js → pypi/index.js} +1 -1
- package/lib/providers/redhat/bzip2.js +167 -0
- package/lib/providers/redhat/errata.js +75 -0
- package/lib/providers/redhat/index.js +10 -0
- package/lib/providers/redhat/oval.js +70 -0
- package/lib/providers/redhat/unfixed.js +127 -0
- package/lib/{registries.js → providers/registries.js} +4 -4
- package/lib/{retire.js → providers/retire/scan.js} +18 -18
- package/lib/providers/{ruby.js → ruby/index.js} +1 -1
- package/lib/providers/rubysec/advisories.js +177 -0
- package/lib/providers/rubysec/index.js +9 -0
- package/lib/{snyk.js → providers/snyk/client.js} +2 -2
- package/lib/{application-providers/spip-advisories.js → providers/spip/advisories.js} +5 -13
- package/lib/{vigievuln-advisories.js → providers/vigievuln/advisories.js} +4 -4
- package/lib/providers/wolfi/index.js +10 -0
- package/lib/providers/wolfi/secdb.js +47 -0
- package/lib/{application-providers/wordfence-client.js → providers/wordfence/client.js} +4 -4
- package/lib/providers/{wordfence.js → wordfence/index.js} +1 -1
- package/lib/{application-providers/wordfence-projection.js → providers/wordfence/projection.js} +14 -5
- package/lib/{resource-cache/wordfence.js → providers/wordfence/resource-cache.js} +2 -2
- package/lib/{application-providers/wordfence-v3.js → providers/wordfence/v3.js} +4 -5
- package/lib/providers/{wordpress.js → wordpress/index.js} +5 -0
- package/lib/providers/wpvulnerability/assess.js +181 -0
- package/lib/providers/wpvulnerability/index.js +12 -0
- package/lib/{charts.js → reports/charts.js} +25 -18
- package/lib/{csaf-export.js → reports/csaf-export.js} +16 -11
- package/lib/{cve-report.js → reports/cve-report.js} +453 -228
- package/lib/reports/detail.js +55 -0
- package/lib/{i18n.js → reports/i18n.js} +38 -2
- package/lib/{report-integrity.js → reports/integrity.js} +1 -1
- package/lib/{json-export.js → reports/json-export.js} +95 -24
- package/lib/{report-notices.js → reports/notices.js} +11 -6
- package/lib/{sarif-export.js → reports/sarif-export.js} +15 -10
- package/lib/{sbom-export.js → reports/sbom-export.js} +16 -11
- package/lib/{scan-completeness.js → scan/completeness.js} +1 -1
- package/lib/scan/coverage.js +114 -0
- package/lib/{provenance.js → scan/provenance.js} +12 -5
- package/lib/scan/reliability.js +157 -0
- package/lib/{source-health.js → scan/source-health.js} +52 -20
- package/lib/{source-profile.js → scan/source-profile.js} +3 -3
- package/lib/{hosted-proxy.js → service/hosted-proxy.js} +3 -3
- package/lib/{project-client.js → service/project-client.js} +20 -2
- package/lib/source-input.js +58 -0
- package/lib/system-inventory/advisories.js +89 -16
- package/lib/system-inventory/collect.js +33 -10
- package/lib/system-inventory/distribution-sources.js +32 -15
- package/lib/system-inventory/package-applicability.js +51 -0
- package/lib/system-inventory/targeted.js +8 -5
- package/lib/ui.js +11 -0
- package/package.json +49 -2
- package/vigievuln.js +483 -352
- package/lib/cache-archive.js +0 -676
- package/lib/osv-legacy.js +0 -57
- package/lib/risk-evidence.js +0 -18
- package/lib/scan-coverage.js +0 -61
- /package/lib/{application-plugins → applications/plugins}/joomla.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/laravel.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/magento.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/plugin.interface.js +0 -0
- /package/lib/{application-plugins → applications/plugins}/select.js +0 -0
- /package/lib/{advisory-compression.js → cache/advisory-compression.js} +0 -0
- /package/lib/{compression-dictionary.js → cache/compression-dictionary.js} +0 -0
- /package/lib/{cache-directory.js → cache/directory.js} +0 -0
- /package/lib/{cache-policy.js → cache/policy.js} +0 -0
- /package/lib/{resource-cache → cache/resource}/snapshot-projection.js +0 -0
- /package/lib/{cache-startup.js → cache/startup.js} +0 -0
- /package/lib/{ruby-version.js → codecs/ruby/version.js} +0 -0
- /package/lib/{applicability-evidence.js → findings/applicability-evidence.js} +0 -0
- /package/lib/{line-stream.js → inventory/line-stream.js} +0 -0
- /package/lib/{package-metadata.js → inventory/package-metadata.js} +0 -0
- /package/lib/providers/{alpine.js → alpine/index.js} +0 -0
- /package/lib/providers/{certfr.js → certfr/index.js} +0 -0
- /package/lib/{native-cna-identities.js → providers/cveproject/cna-identities.js} +0 -0
- /package/lib/providers/{euvd.js → euvd/index.js} +0 -0
- /package/lib/providers/{gcve.js → gcve/index.js} +0 -0
- /package/lib/providers/{kev.js → kev/index.js} +0 -0
- /package/lib/providers/{nginx.js → nginx/index.js} +0 -0
- /package/lib/{nvd-bulk.js → providers/nvd/bulk.js} +0 -0
- /package/lib/providers/{osvdb.js → osvdb/index.js} +0 -0
- /package/lib/{request-failure.js → providers/request-failure.js} +0 -0
- /package/lib/providers/{retire.js → retire/index.js} +0 -0
- /package/lib/providers/{vigievuln.js → vigievuln/index.js} +0 -0
- /package/lib/{application-providers/wp-checksums.js → providers/wordpress/checksums.js} +0 -0
- /package/lib/{report-time.js → reports/time.js} +0 -0
- /package/lib/{xlsx-export.js → reports/xlsx-export.js} +0 -0
- /package/lib/{diagnostics.js → scan/diagnostics.js} +0 -0
- /package/lib/{account-client.js → service/account-client.js} +0 -0
- /package/lib/{account-session.js → service/account-session.js} +0 -0
- /package/lib/{account-terms.js → service/account-terms.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/transitive.js — resolve transitive dependencies for a set of direct deps
|
|
2
|
+
* lib/codecs/maven/transitive.js — resolve transitive dependencies for a set of direct deps
|
|
3
3
|
* by walking POMs fetched from Maven Central.
|
|
4
4
|
*
|
|
5
5
|
* Implements a pragmatic subset of Maven's resolution rules:
|
|
@@ -26,9 +26,9 @@ const fs = require("fs");
|
|
|
26
26
|
const path = require("path");
|
|
27
27
|
const os = require("os");
|
|
28
28
|
const { parseStringPromise } = require("xml2js");
|
|
29
|
-
const { normalizeHardPin, isVersionRange, resolveVersionRange, compareMavenVersions } = require("./
|
|
29
|
+
const { normalizeHardPin, isVersionRange, resolveVersionRange, compareMavenVersions } = require("./version");
|
|
30
30
|
|
|
31
|
-
const POM_CACHE_DIR = path.join(require("
|
|
31
|
+
const POM_CACHE_DIR = path.join(require("../../cache/directory").getCacheDir(), "poms-cache");
|
|
32
32
|
const MAVEN_CENTRAL = "https://repo1.maven.org/maven2";
|
|
33
33
|
|
|
34
34
|
// Maven's scope-propagation matrix (rows: direct dep scope, cols: transitive scope)
|
|
@@ -57,69 +57,94 @@ function pomPath(g, a, v) {
|
|
|
57
57
|
|
|
58
58
|
function cachePath(g, a, v, dir = POM_CACHE_DIR) {
|
|
59
59
|
// One path segment, always: a coordinate comes from a scanned repository and must not be
|
|
60
|
-
// able to walk out of the cache dir (see lib/osv.js#cacheKey, where a URL-as-version did
|
|
60
|
+
// able to walk out of the cache dir (see lib/providers/osv/query.js#cacheKey, where a URL-as-version did
|
|
61
61
|
// exactly that). The allowed set covers every well-formed Maven coord, so warm caches
|
|
62
62
|
// written before this are still found.
|
|
63
63
|
const seg = x => String(x == null ? "" : x).replace(/[^A-Za-z0-9._+-]/g, "%");
|
|
64
64
|
return path.join(dir, `${seg(g)}__${seg(a)}__${seg(v)}.pom`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
const absentPomMemo = new WeakMap();
|
|
68
|
+
function reportAbsentPom(g,a,v,opts) {
|
|
69
|
+
const evidence={groupId:g,artifactId:a,version:v};
|
|
70
|
+
if(opts.effCache){
|
|
71
|
+
if(!absentPomMemo.has(opts.effCache))absentPomMemo.set(opts.effCache,new Map());
|
|
72
|
+
const scope=require('../../providers/maven/presence').repositoryKey(Array.isArray(opts.repos)?opts.repos:[require('../../providers/maven/repo').MAVEN_CENTRAL]);
|
|
73
|
+
absentPomMemo.get(opts.effCache).set(`${g}:${a}:${v}`,{evidence,scope});
|
|
74
|
+
}
|
|
75
|
+
opts.onAbsentPom?.(evidence);
|
|
76
|
+
}
|
|
77
|
+
|
|
67
78
|
async function fetchPom(g, a, v, opts = {}) {
|
|
68
79
|
const { verbose, offline, fetcher = globalThis.fetch, cacheDir = POM_CACHE_DIR, repos } = opts;
|
|
69
80
|
const cf = cachePath(g, a, v, cacheDir);
|
|
81
|
+
const absenceScope=require('../../providers/maven/presence').repositoryKey(Array.isArray(repos)?repos:[require('../../providers/maven/repo').MAVEN_CENTRAL]);
|
|
70
82
|
let legacyNegative = false;
|
|
71
|
-
const cachedPom=require('
|
|
83
|
+
const cachedPom=require('../../providers/maven/cache').read(cf);
|
|
72
84
|
if (cachedPom) {
|
|
73
85
|
const xml = cachedPom.value;
|
|
74
|
-
if (offline || require('
|
|
86
|
+
if (offline || require('../../cache/policy').fresh(cachedPom.fetchedAt)) {
|
|
75
87
|
if (xml !== "__NOT_FOUND__") return xml;
|
|
76
88
|
legacyNegative = true;
|
|
77
89
|
}
|
|
78
90
|
}
|
|
79
91
|
// A public seed never overrides an existing locally configured repository.
|
|
80
|
-
const seeded = offline && (!Array.isArray(repos) || repos.every(r=>r.central === true))
|
|
81
|
-
? require('
|
|
92
|
+
const seeded = offline && (!Array.isArray(repos) || repos.every(r=>r.central === true || (r.fallback && r.url===require('../../providers/maven/repo').GOOGLE_MAVEN.url)))
|
|
93
|
+
? require('../../inventory/package-versions').getVersion('maven',`${g}:${a}`,String(v)) : null;
|
|
82
94
|
if (seeded) return seeded.body;
|
|
83
|
-
if (legacyNegative)
|
|
95
|
+
if (legacyNegative && offline) {
|
|
96
|
+
if(cachedPom.metadata?.absenceScope===absenceScope)reportAbsentPom(g,a,v,opts);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
84
99
|
if (offline) return null;
|
|
85
100
|
// Multi-repo path: try every user-configured repo, fall back to Maven
|
|
86
101
|
// Central via lib/maven-repo. Falling back to the legacy single-URL
|
|
87
102
|
// fetch only when no repos array is passed (keeps existing tests green).
|
|
88
103
|
if (Array.isArray(repos)) {
|
|
89
104
|
try {
|
|
90
|
-
const { fetchPomFromRepos } = require("
|
|
91
|
-
const
|
|
105
|
+
const { fetchPomFromRepos } = require("../../providers/maven/repo");
|
|
106
|
+
const misses=new Map();
|
|
107
|
+
const hit = await fetchPomFromRepos(repos, g, a, v, { fetcher, userAgent: "vigievuln-transitive",
|
|
108
|
+
onMiss:(repo,reason)=>misses.set(repo.url,/^HTTP (\d+)$/.exec(reason)?.[1]) });
|
|
92
109
|
if (hit?.body) {
|
|
93
|
-
require('
|
|
110
|
+
require('../../providers/maven/cache').write(cf,hit.body);
|
|
94
111
|
return hit.body;
|
|
95
112
|
}
|
|
96
|
-
require('
|
|
113
|
+
if(repos.length && repos.every(repo=>require('../../inventory/private-deps').isAbsentStatus(misses.get(repo.url)))) {
|
|
114
|
+
require('../../providers/maven/cache').write(cf,'__NOT_FOUND__',{absenceScope});
|
|
115
|
+
reportAbsentPom(g,a,v,opts);
|
|
116
|
+
}
|
|
117
|
+
// A mixed mirror result may be a transport outage; do not persist absence.
|
|
97
118
|
if (verbose) console.warn(` not found in any repo: ${g}:${a}:${v}`);
|
|
98
119
|
return null;
|
|
99
120
|
} catch (err) {
|
|
100
121
|
if (verbose) console.warn(` multi-repo fetch failed: ${g}:${a}:${v} — ${err.message}`);
|
|
122
|
+
opts.onMissingPom?.({groupId:g,artifactId:a,version:v});
|
|
101
123
|
return cachedPom?.value && cachedPom.value !== '__NOT_FOUND__' ? cachedPom.value : null;
|
|
102
124
|
}
|
|
103
125
|
}
|
|
104
126
|
const url = pomPath(g, a, v);
|
|
105
127
|
try {
|
|
106
|
-
const res = await require("
|
|
128
|
+
const res = await require("../../providers").getResource("maven", "artifact",
|
|
107
129
|
{ path: `${g.replace(/\./g, "/")}/${a}/${v}/${a}-${v}.pom` },
|
|
108
130
|
{ fetcher, headers: { "User-Agent": "vigievuln-transitive" } });
|
|
109
|
-
if (res.status === 404) {
|
|
110
|
-
require('
|
|
131
|
+
if (res.status === 404 || res.status === 410) {
|
|
132
|
+
require('../../providers/maven/cache').write(cf,"__NOT_FOUND__",{absenceScope});
|
|
133
|
+
reportAbsentPom(g,a,v,opts);
|
|
111
134
|
if (verbose) console.warn(` 404: ${g}:${a}:${v}`);
|
|
112
135
|
return null;
|
|
113
136
|
}
|
|
114
137
|
if (!res.ok) {
|
|
115
138
|
if (verbose) console.warn(` HTTP ${res.status}: ${g}:${a}:${v}`);
|
|
139
|
+
opts.onMissingPom?.({groupId:g,artifactId:a,version:v});
|
|
116
140
|
return cachedPom?.value && cachedPom.value !== '__NOT_FOUND__' ? cachedPom.value : null;
|
|
117
141
|
}
|
|
118
142
|
const xml = await res.text();
|
|
119
|
-
require('
|
|
143
|
+
require('../../providers/maven/cache').write(cf,xml);
|
|
120
144
|
return xml;
|
|
121
145
|
} catch (err) {
|
|
122
146
|
if (verbose) console.warn(` fetch failed: ${g}:${a}:${v} — ${err.message}`);
|
|
147
|
+
opts.onMissingPom?.({groupId:g,artifactId:a,version:v});
|
|
123
148
|
return cachedPom?.value && cachedPom.value !== '__NOT_FOUND__' ? cachedPom.value : null;
|
|
124
149
|
}
|
|
125
150
|
}
|
|
@@ -222,6 +247,11 @@ async function effectivePom(g, a, v, opts = {}, seen = new Set()) {
|
|
|
222
247
|
// so existing single-shot callers are byte-for-byte unchanged.
|
|
223
248
|
if (opts.effCache && opts.effCache.has(key)) {
|
|
224
249
|
const cached = opts.effCache.get(key);
|
|
250
|
+
if(!cached){
|
|
251
|
+
const absent=absentPomMemo.get(opts.effCache)?.get(`${g}:${a}:${v}`);
|
|
252
|
+
const scope=require('../../providers/maven/presence').repositoryKey(Array.isArray(opts.repos)?opts.repos:[require('../../providers/maven/repo').MAVEN_CENTRAL]);
|
|
253
|
+
if(absent?.scope===scope)opts.onAbsentPom?.(absent.evidence);
|
|
254
|
+
}
|
|
225
255
|
if (!cached) opts.onMissingPom?.({ groupId: g, artifactId: a, version: v });
|
|
226
256
|
return cached;
|
|
227
257
|
}
|
|
@@ -353,25 +383,25 @@ async function fetchMetadataVersions(g, a, opts = {}) {
|
|
|
353
383
|
const seg = x => String(x == null ? "" : x).replace(/[^A-Za-z0-9._+-]/g, "%");
|
|
354
384
|
// Maven Central's list and the configured repositories' list are cached apart: a vendor
|
|
355
385
|
// repository answering first lists builds Central does not have, and "absent from
|
|
356
|
-
// Central" is exactly what identifies a commercial build (lib/commercial-support.js).
|
|
386
|
+
// Central" is exactly what identifies a commercial build (lib/maintenance/commercial-support.js).
|
|
357
387
|
const cf = path.join(cacheDir, `${seg(g)}__${seg(a)}__maven-metadata${Array.isArray(repos) && repos.length ? "-repos" : ""}.xml`);
|
|
358
388
|
const parse = xml => [...String(xml).matchAll(/<version>([^<]+)<\/version>/g)].map(m => m[1].trim()).filter(Boolean);
|
|
359
|
-
const cached=require('
|
|
360
|
-
if(cached && (offline || (!require("
|
|
389
|
+
const cached=require('../../providers/maven/cache').read(cf);
|
|
390
|
+
if(cached && (offline || (!require("../../providers").hasHostedProxy() && require('../../cache/policy').fresh(cached.fetchedAt,METADATA_TTL_MS)))) return parse(cached.value);
|
|
361
391
|
if (offline) return [];
|
|
362
392
|
let body = null;
|
|
363
393
|
try {
|
|
364
394
|
if (Array.isArray(repos)) {
|
|
365
|
-
const hit = await require("
|
|
395
|
+
const hit = await require("../../providers/maven/repo").fetchMavenMetadata(repos, g, a, { fetcher });
|
|
366
396
|
body = hit?.body || null;
|
|
367
397
|
} else {
|
|
368
|
-
const res = await require("
|
|
398
|
+
const res = await require("../../providers").getResource("maven", "artifact",
|
|
369
399
|
{ path: `${g.replace(/\./g, "/")}/${a}/maven-metadata.xml` }, { fetcher, headers: { "User-Agent": "vigievuln-transitive" } });
|
|
370
400
|
if (res.ok) body = await res.text();
|
|
371
401
|
}
|
|
372
402
|
} catch { body = null; }
|
|
373
403
|
if (!body) return [];
|
|
374
|
-
require('
|
|
404
|
+
require('../../providers/maven/cache').write(cf,body);
|
|
375
405
|
return parse(body);
|
|
376
406
|
}
|
|
377
407
|
|
|
@@ -416,10 +446,10 @@ async function resolveTransitiveDeps(directDeps, opts = {}) {
|
|
|
416
446
|
concurrency = 8,
|
|
417
447
|
fetcher, // optional injected fetch (used by tests)
|
|
418
448
|
cacheDir, // optional override of disk cache dir (used by tests)
|
|
419
|
-
repos, // optional repo list (lib/maven
|
|
449
|
+
repos, // optional repo list (lib/providers/maven/repo). Falls back to repo1.maven.org alone.
|
|
420
450
|
effCache,
|
|
421
451
|
} = opts;
|
|
422
|
-
const fetchOpts = { verbose, offline, fetcher, cacheDir, repos, ...(effCache ? { effCache } : {}), ...(opts.onMissingPom ? { onMissingPom: opts.onMissingPom } : {}), ...(opts.onPomCycle ? { onPomCycle: opts.onPomCycle } : {}) };
|
|
452
|
+
const fetchOpts = { verbose, offline, fetcher, cacheDir, repos, ...(effCache ? { effCache } : {}), ...(opts.onMissingPom ? { onMissingPom: opts.onMissingPom } : {}), ...(opts.onAbsentPom ? {onAbsentPom:opts.onAbsentPom} : {}), ...(opts.onPomCycle ? { onPomCycle: opts.onPomCycle } : {}) };
|
|
423
453
|
|
|
424
454
|
// A managed entry is `{ version, exclusions? }` (global pass) or a bare version string
|
|
425
455
|
// (per-module management). Reading `.version` off a string gave
|
|
@@ -437,13 +467,26 @@ async function resolveTransitiveDeps(directDeps, opts = {}) {
|
|
|
437
467
|
};
|
|
438
468
|
|
|
439
469
|
const visited = new Set();
|
|
440
|
-
const variants = new Map(), reportedVariants = new Set();
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
470
|
+
const variants = new Map(), reportedVariants = new Set(), keptVersions = new Map();
|
|
471
|
+
// `version` is the one this occurrence would resolve to. A type or classifier
|
|
472
|
+
// variant shares the POM and the advisory identity of its groupId:artifactId, so
|
|
473
|
+
// coverage is only at risk when it resolves to another version than the one kept.
|
|
474
|
+
const noteVariant = (dep, version) => {
|
|
475
|
+
const key = `${dep.groupId}:${dep.artifactId}`;
|
|
476
|
+
// Gradle's unclassified Android components occur as both implicit jar
|
|
477
|
+
// and explicit aar dependencies in Maven POM metadata. They use the same
|
|
478
|
+
// module/POM identity in this graph; that packaging difference is not an
|
|
479
|
+
// unresolved classifier collision. Maven and explicit classifiers keep
|
|
480
|
+
// their stricter distinction.
|
|
481
|
+
const variant = opts.gradleComponents && !dep.classifier && ['jar','aar'].includes(dep.type || 'jar')
|
|
482
|
+
? key : managedKey(dep);
|
|
483
|
+
const old = variants.get(key);
|
|
484
|
+
if (!old) { variants.set(key, variant); return; }
|
|
485
|
+
if (old === variant || reportedVariants.has(key)) return;
|
|
486
|
+
const kept = keptVersions.get(key) || null, candidate = version && !isVersionRange(version) && !/\$\{/.test(version) ? version : null;
|
|
487
|
+
if (kept && candidate && kept === candidate) return;
|
|
488
|
+
reportedVariants.add(key);
|
|
489
|
+
opts.onVariantCollision?.({groupId:dep.groupId,artifactId:dep.artifactId,versions:[kept,candidate]});
|
|
447
490
|
};
|
|
448
491
|
const out = new Map();
|
|
449
492
|
let level = [];
|
|
@@ -451,7 +494,8 @@ async function resolveTransitiveDeps(directDeps, opts = {}) {
|
|
|
451
494
|
if (!dep.groupId || !dep.artifactId || !dep.version) continue;
|
|
452
495
|
const v = await concrete(dep.groupId, dep.artifactId, dep.version);
|
|
453
496
|
if (!v) continue;
|
|
454
|
-
noteVariant(dep);
|
|
497
|
+
noteVariant(dep, v);
|
|
498
|
+
if (!keptVersions.has(`${dep.groupId}:${dep.artifactId}`)) keptVersions.set(`${dep.groupId}:${dep.artifactId}`, v);
|
|
455
499
|
opts.onGraphRequest?.({ key: `${dep.groupId}:${dep.artifactId}`, version: v });
|
|
456
500
|
level.push({
|
|
457
501
|
groupId: dep.groupId, artifactId: dep.artifactId, version: v,
|
|
@@ -500,7 +544,7 @@ async function resolveTransitiveDeps(directDeps, opts = {}) {
|
|
|
500
544
|
|
|
501
545
|
const propagated = SCOPE_MATRIX[node.scope]?.[depScope];
|
|
502
546
|
if (!propagated || !includedScopes.includes(propagated)) continue;
|
|
503
|
-
noteVariant(dep);
|
|
547
|
+
noteVariant(dep, managed(managedKey(dep))?.version || dep.version || own?.version || null);
|
|
504
548
|
|
|
505
549
|
const via = [...node.via, nodeKey];
|
|
506
550
|
opts.onGraphRequest?.({ key: childKey, version: dep.version || own?.version || null });
|
|
@@ -532,6 +576,7 @@ async function resolveTransitiveDeps(directDeps, opts = {}) {
|
|
|
532
576
|
if (!resolvedVersion) continue;
|
|
533
577
|
|
|
534
578
|
visited.add(childKey);
|
|
579
|
+
keptVersions.set(childKey, resolvedVersion);
|
|
535
580
|
out.set(childKey, {
|
|
536
581
|
groupId: dep.groupId,
|
|
537
582
|
artifactId: dep.artifactId,
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
* lib/codecs/maven.codec.js — codec Maven.
|
|
3
3
|
*
|
|
4
4
|
* N'INTRODUIT AUCUNE LOGIQUE NOUVELLE : enveloppe la résolution POM/BOM de
|
|
5
|
-
* lib/
|
|
6
|
-
* scope=import), le collecteur lib/cve-match.js, le walker transitif
|
|
7
|
-
* lib/transitive.js et le scanner natif CVE-index (cvelistV5).
|
|
5
|
+
* lib/codecs/maven/pom.js (parse, parent, merge multi-profils, dependencyManagement, imports
|
|
6
|
+
* scope=import), le collecteur lib/advisories/cve-match.js, le walker transitif
|
|
7
|
+
* lib/codecs/maven/transitive.js et le scanner natif CVE-index (cvelistV5).
|
|
8
8
|
*
|
|
9
9
|
* @author: N.BRAUN
|
|
10
10
|
* @email: pp9ping@gmail.com
|
|
11
11
|
*/
|
|
12
|
-
const core = require("
|
|
13
|
-
const { collectResolvedDeps, expandWithTransitives, matchDepsAgainstCves } = require("../cve-match");
|
|
14
|
-
const { coordKeyFor } = require("../dep-record");
|
|
12
|
+
const core = require("./maven/pom");
|
|
13
|
+
const { collectResolvedDeps, expandWithTransitives, matchDepsAgainstCves } = require("../advisories/cve-match");
|
|
14
|
+
const { coordKeyFor } = require("../inventory/dep-record");
|
|
15
15
|
|
|
16
16
|
// Scanner natif : CVE-index local cvelistV5. scan(deps,opts) → {matches, meta}.
|
|
17
17
|
const cveIndexScanner = {
|
|
18
18
|
id: "cve-index",
|
|
19
19
|
kind: "cve", // résultats → chapitre CVE (mergés avec OSV)
|
|
20
20
|
async scan(deps, opts = {}) {
|
|
21
|
-
const { ensureCveIndex, loadCveIndex, newIndex, addToIndex, isCurrentCveIndex } = require("../
|
|
22
|
-
const store = require("../
|
|
21
|
+
const { ensureCveIndex, loadCveIndex, newIndex, addToIndex, isCurrentCveIndex } = require("../providers/cveproject/download");
|
|
22
|
+
const store = require("../advisories/store").openAdvisoryStore();
|
|
23
23
|
try {
|
|
24
|
-
const { matchCveStore } = require("../native
|
|
24
|
+
const { matchCveStore } = require("../advisories/native");
|
|
25
25
|
const hasStored = () => !!(store.getSourceCoverage('cveproject','*') || store.getSourceCoverage('cveproject-legacy','*'));
|
|
26
26
|
const fallback = err => {
|
|
27
27
|
const idx = loadCveIndex();
|
|
@@ -57,7 +57,7 @@ const cveIndexScanner = {
|
|
|
57
57
|
}
|
|
58
58
|
const fetchedAt = timestampsKnown && Number.isFinite(oldestFetchedAt) ? oldestFetchedAt : null;
|
|
59
59
|
const provenance = {transport:'proxy'};
|
|
60
|
-
const {projectedCveEnvelope} = require('../native
|
|
60
|
+
const {projectedCveEnvelope} = require('../advisories/native');
|
|
61
61
|
if (fetchedAt) {
|
|
62
62
|
for (let i=0;i<collected.length;i+=100) store.commit({records:collected.slice(i,i+100).map(cve=>projectedCveEnvelope(cve,fetchedAt,provenance))});
|
|
63
63
|
store.commit({coverages:[{source:'cveproject-legacy',ecosystem:'*',fetchedAt,complete:false,provenance}]});
|
|
@@ -68,7 +68,7 @@ const cveIndexScanner = {
|
|
|
68
68
|
let identityUncertain = false;
|
|
69
69
|
const uncertainCandidates=[];
|
|
70
70
|
let matches = matchDepsAgainstCves(deps,idx,{onUncertain:candidate=>{identityUncertain=true;uncertainCandidates.push(candidate);}}), conflict = false;
|
|
71
|
-
const {isWithdrawn} = require('../
|
|
71
|
+
const {isWithdrawn} = require('../advisories/store');
|
|
72
72
|
matches = matches.filter(m => {
|
|
73
73
|
const native = store.getRecord('cveproject',m.cve.id);
|
|
74
74
|
if (native && isWithdrawn(native)) {conflict=true; return false;}
|
|
@@ -124,7 +124,7 @@ module.exports = {
|
|
|
124
124
|
// Expose _maven (store/propsByPom/pomFiles) pour que l'orchestrateur garde la
|
|
125
125
|
// phase de réécriture des POM nettoyés (lib/core.rewritePoms).
|
|
126
126
|
async collect(dir, opts = {}) {
|
|
127
|
-
const { makeDirFilter } = require("../path-filter");
|
|
127
|
+
const { makeDirFilter } = require("../inventory/path-filter");
|
|
128
128
|
const skipDir = makeDirFilter({ srcRoot: opts.srcRoot || dir, defaultSkip: core.SKIP_DIRS, excludePath: opts.excludePath, useDefaults: opts.defaultExcludes !== false });
|
|
129
129
|
const pomFiles = await core.findPomFilesAsync(dir, skipDir);
|
|
130
130
|
const store = core.newMetadataStore();
|
|
@@ -140,6 +140,10 @@ module.exports = {
|
|
|
140
140
|
catch (error) { warnings.push({ type: "dependency-coverage", reason: "pom-inheritance-error", ecosystem: "maven", manifestPath: pom,
|
|
141
141
|
message: `pom.xml inheritance failed (${pom}): ${error.message}; dependency inventory is incomplete.` }); }
|
|
142
142
|
}
|
|
143
|
+
for (const meta of Object.values(store.byPath)) if (meta.ambiguousParent) {
|
|
144
|
+
warnings.push({ type: "dependency-coverage", reason: "ambiguous-parent", ecosystem: "maven", manifestPath: meta.pomPath,
|
|
145
|
+
message: `Multiple local POMs match parent ${meta.ambiguousParent} of ${meta.pomPath}. Inherited dependency coverage is incomplete.` });
|
|
146
|
+
}
|
|
143
147
|
const deps = collectResolvedDeps(store, propsByPom, { ignoreTest: opts.ignoreTest, deps2Exclude: opts.deps2Exclude });
|
|
144
148
|
// Embedded binaries: discover Maven coordinates inside committed .jar/.war/.ear
|
|
145
149
|
// archives (vendored libs, fat-jars). Keyed by physical location so they don't
|
|
@@ -162,12 +166,12 @@ module.exports = {
|
|
|
162
166
|
osvPackageName(d) { return `${d.namespace || d.groupId}:${d.name || d.artifactId}`; },
|
|
163
167
|
|
|
164
168
|
async checkRegistry(deps, opts = {}) {
|
|
165
|
-
const outdated = require("../outdated");
|
|
169
|
+
const outdated = require("../maintenance/outdated");
|
|
166
170
|
const out = opts.allLibs ? await outdated.checkOutdatedDeps(deps, opts) : [];
|
|
167
171
|
const deprecated = outdated.checkObsoleteDeps(deps);
|
|
168
172
|
return { outdated: out, deprecated };
|
|
169
173
|
},
|
|
170
|
-
resolveEolProduct(d) { return require("../outdated").findEolProduct(d); },
|
|
174
|
+
resolveEolProduct(d) { return require("../maintenance/outdated").findEolProduct(d); },
|
|
171
175
|
|
|
172
176
|
recipe: require("./recipes").maven,
|
|
173
177
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
const path = require("path");
|
|
22
22
|
const fs = require("fs");
|
|
23
23
|
const { parsePackageJson, parsePackageLock, parseYarnLockV1, parsePnpmLock, findJsManifests } = require("./parse");
|
|
24
|
-
const { makeDepRecord } = require("../../dep-record");
|
|
24
|
+
const { makeDepRecord } = require("../../inventory/dep-record");
|
|
25
25
|
const { normaliseNpmVersion } = require("./parse");
|
|
26
26
|
|
|
27
27
|
const SCOPE_RANK = { prod: 4, peer: 3, optional: 2, dev: 1, transitive: 0 };
|
|
@@ -34,7 +34,7 @@ function semverCompare(a, b) {
|
|
|
34
34
|
// Non-semver inputs are incomparable, never guessed as a newer release.
|
|
35
35
|
const left = String(a ?? ""), right = String(b ?? "");
|
|
36
36
|
if (left.length > 256 || right.length > 256) return null;
|
|
37
|
-
return require("../../osv
|
|
37
|
+
return require("../../providers/osv/db").compareSemver(left, right);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function isResolvedVersion(v) {
|
|
@@ -168,7 +168,7 @@ function upsert(out, dep, manifestPath, lockType, relations) {
|
|
|
168
168
|
record.via = dep.via.slice();
|
|
169
169
|
record.viaPaths = [dep.via.slice()];
|
|
170
170
|
}
|
|
171
|
-
// Per-version provenance for lib/attribution.js: the record is coord-wide (one per
|
|
171
|
+
// Per-version provenance for lib/findings/attribution.js: the record is coord-wide (one per
|
|
172
172
|
// name across every lockfile), but a match carries ONE version, and two versions of
|
|
173
173
|
// one name are routinely classified differently (ms@2.1.3 under a prod dep,
|
|
174
174
|
// ms@1.0.0 only under jest). "dev" marks a dev-only occurrence; attribution reads a
|
|
@@ -273,6 +273,35 @@ function upsert(out, dep, manifestPath, lockType, relations) {
|
|
|
273
273
|
* deps2Exclude — RegExp tested against the npm name (covers private @scope/* packages)
|
|
274
274
|
* verbose
|
|
275
275
|
*/
|
|
276
|
+
/**
|
|
277
|
+
* Directories whose lone package.json is a workspace member covered by a
|
|
278
|
+
* lockfile in an ancestor directory: pnpm `importers`, npm v2+ member keys in
|
|
279
|
+
* `packages`, or the `workspaces` globs of a Yarn root (yarn.lock records no
|
|
280
|
+
* member paths). Their dependencies are already resolved by that lockfile.
|
|
281
|
+
*/
|
|
282
|
+
function workspaceMemberDirs(groups, parseOnce) {
|
|
283
|
+
const covered = new Set();
|
|
284
|
+
const dirOf = g => path.dirname(g.packageJson || g.packageLock || g.yarnLock || g.pnpmLock);
|
|
285
|
+
const lone = groups.filter(g => g.packageJson && !g.packageLock && !g.yarnLock && !g.pnpmLock).map(dirOf);
|
|
286
|
+
if (!lone.length) return covered;
|
|
287
|
+
const { minimatch } = require("minimatch");
|
|
288
|
+
for (const g of groups) {
|
|
289
|
+
if (!g.packageLock && !g.yarnLock && !g.pnpmLock) continue;
|
|
290
|
+
const root = dirOf(g), explicit = new Set(), globs = [];
|
|
291
|
+
for (const p of (g.pnpmLock && parseOnce(parsePnpmLock, g.pnpmLock)?.importers) || []) explicit.add(path.resolve(root, p));
|
|
292
|
+
for (const p of (g.packageLock && parseOnce(parsePackageLock, g.packageLock)?.workspaceMembers) || []) explicit.add(path.resolve(root, p));
|
|
293
|
+
if (g.yarnLock && g.packageJson) globs.push(...(parseOnce(parsePackageJson, g.packageJson)?.workspaces || []).filter(x => typeof x === "string"));
|
|
294
|
+
const include = globs.filter(x => !x.startsWith("!")).map(x => x.replace(/\/+$/, ""));
|
|
295
|
+
const exclude = globs.filter(x => x.startsWith("!")).map(x => x.slice(1).replace(/\/+$/, ""));
|
|
296
|
+
for (const dir of lone) {
|
|
297
|
+
if (!dir.startsWith(root + path.sep)) continue;
|
|
298
|
+
const rel = path.relative(root, dir).split(path.sep).join("/");
|
|
299
|
+
if (explicit.has(dir) || (include.some(x => minimatch(rel, x)) && !exclude.some(x => minimatch(rel, x)))) covered.add(dir);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return covered;
|
|
303
|
+
}
|
|
304
|
+
|
|
276
305
|
function collectNpmDeps(rootDir, opts = {}) {
|
|
277
306
|
const { ignoreTest, deps2Exclude, verbose } = opts;
|
|
278
307
|
const out = new Map();
|
|
@@ -282,14 +311,31 @@ function collectNpmDeps(rootDir, opts = {}) {
|
|
|
282
311
|
const manifestGroups = opts.manifestGroups || findJsManifests(rootDir);
|
|
283
312
|
let parsedCount = 0;
|
|
284
313
|
const parsedManifests = [];
|
|
314
|
+
const parsedFiles = new Map();
|
|
315
|
+
const parseOnce = (fn, file) => {
|
|
316
|
+
if (!parsedFiles.has(file)) parsedFiles.set(file, safeParse(fn, file, verbose));
|
|
317
|
+
return parsedFiles.get(file);
|
|
318
|
+
};
|
|
319
|
+
const workspaceMembers = workspaceMemberDirs(manifestGroups, parseOnce);
|
|
285
320
|
|
|
286
321
|
for (const group of manifestGroups) {
|
|
322
|
+
const pj = group.packageJson ? parseOnce(parsePackageJson, group.packageJson) : null;
|
|
323
|
+
if (pj?.manifestType === 'clib') {
|
|
324
|
+
warnings.push({type:'foreign-manifest',severity:'info',affectsCompleteness:false,manifestPath:group.packageJson,
|
|
325
|
+
ecosystem:'clib',packageName:pj.packageName,
|
|
326
|
+
message:`clib/C manifest ${pj.packageName} is outside npm assessment; its C dependencies are not queried as npm packages.`,
|
|
327
|
+
items:Object.entries(pj.declaredDependencies).map(([id,version])=>({id,version}))});
|
|
328
|
+
if (group.packageLock || group.yarnLock || group.pnpmLock)
|
|
329
|
+
warnings.push({type:'parse-error',manifestPath:group.packageJson,message:'clib/C package.json conflicts with npm/yarn/pnpm lockfiles in the same directory.'});
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
287
332
|
for (const f of [group.packageJson, group.packageLock, group.yarnLock, group.pnpmLock]) if (f) parsedManifests.push(f);
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
const pn = group.pnpmLock ? safeParse(parsePnpmLock, group.pnpmLock, verbose) : null;
|
|
333
|
+
const pl = group.packageLock ? parseOnce(parsePackageLock, group.packageLock) : null;
|
|
334
|
+
const yl = group.yarnLock ? parseOnce(parseYarnLockV1, group.yarnLock) : null;
|
|
335
|
+
const pn = group.pnpmLock ? parseOnce(parsePnpmLock, group.pnpmLock) : null;
|
|
292
336
|
const hasLock = !!(pl || yl || pn);
|
|
337
|
+
// A workspace member has no lockfile of its own: the workspace root's covers it.
|
|
338
|
+
if (pj && !hasLock && workspaceMembers.has(path.dirname(group.packageJson))) continue;
|
|
293
339
|
|
|
294
340
|
// package.json without lockfile → best-effort fallback (changed contract):
|
|
295
341
|
// scan pinned exact versions ("1.2.3"), skip ranges ("^1.0.0"), and warn
|
|
@@ -306,7 +352,8 @@ function collectNpmDeps(rootDir, opts = {}) {
|
|
|
306
352
|
ranges++;
|
|
307
353
|
}
|
|
308
354
|
}
|
|
309
|
-
|
|
355
|
+
// A manifest declaring no dependency has nothing a lockfile would resolve.
|
|
356
|
+
if (pinned + ranges > 0) warnings.push({
|
|
310
357
|
type: "no-lockfile",
|
|
311
358
|
manifestPath: group.packageJson,
|
|
312
359
|
packageName: pj.packageName || null,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Legacy clib descriptors also use package.json. Their repo/src/development
|
|
4
|
+
// fields describe C sources and GitHub coordinates, not npm packages.
|
|
5
|
+
function isClibManifest(value) {
|
|
6
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) ||
|
|
7
|
+
typeof value.repo !== 'string' || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(value.repo) ||
|
|
8
|
+
!Array.isArray(value.src) || !value.src.length ||
|
|
9
|
+
!value.src.every(p=>typeof p==='string' && /\.(?:c|h|cc|cpp|hpp)$/i.test(p))) return false;
|
|
10
|
+
if (['main','exports','bin','scripts','types','typings','workspaces','devDependencies','peerDependencies','optionalDependencies','packageManager'].some(k=>Object.hasOwn(value,k)) || value.engines?.node) return false;
|
|
11
|
+
const declarations = [value.dependencies, value.development].filter(v=>v!==undefined);
|
|
12
|
+
return declarations.every(v=>v && typeof v==='object' && !Array.isArray(v) &&
|
|
13
|
+
Object.keys(v).every(name=>/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(name)));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports={isClibManifest};
|
package/lib/codecs/npm/parse.js
CHANGED
|
@@ -268,6 +268,10 @@ function parsePackageJson(filePath) {
|
|
|
268
268
|
let json;
|
|
269
269
|
try { json = JSON.parse(raw); }
|
|
270
270
|
catch (e) { throw new Error(`package.json parse failed (${filePath}): ${e.message}`); }
|
|
271
|
+
if (require('./manifest-kind').isClibManifest(json)) return {
|
|
272
|
+
manifestPath:filePath, manifestType:'clib', packageName:json.repo, packageVersion:json.version || null,
|
|
273
|
+
deps:[], declaredDependencies:{...json.dependencies,...json.development},
|
|
274
|
+
};
|
|
271
275
|
const deps = [];
|
|
272
276
|
const push = (obj, scope) => {
|
|
273
277
|
for (const [name, version] of Object.entries(obj || {})) {
|
|
@@ -313,6 +317,8 @@ function parsePackageLock(filePath) {
|
|
|
313
317
|
if (lockfileVersion >= 2 && json.packages) {
|
|
314
318
|
// v2/v3: flat `packages` map keyed by relative path.
|
|
315
319
|
// The empty-string key is the root project; node_modules/foo → installed dep.
|
|
320
|
+
// Any other key outside node_modules is a workspace member this lockfile covers.
|
|
321
|
+
out.workspaceMembers = Object.keys(json.packages).filter(k => k && !k.split("/").includes("node_modules"));
|
|
316
322
|
const root = json.packages[""] || {};
|
|
317
323
|
const directProd = root.dependencies || {};
|
|
318
324
|
const directDev = root.devDependencies || {};
|
|
@@ -639,10 +645,19 @@ function pnpmNameVersion(key) {
|
|
|
639
645
|
|
|
640
646
|
function parsePnpmLock(filePath) {
|
|
641
647
|
const raw = fs.readFileSync(filePath, "utf8");
|
|
642
|
-
let
|
|
643
|
-
try {
|
|
648
|
+
let documents;
|
|
649
|
+
try { documents = yaml.loadAll(raw); }
|
|
644
650
|
catch (e) { throw new Error(`pnpm-lock parse failed (${filePath}): ${e.message}`); }
|
|
645
|
-
const
|
|
651
|
+
const project = documents.at(-1) || {};
|
|
652
|
+
const deps = documents.flatMap((doc, index) => pnpmDocumentDeps(doc || {}, index < documents.length - 1));
|
|
653
|
+
// Workspace members covered by this lockfile, as paths relative to it ("." is the root).
|
|
654
|
+
const importers = project.importers && typeof project.importers === "object" ? Object.keys(project.importers) : [];
|
|
655
|
+
return { manifestPath: filePath, manifestType: "pnpm-lock", lockfileVersion: project.lockfileVersion || null, deps, importers };
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// pnpm can prepend a standalone graph of config and package-manager dependencies.
|
|
659
|
+
// Its roots are build tools. Resolve edges within each document's own snapshots.
|
|
660
|
+
function pnpmDocumentDeps(doc, boot) {
|
|
646
661
|
// v9 splits metadata (`packages`, peer-free keys) from the graph (`snapshots`,
|
|
647
662
|
// peer-qualified keys); v5/v6 hold both in `packages`.
|
|
648
663
|
const meta = (doc.packages && typeof doc.packages === "object") ? doc.packages : {};
|
|
@@ -684,7 +699,9 @@ function parsePnpmLock(filePath) {
|
|
|
684
699
|
if (importers && typeof importers === "object") {
|
|
685
700
|
for (const imp of Object.values(importers)) {
|
|
686
701
|
if (!imp || typeof imp !== "object") continue;
|
|
687
|
-
|
|
702
|
+
const sections = boot ? [["configDependencies","dev"],["packageManagerDependencies","dev"]] :
|
|
703
|
+
[["dependencies","prod"],["optionalDependencies","optional"],["devDependencies","dev"]];
|
|
704
|
+
for (const [section, scope] of sections) {
|
|
688
705
|
for (const [n, ref] of Object.entries(imp[section] || {})) {
|
|
689
706
|
const id = link(n, ref);
|
|
690
707
|
if (id) roots.push({ id, scope });
|
|
@@ -692,8 +709,7 @@ function parsePnpmLock(filePath) {
|
|
|
692
709
|
}
|
|
693
710
|
}
|
|
694
711
|
}
|
|
695
|
-
|
|
696
|
-
return out;
|
|
712
|
+
return classifyLockGraph(nodes, roots);
|
|
697
713
|
}
|
|
698
714
|
|
|
699
715
|
/* -------- discovery ---------- */
|
|
@@ -739,7 +755,7 @@ function findJsManifests(rootDir, opts = {}) {
|
|
|
739
755
|
async function findJsManifestsAsync(rootDir, opts = {}) {
|
|
740
756
|
const { skipDirs = DEFAULT_JS_SKIP_DIRS } = opts;
|
|
741
757
|
const skipDir = opts.skipDir || ((child, name) => skipDirs.has(name));
|
|
742
|
-
const { walkDirs } = require("../../parallel-walk");
|
|
758
|
+
const { walkDirs } = require("../../inventory/parallel-walk");
|
|
743
759
|
const found = [];
|
|
744
760
|
await walkDirs(rootDir, {
|
|
745
761
|
skipDir,
|