@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
package/lib/audit/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
resolveGitUrlFromPurl,
|
|
48
48
|
resolvePurlSourceDirectory,
|
|
49
49
|
sanitizeRemoteUrlForLogs,
|
|
50
|
+
validateAndRejectGitSource,
|
|
50
51
|
} from "../inventory/source.js";
|
|
51
52
|
import { executeOsQuery } from "../managers/binary.js";
|
|
52
53
|
import { getBomWithOras } from "../managers/oci.js";
|
|
@@ -390,6 +391,27 @@ function targetSlug(target) {
|
|
|
390
391
|
return `${target.type}-${normalized || "package"}-${version}-${digest}`;
|
|
391
392
|
}
|
|
392
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Build a deterministic directory name for a repository checkout, keyed by
|
|
396
|
+
* the repository URL and the ref it is cloned at.
|
|
397
|
+
*
|
|
398
|
+
* Keying by the coordinates rather than the package means the packages of
|
|
399
|
+
* one monorepo share a single checkout instead of each cloning the whole
|
|
400
|
+
* repository, while a different ref, which is a different snapshot of the
|
|
401
|
+
* tree, never shares one.
|
|
402
|
+
*
|
|
403
|
+
* @param {string} repoUrl Repository URL
|
|
404
|
+
* @param {string | undefined} gitRef Ref the checkout is cloned at
|
|
405
|
+
* @returns {string} slug string
|
|
406
|
+
*/
|
|
407
|
+
function repositoryCheckoutSlug(repoUrl, gitRef) {
|
|
408
|
+
const digest = createHash("sha256")
|
|
409
|
+
.update(`${repoUrl}\n${gitRef || ""}`)
|
|
410
|
+
.digest("hex")
|
|
411
|
+
.slice(0, 16);
|
|
412
|
+
return `repo-${digest}`;
|
|
413
|
+
}
|
|
414
|
+
|
|
393
415
|
/**
|
|
394
416
|
* Ensure a parent directory exists before writing a file.
|
|
395
417
|
*
|
|
@@ -1286,6 +1308,17 @@ export function buildTargetContextFindings(target) {
|
|
|
1286
1308
|
* @returns {void}
|
|
1287
1309
|
*/
|
|
1288
1310
|
function cloneRepositoryToDir(repoUrl, cloneDir, gitRef) {
|
|
1311
|
+
// The repository URL comes from registry metadata, so it gets the same
|
|
1312
|
+
// protocol and host checks as a URL sent to the server.
|
|
1313
|
+
const validationError = validateAndRejectGitSource(repoUrl);
|
|
1314
|
+
if (validationError) {
|
|
1315
|
+
const error = new Error(
|
|
1316
|
+
`${validationError.error}: ${validationError.details}`,
|
|
1317
|
+
);
|
|
1318
|
+
error.errorType = "clone";
|
|
1319
|
+
error.retryable = false;
|
|
1320
|
+
throw error;
|
|
1321
|
+
}
|
|
1289
1322
|
const gitArgs = [
|
|
1290
1323
|
"-c",
|
|
1291
1324
|
"alias.clone=",
|
|
@@ -1295,6 +1328,8 @@ function cloneRepositoryToDir(repoUrl, cloneDir, gitRef) {
|
|
|
1295
1328
|
"safe.bareRepository=explicit",
|
|
1296
1329
|
"-c",
|
|
1297
1330
|
"core.hooksPath=/dev/null",
|
|
1331
|
+
"-c",
|
|
1332
|
+
"core.symlinks=false",
|
|
1298
1333
|
"clone",
|
|
1299
1334
|
"--template=",
|
|
1300
1335
|
"--depth",
|
|
@@ -1378,7 +1413,12 @@ async function ensureCheckout(target, resolution, workspaceDir, gitRef) {
|
|
|
1378
1413
|
if (!safeExistsSync(resolvedWorkspaceDir)) {
|
|
1379
1414
|
safeMkdirSync(resolvedWorkspaceDir, { recursive: true });
|
|
1380
1415
|
}
|
|
1381
|
-
|
|
1416
|
+
// One checkout per repository and ref, so packages of the same monorepo
|
|
1417
|
+
// share it; each package still keeps its own cache and report directory.
|
|
1418
|
+
const cloneDir = join(
|
|
1419
|
+
resolvedWorkspaceDir,
|
|
1420
|
+
repositoryCheckoutSlug(resolution.repoUrl, gitRef),
|
|
1421
|
+
);
|
|
1382
1422
|
if (safeExistsSync(join(cloneDir, ".git"))) {
|
|
1383
1423
|
return {
|
|
1384
1424
|
cleanup: false,
|
|
@@ -2635,11 +2675,17 @@ export async function runAuditFromBoms(inputBoms, options) {
|
|
|
2635
2675
|
total: extractedTargets.targets.length,
|
|
2636
2676
|
type: "run:start",
|
|
2637
2677
|
});
|
|
2638
|
-
// Every target's repository lookup is known here, before the first
|
|
2639
|
-
// so they are resolved in one round rather than one per iteration
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2678
|
+
// Every target's repository lookup is known here, before the first
|
|
2679
|
+
// clone, so they are resolved in one round rather than one per iteration
|
|
2680
|
+
// below. A target whose cached child BOM already answers it is resolved
|
|
2681
|
+
// from the workspace alone, so only the targets that will be cloned take
|
|
2682
|
+
// part in the round.
|
|
2683
|
+
const purlsToResolve = extractedTargets.targets
|
|
2684
|
+
.filter((target) => !loadCachedChildBom(options.workspaceDir, target))
|
|
2685
|
+
.map((target) => target.purl);
|
|
2686
|
+
if (purlsToResolve.length) {
|
|
2687
|
+
await prefetchGitUrlSources(purlsToResolve);
|
|
2688
|
+
}
|
|
2643
2689
|
}
|
|
2644
2690
|
for (const [index, target] of extractedTargets.targets.entries()) {
|
|
2645
2691
|
const targetIndex = index + 1;
|
package/lib/cli/bomAssembly.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
setCycloneDxFormat,
|
|
46
46
|
toCycloneDxSpecVersionString,
|
|
47
47
|
} from "../inventory/bomUtils.js";
|
|
48
|
+
import { mergeDuplicateCryptoComponents } from "../inventory/certificates.js";
|
|
48
49
|
import { mergeServices, trimComponents } from "../inventory/depsUtils.js";
|
|
49
50
|
import {
|
|
50
51
|
attachIdentityTools,
|
|
@@ -457,6 +458,11 @@ export const addLifecyclesSection = (options) => {
|
|
|
457
458
|
/**
|
|
458
459
|
* Function to create metadata block
|
|
459
460
|
*
|
|
461
|
+
* @param {Object} [parentComponent] Component the BOM describes
|
|
462
|
+
* @param {Object} [options] CLI options
|
|
463
|
+
* @param {Object} [context] Generator context. `context.metadataProperties`
|
|
464
|
+
* holds facts of a manifest that has no component to carry them, such as the
|
|
465
|
+
* platform data of a composer.lock whose composer.json names no project.
|
|
460
466
|
*/
|
|
461
467
|
export function addMetadata(parentComponent = {}, options = {}, context = {}) {
|
|
462
468
|
// DO NOT fork this project to just change the vendor or author's name
|
|
@@ -752,7 +758,7 @@ export function addMetadata(parentComponent = {}, options = {}, context = {}) {
|
|
|
752
758
|
});
|
|
753
759
|
let appLanguage;
|
|
754
760
|
// TODO: Move these lists to a config file.
|
|
755
|
-
for (const lang
|
|
761
|
+
for (const lang of [
|
|
756
762
|
"java",
|
|
757
763
|
"node",
|
|
758
764
|
"dotnet",
|
|
@@ -828,6 +834,9 @@ export function addMetadata(parentComponent = {}, options = {}, context = {}) {
|
|
|
828
834
|
// AI provenance/oversight detection (`-t ai-provenance`) is injected into the
|
|
829
835
|
// BOM document root (bomJson.properties) after post-processing, not into
|
|
830
836
|
// metadata.properties. See ensureAiProvenanceProperties/ensureAiOversightProperties.
|
|
837
|
+
if (context?.metadataProperties?.length) {
|
|
838
|
+
mproperties.push(...context.metadataProperties);
|
|
839
|
+
}
|
|
831
840
|
if (mproperties.length) {
|
|
832
841
|
metadata.properties = mproperties;
|
|
833
842
|
}
|
|
@@ -1602,6 +1611,10 @@ export const buildBomNSData = (options, pkgInfo, ptype, context) => {
|
|
|
1602
1611
|
if (context?.formulationList?.length) {
|
|
1603
1612
|
bomNSData.formulationList = context.formulationList;
|
|
1604
1613
|
}
|
|
1614
|
+
// createMultiXBom rebuilds the metadata block, so these are handed on.
|
|
1615
|
+
if (context?.metadataProperties?.length) {
|
|
1616
|
+
bomNSData.metadataProperties = context.metadataProperties;
|
|
1617
|
+
}
|
|
1605
1618
|
// Carry language-specific provenance citations (e.g. PEP 770 embedded
|
|
1606
1619
|
// SBOMs) so postProcess can attach them in the single root-level citations
|
|
1607
1620
|
// section it builds.
|
|
@@ -1933,16 +1946,28 @@ export function emitAiInventorySummary(aiInventory, discoveryPath) {
|
|
|
1933
1946
|
* @param {Array} components Components
|
|
1934
1947
|
* @param {Object} parentComponent Parent component
|
|
1935
1948
|
* @param {Array} dependencies Dependencies
|
|
1949
|
+
* @param {Array} [metadataProperties] Properties for the metadata block, from
|
|
1950
|
+
* generators whose manifest has no component to carry them
|
|
1936
1951
|
*
|
|
1937
1952
|
* @returns {Object} Object including BOM Json
|
|
1938
1953
|
*/
|
|
1939
|
-
export function dedupeBom(
|
|
1954
|
+
export function dedupeBom(
|
|
1955
|
+
options,
|
|
1956
|
+
components,
|
|
1957
|
+
parentComponent,
|
|
1958
|
+
dependencies,
|
|
1959
|
+
metadataProperties = [],
|
|
1960
|
+
) {
|
|
1940
1961
|
if (!components) {
|
|
1941
1962
|
return {};
|
|
1942
1963
|
}
|
|
1943
1964
|
if (!dependencies) {
|
|
1944
1965
|
dependencies = [];
|
|
1945
1966
|
}
|
|
1967
|
+
// Certificate components from different producers (trustinspector rootfs,
|
|
1968
|
+
// the source-directory scan, observed chains) share a bom-ref; merge their
|
|
1969
|
+
// occurrences and properties before the generic trim.
|
|
1970
|
+
components = mergeDuplicateCryptoComponents(components);
|
|
1946
1971
|
components = trimComponents(components);
|
|
1947
1972
|
// Let's apply some common tweaks
|
|
1948
1973
|
// Convert evidence.identity section to an object for 1.5
|
|
@@ -1971,7 +1996,7 @@ export function dedupeBom(options, components, parentComponent, dependencies) {
|
|
|
1971
1996
|
),
|
|
1972
1997
|
serialNumber: serialNum,
|
|
1973
1998
|
version: 1,
|
|
1974
|
-
metadata: addMetadata(parentComponent, options, {}),
|
|
1999
|
+
metadata: addMetadata(parentComponent, options, { metadataProperties }),
|
|
1975
2000
|
components,
|
|
1976
2001
|
services: options.services || [],
|
|
1977
2002
|
dependencies,
|
package/lib/cli/cliOptions.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
METADATA_PROPERTY_CONFIG_KEYS,
|
|
20
20
|
parseMetadataProperties,
|
|
21
21
|
} from "../core/metadataProperties.js";
|
|
22
|
+
import { toCamel } from "../core/paths.js";
|
|
22
23
|
import {
|
|
23
24
|
DEFAULT_CDX_SPEC_VERSION,
|
|
24
25
|
normalizeCycloneDxComponentTypeFilter,
|
|
@@ -124,6 +125,106 @@ export function isUserProvided(value, yaDefault) {
|
|
|
124
125
|
return value !== undefined && value !== yaDefault;
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
/**
|
|
129
|
+
* The value the operator gave an option on the command line or through its
|
|
130
|
+
* CDXGEN_* environment variable. yargs also fills options in from defaults
|
|
131
|
+
* and from a config file, which cannot be told apart in its output.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} option kebab-case option name
|
|
134
|
+
* @param {object} [context]
|
|
135
|
+
* @param {string[]} [context.argv] Raw command-line arguments
|
|
136
|
+
* @param {object} [context.env] Environment variables
|
|
137
|
+
* @param {boolean} [context.boolean] Read the option as a boolean flag
|
|
138
|
+
* @returns {string|boolean|undefined} The operator's value, or undefined
|
|
139
|
+
*/
|
|
140
|
+
export function operatorOptionChoice(
|
|
141
|
+
option,
|
|
142
|
+
{ argv = process.argv.slice(2), env = process.env, boolean = false } = {},
|
|
143
|
+
) {
|
|
144
|
+
const spellings = [...new Set([option, toCamel(option)])];
|
|
145
|
+
const toBoolean = (value) =>
|
|
146
|
+
["true", "1"].includes(`${value}`.trim().toLowerCase());
|
|
147
|
+
let choice;
|
|
148
|
+
for (let i = 0; i < argv.length; i++) {
|
|
149
|
+
const arg = `${argv[i]}`;
|
|
150
|
+
if (arg === "--") {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
for (const name of spellings) {
|
|
154
|
+
if (boolean && arg === `--no-${name}`) {
|
|
155
|
+
choice = false;
|
|
156
|
+
} else if (arg === `--${name}`) {
|
|
157
|
+
const next = argv[i + 1] === undefined ? "" : `${argv[i + 1]}`;
|
|
158
|
+
if (!boolean) {
|
|
159
|
+
choice = next;
|
|
160
|
+
i++;
|
|
161
|
+
} else if (["true", "false"].includes(next.toLowerCase())) {
|
|
162
|
+
choice = toBoolean(next);
|
|
163
|
+
i++;
|
|
164
|
+
} else {
|
|
165
|
+
choice = true;
|
|
166
|
+
}
|
|
167
|
+
} else if (arg.startsWith(`--${name}=`)) {
|
|
168
|
+
const value = arg.slice(name.length + 3);
|
|
169
|
+
choice = boolean ? toBoolean(value) : value;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (choice !== undefined) {
|
|
174
|
+
return choice;
|
|
175
|
+
}
|
|
176
|
+
const envValue =
|
|
177
|
+
env[`CDXGEN_${option.toUpperCase().replaceAll("-", "_")}`] ?? "";
|
|
178
|
+
if (`${envValue}`.trim() === "") {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
return boolean ? toBoolean(envValue) : `${envValue}`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Make the operator's choice about running the scanned project's own code
|
|
186
|
+
* final. A config file is read from the working directory, which is usually
|
|
187
|
+
* the scanned project, so it carries that project's trust. Neither the config
|
|
188
|
+
* file nor a profile or lifecycle may turn installs on when the operator
|
|
189
|
+
* disabled them, and secure mode keeps installs off unless the operator
|
|
190
|
+
* passes --install-deps. Introspection keeps the project's build tools
|
|
191
|
+
* running with installs off, which is likewise the operator's decision, so
|
|
192
|
+
* introspection asked for only by the config file does not do that.
|
|
193
|
+
*
|
|
194
|
+
* **Mutates `options` in place.**
|
|
195
|
+
*
|
|
196
|
+
* @param {object} options The options object, after applyAdvancedOptions
|
|
197
|
+
* @param {object} [context]
|
|
198
|
+
* @param {object} [context.projectConfig] Sanitized config file contents
|
|
199
|
+
* @param {boolean} [context.isSecureMode] Whether cdxgen runs in secure mode
|
|
200
|
+
* @param {string[]} [context.argv] Raw command-line arguments
|
|
201
|
+
* @param {object} [context.env] Environment variables
|
|
202
|
+
* @returns {void}
|
|
203
|
+
*/
|
|
204
|
+
export function applyOperatorToolingChoice(options, context = {}) {
|
|
205
|
+
const { projectConfig, argv, env } = context;
|
|
206
|
+
const secureMode = context.isSecureMode ?? isSecureMode;
|
|
207
|
+
const installChoice = operatorOptionChoice("install-deps", {
|
|
208
|
+
argv,
|
|
209
|
+
env,
|
|
210
|
+
boolean: true,
|
|
211
|
+
});
|
|
212
|
+
if (installChoice === false || (secureMode && installChoice !== true)) {
|
|
213
|
+
options.installDeps = false;
|
|
214
|
+
}
|
|
215
|
+
const configAsksIntrospect =
|
|
216
|
+
["true", "1"].includes(`${projectConfig?.introspect}`.toLowerCase()) ||
|
|
217
|
+
projectConfig?.profile === "introspect";
|
|
218
|
+
if (
|
|
219
|
+
options.introspect === true &&
|
|
220
|
+
configAsksIntrospect &&
|
|
221
|
+
operatorOptionChoice("introspect", { argv, env, boolean: true }) !== true &&
|
|
222
|
+
operatorOptionChoice("profile", { argv, env }) !== "introspect"
|
|
223
|
+
) {
|
|
224
|
+
options.introspectFromConfigFile = true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
127
228
|
/**
|
|
128
229
|
* Combine the custom metadata properties of every source (discussion 4391):
|
|
129
230
|
* the `--metadata-property` flag, the CDXGEN_METADATA_PROPERTY and
|
|
@@ -588,7 +689,9 @@ export function applyAdvancedOptions(options, context = {}) {
|
|
|
588
689
|
options.deep = true;
|
|
589
690
|
options.evidence = false;
|
|
590
691
|
options.includeCrypto = false;
|
|
591
|
-
|
|
692
|
+
// A profile may skip installs but never turn them back on once they
|
|
693
|
+
// were disabled, which would run the scanned project's code.
|
|
694
|
+
options.installDeps = !secureMode && options.installDeps !== false;
|
|
592
695
|
break;
|
|
593
696
|
case "deep-learning":
|
|
594
697
|
case "ml-deep":
|
|
@@ -596,7 +699,7 @@ export function applyAdvancedOptions(options, context = {}) {
|
|
|
596
699
|
options.deep = true;
|
|
597
700
|
options.evidence = true;
|
|
598
701
|
options.includeCrypto = true;
|
|
599
|
-
options.installDeps = !secureMode;
|
|
702
|
+
options.installDeps = !secureMode && options.installDeps !== false;
|
|
600
703
|
options.bomAudit = true;
|
|
601
704
|
break;
|
|
602
705
|
default:
|
|
@@ -619,7 +722,11 @@ export function applyAdvancedOptions(options, context = {}) {
|
|
|
619
722
|
"PREVIEW: post-build lifecycle SBOM generation is supported only for limited project types.",
|
|
620
723
|
});
|
|
621
724
|
}
|
|
622
|
-
|
|
725
|
+
// The project is already built, so installs are on only where they
|
|
726
|
+
// would have been anyway: a disabled install stays disabled.
|
|
727
|
+
if (options.installDeps !== false) {
|
|
728
|
+
options.installDeps = true;
|
|
729
|
+
}
|
|
623
730
|
break;
|
|
624
731
|
default:
|
|
625
732
|
break;
|