@cdxgen/cdxgen 13.3.0 → 13.5.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/README.md +12 -9
- package/bin/cdxgen-secure.js +15 -0
- package/bin/cdxgen.js +115 -31
- package/bin/evinse.js +23 -1
- package/bin/hbom.js +15 -7
- package/bin/repl.js +115 -0
- package/bin/sign.js +45 -15
- package/bin/tracebom.js +5 -1
- package/bin/validate.js +84 -18
- package/bin/verify.js +155 -86
- package/data/cbomosdb-queries.json +13 -1
- package/data/component-tags.json +8 -0
- package/data/helpers/init.gradle +46 -21
- package/data/queries-darwin.json +25 -1
- package/data/queries-win.json +19 -1
- package/data/queries.json +41 -0
- package/data/remediations.json +344 -1
- package/data/rules/cbom-security.yaml +235 -4
- package/data/rules/dependency-sources.yaml +67 -0
- package/data/rules/go-binaries.yaml +46 -0
- package/data/rules/golem-go.yaml +80 -0
- package/data/rules/hbom-compliance.yaml +40 -22
- package/data/rules/hbom-performance.yaml +7 -1
- package/data/rules/host-topology.yaml +1 -1
- package/data/rules/obom-runtime.yaml +31 -2
- package/data/rules/php-runtime.yaml +143 -0
- package/data/rules/scala-evidence.yaml +115 -0
- package/lib/audit/index.js +52 -6
- package/lib/cli/bomAssembly.js +28 -3
- package/lib/cli/cliOptions.js +110 -3
- package/lib/cli/index.js +186 -58
- package/lib/cli/jsBom.js +50 -29
- package/lib/cli/jvmBom.js +779 -146
- package/lib/cli/managedBom.js +1021 -261
- package/lib/cli/nativeBom.js +364 -58
- package/lib/core/activity.js +12 -0
- package/lib/core/env.js +47 -17
- package/lib/core/fs.js +31 -21
- package/lib/core/httpClient.js +233 -69
- package/lib/core/pluginRun.js +184 -0
- package/lib/core/processTree.js +100 -0
- package/lib/core/projectConfig.js +1 -0
- package/lib/core/projectTooling.js +97 -0
- package/lib/core/propertySanitizer.js +72 -0
- package/lib/core/runState.js +39 -0
- package/lib/core/toml.js +72 -0
- package/lib/ecosystems/asarutils.js +4 -2
- package/lib/ecosystems/bunutils.js +5 -7
- package/lib/ecosystems/cargoCache.js +231 -8
- package/lib/ecosystems/cmakeResolver.js +10 -21
- package/lib/ecosystems/cppBuildContext.js +631 -0
- package/lib/ecosystems/cppEvidence.js +337 -22
- package/lib/ecosystems/cppIncludeResolver.js +294 -0
- package/lib/ecosystems/denoutils.js +93 -66
- package/lib/ecosystems/ecosystems.js +1967 -788
- package/lib/ecosystems/golem.js +578 -18
- package/lib/ecosystems/gradleutils.js +340 -46
- package/lib/ecosystems/jsEvidence.js +85 -24
- package/lib/ecosystems/kosi.js +21 -4
- package/lib/ecosystems/npmutils.js +64 -0
- package/lib/ecosystems/parsers-dotnet.js +668 -153
- package/lib/ecosystems/parsers-elm.js +46 -28
- package/lib/ecosystems/parsers-gleam.js +3 -4
- package/lib/ecosystems/parsers-go.js +1283 -297
- package/lib/ecosystems/parsers-js.js +92 -26
- package/lib/ecosystems/parsers-julia.js +2 -3
- package/lib/ecosystems/parsers-jvm.js +463 -29
- package/lib/ecosystems/parsers-misc.js +405 -93
- package/lib/ecosystems/parsers-python.js +152 -20
- package/lib/ecosystems/parsers-rust.js +4 -4
- package/lib/ecosystems/parsers-terraform.js +1573 -19
- package/lib/ecosystems/pythonutils.js +102 -6
- package/lib/ecosystems/remote/huggingface.js +3 -0
- package/lib/ecosystems/rubyutils.js +73 -20
- package/lib/ecosystems/rusi.js +32 -9
- package/lib/ecosystems/sbtutils.js +243 -187
- package/lib/ecosystems/scalacliutils.js +343 -0
- package/lib/ecosystems/scalasem.js +2620 -0
- package/lib/ecosystems/terraformRegistry.js +288 -0
- package/lib/ecosystems/utils.js +2 -0
- package/lib/ecosystems/vendoredCode.js +156 -0
- package/lib/evinser/evinser.js +695 -78
- package/lib/evinser/swiftsem.js +68 -5
- package/lib/helpers/agenticToolutils.js +2 -2
- package/lib/helpers/bomSigner.js +576 -128
- package/lib/inventory/agentSkillSpec.js +17 -0
- package/lib/inventory/aiCollector.js +4 -1
- package/lib/inventory/analyzer.js +110 -127
- package/lib/inventory/apkInstalledDb.js +243 -0
- package/lib/inventory/atomUtils.js +204 -48
- package/lib/inventory/auditCategories.js +10 -3
- package/lib/inventory/buildToolRateLimit.js +144 -0
- package/lib/inventory/cacheCommands.js +2 -1
- package/lib/inventory/cacheDir.js +52 -9
- package/lib/inventory/certificates.js +2371 -0
- package/lib/inventory/cmakeBuildDirs.js +254 -0
- package/lib/inventory/communityAiConfigParser.js +4 -9
- package/lib/inventory/deps.js +507 -128
- package/lib/inventory/display.js +200 -3
- package/lib/inventory/dosai.js +747 -101
- package/lib/inventory/dosaiParsers.js +310 -15
- package/lib/inventory/dynamic.js +96 -8
- package/lib/inventory/envcontext.js +168 -5
- package/lib/inventory/evidenceUtils.js +590 -132
- package/lib/inventory/fetchBatch.js +574 -38
- package/lib/inventory/fetchDiskCache.js +597 -0
- package/lib/inventory/forgeEnricher.js +14 -5
- package/lib/inventory/formulationParsers.js +3 -2
- package/lib/inventory/goBuildInfo.js +140 -0
- package/lib/inventory/hbom.js +67 -7
- package/lib/inventory/hbomAnalysis.js +16 -0
- package/lib/inventory/hostTopology.js +21 -0
- package/lib/inventory/jvmLocalRepos.js +917 -0
- package/lib/inventory/mcpConfigParser.js +2 -3
- package/lib/inventory/osPackagePurl.js +244 -0
- package/lib/inventory/osPackageResolver.js +89 -87
- package/lib/inventory/osinfo.js +79 -31
- package/lib/inventory/osqueryTransform.js +114 -5
- package/lib/inventory/parentSelection.js +146 -0
- package/lib/inventory/phpBuildInfo.js +487 -0
- package/lib/inventory/phpHostProbe.js +641 -0
- package/lib/inventory/rootfsCerts.js +426 -0
- package/lib/inventory/rustFormulationParser.js +3 -4
- package/lib/inventory/scalaCoords.js +153 -0
- package/lib/inventory/source.js +215 -11
- package/lib/inventory/spdx.js +245 -0
- package/lib/inventory/traceRunner.js +93 -8
- package/lib/inventory/tracedCrypto.js +423 -0
- package/lib/managers/binary.js +529 -183
- package/lib/managers/docker.js +199 -44
- package/lib/managers/oci.js +24 -2
- package/lib/parsers/cmakeCache.js +69 -0
- package/lib/parsers/cmakeLists.js +16 -2
- package/lib/parsers/cmakePresets.js +400 -0
- package/lib/parsers/compileCommands.js +557 -0
- package/lib/parsers/email.js +277 -0
- package/lib/parsers/largeJson.js +34 -2
- package/lib/parsers/strictJson.js +322 -0
- package/lib/parsers/terraformConfig.js +1073 -0
- package/lib/parsers/terraformSource.js +652 -0
- package/lib/server/server.js +209 -1
- package/lib/stages/postgen/annotator.js +17 -1
- package/lib/stages/postgen/introspection/markers.js +1 -1
- package/lib/stages/postgen/introspection/reflect.js +4 -1
- package/lib/stages/postgen/postgen.js +20 -6
- package/lib/stages/postgen/ruleEngine.js +58 -1
- package/lib/stages/postgen/specVersionCompat.js +62 -0
- package/lib/stages/pregen/pregen.js +117 -5
- package/lib/validator/bomValidator.js +26 -5
- package/lib/validator/generated/runtime.mjs +13 -0
- package/lib/validator/generated/validate-1.6.mjs +26 -7
- package/lib/validator/generated/validate-1.7.mjs +31 -12
- package/lib/validator/generated/validate-2.0.mjs +30 -11
- package/lib/validator/index.js +25 -10
- package/lib/validator/reporters/json.js +1 -0
- package/package.json +23 -23
- package/types/bin/cdxgen-secure.d.ts +3 -0
- package/types/bin/cdxgen-secure.d.ts.map +1 -0
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +9 -2
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +43 -0
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +44 -1
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts +7 -4
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts +3 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/activity.d.ts.map +1 -1
- package/types/lib/core/env.d.ts +27 -2
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/httpClient.d.ts +13 -8
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/pluginRun.d.ts +97 -0
- package/types/lib/core/pluginRun.d.ts.map +1 -0
- package/types/lib/core/processTree.d.ts +36 -0
- package/types/lib/core/processTree.d.ts.map +1 -0
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/projectTooling.d.ts +41 -0
- package/types/lib/core/projectTooling.d.ts.map +1 -0
- package/types/lib/core/propertySanitizer.d.ts +26 -0
- package/types/lib/core/propertySanitizer.d.ts.map +1 -1
- package/types/lib/core/runState.d.ts +29 -0
- package/types/lib/core/runState.d.ts.map +1 -0
- package/types/lib/core/toml.d.ts +20 -0
- package/types/lib/core/toml.d.ts.map +1 -0
- package/types/lib/ecosystems/asarutils.d.ts.map +1 -1
- package/types/lib/ecosystems/bunutils.d.ts.map +1 -1
- package/types/lib/ecosystems/cargoCache.d.ts +12 -0
- package/types/lib/ecosystems/cargoCache.d.ts.map +1 -1
- package/types/lib/ecosystems/cmakeResolver.d.ts +5 -3
- package/types/lib/ecosystems/cmakeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/cppBuildContext.d.ts +55 -0
- package/types/lib/ecosystems/cppBuildContext.d.ts.map +1 -0
- package/types/lib/ecosystems/cppEvidence.d.ts +19 -3
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts +92 -0
- package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -0
- package/types/lib/ecosystems/denoutils.d.ts +9 -3
- package/types/lib/ecosystems/denoutils.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts +62 -13
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/golem.d.ts +81 -1
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +59 -7
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts.map +1 -1
- package/types/lib/ecosystems/npmutils.d.ts +15 -0
- package/types/lib/ecosystems/npmutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-dotnet.d.ts +155 -5
- package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-elm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-gleam.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-go.d.ts +119 -5
- package/types/lib/ecosystems/parsers-go.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +6 -1
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-julia.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-jvm.d.ts +74 -3
- package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +21 -59
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +57 -6
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-terraform.d.ts +38 -21
- package/types/lib/ecosystems/parsers-terraform.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +26 -1
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts +21 -1
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/sbtutils.d.ts +88 -2
- package/types/lib/ecosystems/sbtutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts +56 -0
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -0
- package/types/lib/ecosystems/scalasem.d.ts +311 -0
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -0
- package/types/lib/ecosystems/terraformRegistry.d.ts +9 -0
- package/types/lib/ecosystems/terraformRegistry.d.ts.map +1 -0
- package/types/lib/ecosystems/utils.d.ts +2 -2
- package/types/lib/ecosystems/utils.d.ts.map +1 -1
- package/types/lib/ecosystems/vendoredCode.d.ts +32 -0
- package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -0
- package/types/lib/evinser/evinser.d.ts +100 -8
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/swiftsem.d.ts +10 -0
- package/types/lib/evinser/swiftsem.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +80 -4
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/inventory/agentSkillSpec.d.ts +13 -0
- package/types/lib/inventory/agentSkillSpec.d.ts.map +1 -0
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/analyzer.d.ts.map +1 -1
- package/types/lib/inventory/apkInstalledDb.d.ts +42 -0
- package/types/lib/inventory/apkInstalledDb.d.ts.map +1 -0
- package/types/lib/inventory/atomUtils.d.ts +96 -10
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/auditCategories.d.ts +3 -0
- package/types/lib/inventory/auditCategories.d.ts.map +1 -1
- package/types/lib/inventory/buildToolRateLimit.d.ts +38 -0
- package/types/lib/inventory/buildToolRateLimit.d.ts.map +1 -0
- package/types/lib/inventory/cacheCommands.d.ts +2 -1
- package/types/lib/inventory/cacheCommands.d.ts.map +1 -1
- package/types/lib/inventory/cacheDir.d.ts +12 -4
- package/types/lib/inventory/cacheDir.d.ts.map +1 -1
- package/types/lib/inventory/certificates.d.ts +205 -0
- package/types/lib/inventory/certificates.d.ts.map +1 -0
- package/types/lib/inventory/cmakeBuildDirs.d.ts +58 -0
- package/types/lib/inventory/cmakeBuildDirs.d.ts.map +1 -0
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/deps.d.ts +61 -2
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/display.d.ts +18 -0
- package/types/lib/inventory/display.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +202 -14
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dosaiParsers.d.ts +53 -7
- package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
- package/types/lib/inventory/dynamic.d.ts +16 -1
- package/types/lib/inventory/dynamic.d.ts.map +1 -1
- package/types/lib/inventory/envcontext.d.ts +40 -2
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts +48 -14
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/fetchBatch.d.ts +83 -14
- package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
- package/types/lib/inventory/fetchDiskCache.d.ts +169 -0
- package/types/lib/inventory/fetchDiskCache.d.ts.map +1 -0
- package/types/lib/inventory/forgeEnricher.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/goBuildInfo.d.ts +10 -0
- package/types/lib/inventory/goBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomAnalysis.d.ts +10 -0
- package/types/lib/inventory/hbomAnalysis.d.ts.map +1 -1
- package/types/lib/inventory/hostTopology.d.ts.map +1 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts +178 -0
- package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -0
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/osPackagePurl.d.ts +99 -0
- package/types/lib/inventory/osPackagePurl.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +6 -2
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/osinfo.d.ts +31 -6
- package/types/lib/inventory/osinfo.d.ts.map +1 -1
- package/types/lib/inventory/osqueryTransform.d.ts +51 -0
- package/types/lib/inventory/osqueryTransform.d.ts.map +1 -1
- package/types/lib/inventory/parentSelection.d.ts +34 -0
- package/types/lib/inventory/parentSelection.d.ts.map +1 -0
- package/types/lib/inventory/phpBuildInfo.d.ts +142 -0
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/phpHostProbe.d.ts +35 -0
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/rootfsCerts.d.ts +27 -0
- package/types/lib/inventory/rootfsCerts.d.ts.map +1 -0
- package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/scalaCoords.d.ts +80 -0
- package/types/lib/inventory/scalaCoords.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +28 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/inventory/spdx.d.ts +24 -0
- package/types/lib/inventory/spdx.d.ts.map +1 -1
- package/types/lib/inventory/traceRunner.d.ts +16 -1
- package/types/lib/inventory/traceRunner.d.ts.map +1 -1
- package/types/lib/inventory/tracedCrypto.d.ts +64 -0
- package/types/lib/inventory/tracedCrypto.d.ts.map +1 -0
- package/types/lib/managers/binary.d.ts +10 -0
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +12 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/managers/oci.d.ts +3 -1
- package/types/lib/managers/oci.d.ts.map +1 -1
- package/types/lib/parsers/cmakeCache.d.ts +16 -0
- package/types/lib/parsers/cmakeCache.d.ts.map +1 -1
- package/types/lib/parsers/cmakeLists.d.ts +2 -1
- package/types/lib/parsers/cmakeLists.d.ts.map +1 -1
- package/types/lib/parsers/cmakePresets.d.ts +78 -0
- package/types/lib/parsers/cmakePresets.d.ts.map +1 -0
- package/types/lib/parsers/compileCommands.d.ts +115 -0
- package/types/lib/parsers/compileCommands.d.ts.map +1 -0
- package/types/lib/parsers/email.d.ts +19 -0
- package/types/lib/parsers/email.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +13 -0
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/parsers/strictJson.d.ts +46 -0
- package/types/lib/parsers/strictJson.d.ts.map +1 -0
- package/types/lib/parsers/terraformConfig.d.ts +70 -0
- package/types/lib/parsers/terraformConfig.d.ts.map +1 -0
- package/types/lib/parsers/terraformSource.d.ts +66 -0
- package/types/lib/parsers/terraformSource.d.ts.map +1 -0
- package/types/lib/server/server.d.ts +8 -0
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/annotator.d.ts.map +1 -1
- package/types/lib/stages/postgen/introspection/reflect.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts +7 -4
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +14 -1
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +8 -0
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
- package/lib/third-party/arborist/snapshots/calc-dep-flags.test.cjs +0 -462
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from "../core/buildLedger.js";
|
|
21
21
|
import {
|
|
22
22
|
CARGO_CMD,
|
|
23
|
+
COMPOSER_CMD,
|
|
23
24
|
DOTNET_CMD,
|
|
24
25
|
GCC_CMD,
|
|
25
26
|
GO_CMD,
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
isDeno,
|
|
30
31
|
isNode,
|
|
31
32
|
NPM_CMD,
|
|
33
|
+
PHP_CMD,
|
|
32
34
|
RUBY_CMD,
|
|
33
35
|
RUSTC_CMD,
|
|
34
36
|
SWIFT_CMD,
|
|
@@ -41,7 +43,12 @@ import {
|
|
|
41
43
|
} from "../core/fs.js";
|
|
42
44
|
import { diagnosticStream } from "../core/logger.js";
|
|
43
45
|
import { dirNameStr, isMac, isWin } from "../core/paths.js";
|
|
46
|
+
import { isProjectToolingAllowed } from "../core/projectTooling.js";
|
|
44
47
|
import { isValidSdkmanVersion } from "./jvmToolEnv.js";
|
|
48
|
+
import {
|
|
49
|
+
createPhpRuntimeComponent,
|
|
50
|
+
parsePhpReportedVersion,
|
|
51
|
+
} from "./phpBuildInfo.js";
|
|
45
52
|
import { applyPurl, tryBuildPurl } from "./purl.js";
|
|
46
53
|
import {
|
|
47
54
|
classifySpawnRestriction,
|
|
@@ -62,6 +69,9 @@ export const GIT_COMMAND = readEnvironmentVariable("GIT_CMD") || "git";
|
|
|
62
69
|
* - `core.fsmonitor=false` — a repo-set fsmonitor value is a command git runs.
|
|
63
70
|
* - `core.hooksPath=/dev/null` — prevents any hook script from executing.
|
|
64
71
|
* - `safe.bareRepository=explicit` — avoids operating on an embedded bare repo.
|
|
72
|
+
* - `gpg.program`, `gpg.ssh.program`, `gpg.x509.program` — `%G?` in a log
|
|
73
|
+
* format verifies signatures by running these, so pin them to the tools
|
|
74
|
+
* on PATH instead of a program named by the repo.
|
|
65
75
|
* `-c` overrides take precedence over the repo-local config. Diff-producing
|
|
66
76
|
* commands (`git show`/`git diff`) additionally pass `--no-ext-diff`/
|
|
67
77
|
* `--no-textconv` to block `.gitattributes`-driven external diff and textconv
|
|
@@ -74,6 +84,12 @@ const GIT_HARDENING_CONFIG_ARGS = Object.freeze([
|
|
|
74
84
|
"core.hooksPath=/dev/null",
|
|
75
85
|
"-c",
|
|
76
86
|
"safe.bareRepository=explicit",
|
|
87
|
+
"-c",
|
|
88
|
+
"gpg.program=gpg",
|
|
89
|
+
"-c",
|
|
90
|
+
"gpg.ssh.program=ssh-keygen",
|
|
91
|
+
"-c",
|
|
92
|
+
"gpg.x509.program=gpgsm",
|
|
77
93
|
]);
|
|
78
94
|
|
|
79
95
|
/**
|
|
@@ -84,7 +100,15 @@ const GIT_HARDENING_CONFIG_ARGS = Object.freeze([
|
|
|
84
100
|
* @returns {Object} environment for spawning git
|
|
85
101
|
*/
|
|
86
102
|
function hardenedGitEnv() {
|
|
87
|
-
|
|
103
|
+
// These commands only read the local repository. A partial clone would
|
|
104
|
+
// otherwise fetch missing objects through the repo's own remote and
|
|
105
|
+
// core.sshCommand settings, so turn lazy fetching and every transport off.
|
|
106
|
+
const env = {
|
|
107
|
+
...process.env,
|
|
108
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
109
|
+
GIT_NO_LAZY_FETCH: "1",
|
|
110
|
+
GIT_ALLOW_PROTOCOL: "cdxgen-no-network",
|
|
111
|
+
};
|
|
88
112
|
if (isSecureMode) {
|
|
89
113
|
env.GIT_CONFIG_NOSYSTEM = "1";
|
|
90
114
|
env.GIT_CONFIG_GLOBAL = "/dev/null";
|
|
@@ -337,8 +361,10 @@ function recordToolProbeResolved(tool, ecosystem, found) {
|
|
|
337
361
|
* @param {string} tool Tool name
|
|
338
362
|
* @param {string} ecosystem Ecosystem the tool belongs to
|
|
339
363
|
* @param {string} command Probe command that failed
|
|
364
|
+
* @param {string} [detail] What to say when the command is not restricted,
|
|
365
|
+
* instead of the default that no command answered
|
|
340
366
|
*/
|
|
341
|
-
function recordToolProbeFailure(tool, ecosystem, command) {
|
|
367
|
+
function recordToolProbeFailure(tool, ecosystem, command, detail) {
|
|
342
368
|
if (!isLedgerEnabled()) {
|
|
343
369
|
return;
|
|
344
370
|
}
|
|
@@ -362,7 +388,7 @@ function recordToolProbeFailure(tool, ecosystem, command) {
|
|
|
362
388
|
ecosystem,
|
|
363
389
|
tool,
|
|
364
390
|
source: "PATH",
|
|
365
|
-
detail: `No ${tool} command answered the version probe.`,
|
|
391
|
+
detail: detail || `No ${tool} command answered the version probe.`,
|
|
366
392
|
});
|
|
367
393
|
}
|
|
368
394
|
}
|
|
@@ -579,6 +605,124 @@ export function collectRubyInfo(dir) {
|
|
|
579
605
|
return undefined;
|
|
580
606
|
}
|
|
581
607
|
|
|
608
|
+
/**
|
|
609
|
+
* The first line of a command's output, without its line end.
|
|
610
|
+
*
|
|
611
|
+
* @param {string|undefined} output Output of getCommandOutput
|
|
612
|
+
* @returns {string} First line, or an empty string
|
|
613
|
+
*/
|
|
614
|
+
function firstOutputLine(output) {
|
|
615
|
+
return `${output || ""}`.split(/\r?\n/, 1)[0].trim();
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* A toolchain component for the formulation section. Formulation shares the
|
|
620
|
+
* document's bom-ref namespace with the inventory, which can hold the very same
|
|
621
|
+
* `pkg:generic/php@<version>` runtime (an image scanned with
|
|
622
|
+
* --include-formulation), so like the other toolchains it carries no bom-ref.
|
|
623
|
+
*
|
|
624
|
+
* @param {Object} component component built with applyPurl
|
|
625
|
+
* @returns {Object} the component without its bom-ref
|
|
626
|
+
*/
|
|
627
|
+
function formulationToolchain(component) {
|
|
628
|
+
delete component["bom-ref"];
|
|
629
|
+
return component;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Collect the PHP version of the PHP found on the PATH.
|
|
634
|
+
*
|
|
635
|
+
* `-n` stops PHP loading any php.ini, so a PHPRC or an auto_prepend_file cannot
|
|
636
|
+
* run code, and `-v` is used rather than `-r 'echo PHP_VERSION;'` because the
|
|
637
|
+
* shell on Windows does not quote arguments. The first line is
|
|
638
|
+
* `PHP 8.5.11 (cli) (built: Sep 22 2026 13:32:06) (NTS)`.
|
|
639
|
+
*
|
|
640
|
+
* The identity is `pkg:generic/php`: a probe of the PATH cannot tell which
|
|
641
|
+
* package manager, if any, installed this PHP. A banner with a distro revision,
|
|
642
|
+
* such as Ubuntu 22.04's `PHP 8.1.2-1ubuntu2.14`, is recorded as reported but
|
|
643
|
+
* without a CPE: the distro backports fixes under the old upstream number.
|
|
644
|
+
*
|
|
645
|
+
* @param {string} dir Working directory
|
|
646
|
+
* @returns Object containing the PHP details
|
|
647
|
+
*/
|
|
648
|
+
export function collectPhpInfo(dir) {
|
|
649
|
+
const output = getCommandOutput(PHP_CMD, dir, ["-n", "-v"]);
|
|
650
|
+
const banner = firstOutputLine(output);
|
|
651
|
+
const reported = banner.startsWith("PHP ")
|
|
652
|
+
? parsePhpReportedVersion(banner.slice("PHP ".length))
|
|
653
|
+
: undefined;
|
|
654
|
+
if (reported) {
|
|
655
|
+
recordToolProbeResolved("php", "php", reported.version);
|
|
656
|
+
return formulationToolchain(
|
|
657
|
+
createPhpRuntimeComponent(reported.version, {
|
|
658
|
+
withCpe: !reported.distroRevision,
|
|
659
|
+
}),
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
recordToolProbeFailure(
|
|
663
|
+
"php",
|
|
664
|
+
"php",
|
|
665
|
+
PHP_CMD,
|
|
666
|
+
output
|
|
667
|
+
? "The php version probe did not print a PHP version banner."
|
|
668
|
+
: undefined,
|
|
669
|
+
);
|
|
670
|
+
return undefined;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Collect the Composer version.
|
|
675
|
+
*
|
|
676
|
+
* `--no-plugins` and `--no-scripts` keep the plugins and scripts of the
|
|
677
|
+
* project in the working directory from running, which `composer --version`
|
|
678
|
+
* would otherwise let a plugin do. It needs no network. The banner is
|
|
679
|
+
* `Composer version 2.10.3 2026-08-27 13:34:23`, but an older Composer on a
|
|
680
|
+
* newer PHP prints deprecation notices above it, so the first line that starts
|
|
681
|
+
* with it is read; the line after it names the PHP Composer runs on, with its
|
|
682
|
+
* path, and is never read. The banner must start its line: an indented echo of
|
|
683
|
+
* the project's composer.json in an error block does not count. Only a stable
|
|
684
|
+
* release is recorded: a pre-release or a snapshot has no version a CPE can
|
|
685
|
+
* name.
|
|
686
|
+
*
|
|
687
|
+
* @param {string} dir Working directory
|
|
688
|
+
* @returns Object containing the Composer details
|
|
689
|
+
*/
|
|
690
|
+
export function collectComposerInfo(dir) {
|
|
691
|
+
const output = getCommandOutput(COMPOSER_CMD, dir, [
|
|
692
|
+
"--version",
|
|
693
|
+
"--no-plugins",
|
|
694
|
+
"--no-scripts",
|
|
695
|
+
"--no-interaction",
|
|
696
|
+
]);
|
|
697
|
+
const token =
|
|
698
|
+
/^Composer version (\S+)/m.exec(
|
|
699
|
+
`${output || ""}`.slice(0, 64 * 1024),
|
|
700
|
+
)?.[1] || "";
|
|
701
|
+
if (/^\d+\.\d+\.\d+$/.test(token)) {
|
|
702
|
+
recordToolProbeResolved("composer", "php", token);
|
|
703
|
+
return formulationToolchain(
|
|
704
|
+
applyPurl(
|
|
705
|
+
{
|
|
706
|
+
type: "platform",
|
|
707
|
+
name: "composer",
|
|
708
|
+
version: token,
|
|
709
|
+
cpe: `cpe:2.3:a:getcomposer:composer:${token}:*:*:*:*:*:*:*`,
|
|
710
|
+
},
|
|
711
|
+
tryBuildPurl({ type: "generic", name: "composer", version: token }),
|
|
712
|
+
),
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
recordToolProbeFailure(
|
|
716
|
+
"composer",
|
|
717
|
+
"php",
|
|
718
|
+
COMPOSER_CMD,
|
|
719
|
+
output
|
|
720
|
+
? "The composer version probe did not print a stable Composer version."
|
|
721
|
+
: undefined,
|
|
722
|
+
);
|
|
723
|
+
return undefined;
|
|
724
|
+
}
|
|
725
|
+
|
|
582
726
|
/**
|
|
583
727
|
* Method to run a swift command
|
|
584
728
|
*
|
|
@@ -594,12 +738,23 @@ export function runSwiftCommand(dir, args) {
|
|
|
594
738
|
* Collect toolchain information components for the current environment.
|
|
595
739
|
*
|
|
596
740
|
* Probes the working directory for java, dotnet, python, node, gcc, rust, go,
|
|
597
|
-
* and
|
|
741
|
+
* ruby, php and composer toolchains and returns one component per detected
|
|
742
|
+
* tool.
|
|
598
743
|
*
|
|
599
744
|
* @param {string} dir Working directory to inspect
|
|
745
|
+
* @param {Object} [options] CLI options, which decide whether the project's
|
|
746
|
+
* own toolchain files may choose the tools that run
|
|
600
747
|
* @returns {Object[]} Array of toolchain component objects; empty when nothing is detected
|
|
601
748
|
*/
|
|
602
|
-
export function collectEnvInfo(dir) {
|
|
749
|
+
export function collectEnvInfo(dir, options = undefined) {
|
|
750
|
+
// Version managers pick the toolchain from files in the working directory.
|
|
751
|
+
// rust-toolchain.toml can name an absolute toolchain path and global.json
|
|
752
|
+
// can name SDK paths, so unless the project's tooling may run, the probes
|
|
753
|
+
// run outside the scanned project and report the toolchains installed on
|
|
754
|
+
// the host.
|
|
755
|
+
if (!isProjectToolingAllowed(options)) {
|
|
756
|
+
dir = getTmpDir();
|
|
757
|
+
}
|
|
603
758
|
const infoComponents = [];
|
|
604
759
|
let cmp = collectJavaInfo(dir);
|
|
605
760
|
if (cmp) {
|
|
@@ -633,6 +788,14 @@ export function collectEnvInfo(dir) {
|
|
|
633
788
|
if (cmp) {
|
|
634
789
|
infoComponents.push(cmp);
|
|
635
790
|
}
|
|
791
|
+
cmp = collectPhpInfo(dir);
|
|
792
|
+
if (cmp) {
|
|
793
|
+
infoComponents.push(cmp);
|
|
794
|
+
}
|
|
795
|
+
cmp = collectComposerInfo(dir);
|
|
796
|
+
if (cmp) {
|
|
797
|
+
infoComponents.push(cmp);
|
|
798
|
+
}
|
|
636
799
|
return infoComponents;
|
|
637
800
|
}
|
|
638
801
|
|