@cdxgen/cdxgen 13.5.0 → 13.7.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 +17 -10
- package/bin/audit.js +7 -4
- package/bin/cdxgen.js +260 -37
- package/bin/convert.js +146 -22
- package/bin/evinse.js +28 -3
- package/bin/repl.js +47 -3
- package/bin/sign.js +211 -34
- package/bin/tracebom.js +18 -6
- package/bin/validate.js +24 -3
- package/bin/verify.js +113 -5
- package/data/behavior-taxonomy.schema.json +1491 -0
- package/data/cyclonedx-2.0-bundled.schema.json +18606 -5528
- package/data/cyclonedx-2.0-cryptography-defs.schema.json +857 -0
- package/data/license-aliases.json +24 -2
- package/data/pqc-migration.json +239 -0
- package/data/remediations.json +176 -0
- package/data/rules/ai-bom.yaml +1 -1
- package/data/rules/brotli-decoder.yaml +107 -0
- package/data/rules/cbom-security.yaml +4 -3
- package/data/rules/package-integrity.yaml +28 -0
- package/data/rules/vscode-extensions.yaml +75 -0
- package/data/spdx-license-list.json +121 -7
- package/data/spdx-licenses.json +69 -0
- package/data/spdx.schema.json +845 -2
- package/lib/audit/index.js +25 -3
- package/lib/cli/bomAssembly.js +172 -4
- package/lib/cli/cliOptions.js +121 -17
- package/lib/cli/index.js +720 -902
- package/lib/cli/jsBom.js +156 -64
- package/lib/cli/jvmBom.js +602 -86
- package/lib/cli/managedBom.js +161 -19
- package/lib/cli/nativeBom.js +52 -5
- package/lib/core/boundedFile.js +344 -0
- package/lib/core/brotliProbe.js +182 -0
- package/lib/core/env.js +34 -0
- package/lib/core/fs.js +138 -3
- package/lib/core/globPatterns.js +218 -0
- package/lib/core/httpClient.js +98 -1
- package/lib/core/lockPaths.js +38 -0
- package/lib/core/paths.js +24 -1
- package/lib/core/processTree.js +100 -8
- package/lib/core/projectConfig.js +332 -25
- package/lib/core/toolRegistry.js +184 -0
- package/lib/ecosystems/cppEvidence.js +263 -106
- package/lib/ecosystems/cppIncludeResolver.js +16 -5
- package/lib/ecosystems/denoutils.js +2 -2
- package/lib/ecosystems/ecosystems.js +25 -10
- package/lib/ecosystems/gemHostProbe.js +301 -0
- package/lib/ecosystems/golem.js +3 -8
- package/lib/ecosystems/gradleutils.js +1909 -229
- package/lib/ecosystems/jsEvidence.js +90 -38
- package/lib/ecosystems/kosi.js +3 -5
- package/lib/ecosystems/npmVersionResolution.js +376 -0
- package/lib/ecosystems/parsers-bazel.js +107 -6
- package/lib/ecosystems/parsers-js.js +505 -22
- package/lib/ecosystems/parsers-misc.js +209 -20
- package/lib/ecosystems/parsers-python.js +178 -30
- package/lib/ecosystems/parsers-rust.js +117 -15
- package/lib/ecosystems/pythonutils.js +128 -2
- package/lib/ecosystems/remote/huggingface.js +22 -0
- package/lib/ecosystems/rubyutils.js +538 -31
- package/lib/ecosystems/rusi.js +2 -4
- package/lib/ecosystems/scalacliutils.js +2 -0
- package/lib/ecosystems/scalasem.js +798 -152
- package/lib/ecosystems/vendoredCode.js +237 -3
- package/lib/ecosystems/venvProbe.js +360 -0
- package/lib/evinser/evinser.js +536 -71
- package/lib/evinser/scalasem.js +5 -1
- package/lib/helpers/agenticToolutils.js +525 -94
- package/lib/helpers/bomSigner.js +43 -9
- package/lib/helpers/jssSigner.js +1276 -0
- package/lib/helpers/vsixutils.js +1574 -315
- package/lib/inventory/agentBlueprint.js +193 -0
- package/lib/inventory/agentToolNames.js +145 -0
- package/lib/inventory/aiCollector.js +153 -7
- package/lib/inventory/aiInventory.js +44 -8
- package/lib/inventory/aiProviders.js +324 -0
- package/lib/inventory/atomUtils.js +77 -0
- package/lib/inventory/bomUtils.js +8 -1
- package/lib/inventory/brotliDecoder.js +142 -0
- package/lib/inventory/buildToolRateLimit.js +1 -1
- package/lib/inventory/cbomutils.js +56 -7
- package/lib/inventory/ciParsers/githubActionsLock.js +821 -0
- package/lib/inventory/citations.js +31 -2
- package/lib/inventory/communityAiConfigParser.js +978 -80
- package/lib/inventory/cyclonedx20.js +152 -0
- package/lib/inventory/cyclonedx20Common.js +286 -0
- package/lib/inventory/cyclonedx20Derived.js +159 -0
- package/lib/inventory/cyclonedx20Parties.js +552 -0
- package/lib/inventory/cyclonedx20Read.js +768 -0
- package/lib/inventory/cyclonedx20ReadCommon.js +374 -0
- package/lib/inventory/cyclonedx20ReadComponents.js +692 -0
- package/lib/inventory/cyclonedx20ReadContext.js +380 -0
- package/lib/inventory/cyclonedx20ReadEvidence.js +466 -0
- package/lib/inventory/cyclonedx20ReadSections.js +599 -0
- package/lib/inventory/cyclonedx20Render.js +766 -0
- package/lib/inventory/cyclonedx20RenderComponents.js +716 -0
- package/lib/inventory/cyclonedx20RenderDefinitions.js +405 -0
- package/lib/inventory/cyclonedx20RenderEvidence.js +726 -0
- package/lib/inventory/cyclonedx20RenderHardware.js +203 -0
- package/lib/inventory/cyclonedx20RenderPatents.js +174 -0
- package/lib/inventory/cyclonedx20RenderRefIds.js +314 -0
- package/lib/inventory/cyclonedx20RenderSections.js +499 -0
- package/lib/inventory/cyclonedx20Tables.js +594 -0
- package/lib/inventory/deps.js +141 -13
- package/lib/inventory/dosai.js +375 -6
- package/lib/inventory/dosaiParsers.js +3 -6
- package/lib/inventory/dotnetRuntime.js +367 -0
- package/lib/inventory/ecosystemFormulationParsers.js +979 -0
- package/lib/inventory/envcontext.js +436 -48
- package/lib/inventory/evidenceUtils.js +13 -1
- package/lib/inventory/fetchBatch.js +1 -1
- package/lib/inventory/formulationParsers.js +124 -14
- package/lib/inventory/gtfobins.js +13 -0
- package/lib/inventory/hbom.js +45 -6
- package/lib/inventory/hbomLoader.js +166 -0
- package/lib/inventory/hostRuntimeProbe.js +686 -0
- package/lib/inventory/jvmLocalRepos.js +9 -2
- package/lib/inventory/jvmToolEnv.js +29 -0
- package/lib/inventory/licenseEnhancer.js +12 -0
- package/lib/inventory/mavenCentralMirror.js +534 -0
- package/lib/inventory/mcpConfigParser.js +5 -0
- package/lib/inventory/nodeBuildInfo.js +218 -0
- package/lib/inventory/nodeHostProbe.js +202 -0
- package/lib/inventory/occurrenceKey.js +90 -0
- package/lib/inventory/osPackageResolver.js +182 -0
- package/lib/inventory/phpBuildInfo.js +10 -59
- package/lib/inventory/phpHostProbe.js +32 -488
- package/lib/inventory/pqcMigration.js +426 -0
- package/lib/inventory/rubyBuildInfo.js +972 -0
- package/lib/inventory/rubyHostProbe.js +218 -0
- package/lib/inventory/rustFormulationParser.js +21 -10
- package/lib/inventory/scalaCoords.js +4 -3
- package/lib/inventory/scalaDedupe.js +440 -0
- package/lib/inventory/source.js +114 -8
- package/lib/managers/binary.js +337 -3
- package/lib/managers/docker.js +79 -0
- package/lib/parsers/huggingfaceManifest.js +9 -1
- package/lib/parsers/huggingfaceUtils.js +18 -0
- package/lib/parsers/kiroPermissions.js +166 -0
- package/lib/parsers/largeJson.js +28 -11
- package/lib/parsers/vscodeExtensionId.js +183 -0
- package/lib/server/server.js +48 -35
- package/lib/stages/postgen/postgen.js +41 -1
- package/lib/stages/postgen/ruleEngine.js +13 -5
- package/lib/stages/postgen/specVersionCompat.js +76 -0
- package/lib/stages/pregen/envAudit.js +1 -0
- package/lib/stages/pregen/pregen.js +114 -57
- package/lib/validator/bomValidator.js +14 -2
- package/lib/validator/complianceEngine.js +30 -3
- package/lib/validator/complianceRules.js +1416 -4
- package/lib/validator/generated/validate-1.6.mjs +1 -1
- package/lib/validator/generated/validate-1.7.mjs +1 -1
- package/lib/validator/generated/validate-2.0.mjs +57554 -13851
- package/lib/validator/index.js +49 -8
- package/lib/validator/reporters/json.js +6 -0
- package/package.json +11 -10
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts +6 -2
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +29 -1
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +6 -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 +3 -18
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +15 -0
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/boundedFile.d.ts +100 -0
- package/types/lib/core/boundedFile.d.ts.map +1 -0
- package/types/lib/core/brotliProbe.d.ts +37 -0
- package/types/lib/core/brotliProbe.d.ts.map +1 -0
- package/types/lib/core/env.d.ts +14 -0
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +4 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/globPatterns.d.ts +70 -0
- package/types/lib/core/globPatterns.d.ts.map +1 -0
- package/types/lib/core/httpClient.d.ts +24 -0
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/lockPaths.d.ts +19 -0
- package/types/lib/core/lockPaths.d.ts.map +1 -0
- package/types/lib/core/paths.d.ts +9 -0
- package/types/lib/core/paths.d.ts.map +1 -1
- package/types/lib/core/processTree.d.ts +17 -4
- package/types/lib/core/processTree.d.ts.map +1 -1
- package/types/lib/core/projectConfig.d.ts +47 -8
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/toolRegistry.d.ts +36 -0
- package/types/lib/core/toolRegistry.d.ts.map +1 -0
- package/types/lib/ecosystems/cppEvidence.d.ts +40 -13
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts +2 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/gemHostProbe.d.ts +28 -0
- package/types/lib/ecosystems/gemHostProbe.d.ts.map +1 -0
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +294 -20
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts +14 -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/npmVersionResolution.d.ts +119 -0
- package/types/lib/ecosystems/npmVersionResolution.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-bazel.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +17 -20
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +19 -0
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +10 -0
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +19 -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 +144 -12
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalasem.d.ts +58 -16
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -1
- package/types/lib/ecosystems/vendoredCode.d.ts +26 -0
- package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -1
- package/types/lib/ecosystems/venvProbe.d.ts +40 -0
- package/types/lib/ecosystems/venvProbe.d.ts.map +1 -0
- package/types/lib/evinser/evinser.d.ts +120 -13
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/scalasem.d.ts.map +1 -1
- package/types/lib/helpers/agenticToolutils.d.ts +53 -19
- package/types/lib/helpers/agenticToolutils.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +20 -3
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/helpers/jssSigner.d.ts +288 -0
- package/types/lib/helpers/jssSigner.d.ts.map +1 -0
- package/types/lib/helpers/vsixutils.d.ts +303 -19
- package/types/lib/helpers/vsixutils.d.ts.map +1 -1
- package/types/lib/inventory/agentBlueprint.d.ts +70 -0
- package/types/lib/inventory/agentBlueprint.d.ts.map +1 -0
- package/types/lib/inventory/agentToolNames.d.ts +51 -0
- package/types/lib/inventory/agentToolNames.d.ts.map +1 -0
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/aiInventory.d.ts.map +1 -1
- package/types/lib/inventory/aiProviders.d.ts +85 -0
- package/types/lib/inventory/aiProviders.d.ts.map +1 -0
- package/types/lib/inventory/atomUtils.d.ts +19 -0
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/bomUtils.d.ts.map +1 -1
- package/types/lib/inventory/brotliDecoder.d.ts +58 -0
- package/types/lib/inventory/brotliDecoder.d.ts.map +1 -0
- package/types/lib/inventory/cbomutils.d.ts +17 -0
- package/types/lib/inventory/cbomutils.d.ts.map +1 -1
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts +101 -0
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts.map +1 -0
- package/types/lib/inventory/citations.d.ts +5 -0
- package/types/lib/inventory/citations.d.ts.map +1 -1
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/cyclonedx20.d.ts +99 -0
- package/types/lib/inventory/cyclonedx20.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts +102 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts +74 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts +91 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts +51 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts +69 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts +77 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts +118 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts +40 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts +53 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts +73 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts +29 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts +110 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts +42 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts +26 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts +55 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts +134 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts.map +1 -0
- package/types/lib/inventory/deps.d.ts +35 -2
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +36 -1
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
- package/types/lib/inventory/dotnetRuntime.d.ts +91 -0
- package/types/lib/inventory/dotnetRuntime.d.ts.map +1 -0
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts +73 -0
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts.map +1 -0
- package/types/lib/inventory/envcontext.d.ts +74 -12
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/gtfobins.d.ts.map +1 -1
- package/types/lib/inventory/hbom.d.ts +11 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomLoader.d.ts +54 -0
- package/types/lib/inventory/hbomLoader.d.ts.map +1 -1
- package/types/lib/inventory/hostRuntimeProbe.d.ts +44 -0
- package/types/lib/inventory/hostRuntimeProbe.d.ts.map +1 -0
- package/types/lib/inventory/jvmLocalRepos.d.ts +5 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -1
- package/types/lib/inventory/jvmToolEnv.d.ts +12 -0
- package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -1
- package/types/lib/inventory/licenseEnhancer.d.ts.map +1 -1
- package/types/lib/inventory/mavenCentralMirror.d.ts +170 -0
- package/types/lib/inventory/mavenCentralMirror.d.ts.map +1 -0
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/nodeBuildInfo.d.ts +95 -0
- package/types/lib/inventory/nodeBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/nodeHostProbe.d.ts +15 -0
- package/types/lib/inventory/nodeHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/occurrenceKey.d.ts +52 -0
- package/types/lib/inventory/occurrenceKey.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +38 -0
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -1
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -1
- package/types/lib/inventory/pqcMigration.d.ts +84 -0
- package/types/lib/inventory/pqcMigration.d.ts.map +1 -0
- package/types/lib/inventory/rubyBuildInfo.d.ts +271 -0
- package/types/lib/inventory/rubyBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/rubyHostProbe.d.ts +47 -0
- package/types/lib/inventory/rubyHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/rustFormulationParser.d.ts +7 -2
- package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/scalaCoords.d.ts.map +1 -1
- package/types/lib/inventory/scalaDedupe.d.ts +43 -0
- package/types/lib/inventory/scalaDedupe.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +25 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- 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/parsers/huggingfaceManifest.d.ts +10 -1
- package/types/lib/parsers/huggingfaceManifest.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceUtils.d.ts +12 -0
- package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
- package/types/lib/parsers/kiroPermissions.d.ts +62 -0
- package/types/lib/parsers/kiroPermissions.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +4 -3
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/parsers/vscodeExtensionId.d.ts +48 -0
- package/types/lib/parsers/vscodeExtensionId.d.ts.map +1 -0
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts +7 -0
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts +25 -0
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +12 -8
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts +5 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/complianceEngine.d.ts +4 -4
- package/types/lib/validator/complianceEngine.d.ts.map +1 -1
- package/types/lib/validator/complianceRules.d.ts +14 -2
- package/types/lib/validator/complianceRules.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +10 -0
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
package/lib/inventory/deps.js
CHANGED
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
getTmpDir,
|
|
14
14
|
multiChecksumFile,
|
|
15
15
|
safeExistsSync,
|
|
16
|
+
safeMkdirSync,
|
|
16
17
|
safeMkdtempSync,
|
|
17
18
|
safeRmSync,
|
|
18
19
|
safeSpawnSync,
|
|
20
|
+
safeWriteSync,
|
|
19
21
|
} from "../core/fs.js";
|
|
20
22
|
import { isWin } from "../core/paths.js";
|
|
21
23
|
import { xml2js } from "../parsers/xml.js";
|
|
@@ -25,11 +27,19 @@ import {
|
|
|
25
27
|
mavenLocalRepositories,
|
|
26
28
|
splitArtifactFileName,
|
|
27
29
|
} from "./jvmLocalRepos.js";
|
|
30
|
+
import {
|
|
31
|
+
mavenMirrorSettingsArgs,
|
|
32
|
+
mavenWrapperMirrorEnv,
|
|
33
|
+
} from "./mavenCentralMirror.js";
|
|
28
34
|
import { pypiBomRef } from "./purl.js";
|
|
29
35
|
import { findLicenseId, spdxLicenses } from "./spdx.js";
|
|
30
36
|
|
|
31
37
|
const jarNSMapping_cache = new Map();
|
|
32
38
|
|
|
39
|
+
// The largest classes.jar on Google's Maven repository is a few tens of MiB,
|
|
40
|
+
// so this bound only stops an archive that claims an implausible size.
|
|
41
|
+
const MAX_AAR_INNER_JAR_BYTES = 256 * 1024 * 1024;
|
|
42
|
+
|
|
33
43
|
/**
|
|
34
44
|
* Whether a jar holds sources or javadoc rather than classes.
|
|
35
45
|
*
|
|
@@ -136,11 +146,13 @@ export async function collectMvnDependencies(
|
|
|
136
146
|
const addArgs = parseMavenArgs(readEnvironmentVariable("MVN_ARGS"));
|
|
137
147
|
copyArgs = copyArgs.concat(addArgs);
|
|
138
148
|
}
|
|
149
|
+
copyArgs = copyArgs.concat(mavenMirrorSettingsArgs());
|
|
139
150
|
if (basePath && basePath !== MAVEN_CACHE_DIR) {
|
|
140
151
|
console.log(`Executing '${mavenCmd} in ${basePath}`);
|
|
141
152
|
const result = safeSpawnSync(mavenCmd, copyArgs, {
|
|
142
153
|
cwd: basePath,
|
|
143
154
|
shell: isWin,
|
|
155
|
+
env: { ...process.env, ...mavenWrapperMirrorEnv() },
|
|
144
156
|
});
|
|
145
157
|
const rateLimited = noteBuildToolRateLimit(
|
|
146
158
|
"maven",
|
|
@@ -187,9 +199,10 @@ export async function collectMvnDependencies(
|
|
|
187
199
|
}
|
|
188
200
|
|
|
189
201
|
/**
|
|
190
|
-
* Method to collect class names from all jars in a
|
|
202
|
+
* Method to collect class names from all jars and Android libraries in a
|
|
203
|
+
* directory
|
|
191
204
|
*
|
|
192
|
-
* @param {string} jarPath Path containing jars
|
|
205
|
+
* @param {string} jarPath Path containing jars, or a single jar or aar file
|
|
193
206
|
* @param {object} pomPathMap Map containing jar to pom names. Required to successfully parse gradle cache.
|
|
194
207
|
*
|
|
195
208
|
* @return object containing jar name and class list
|
|
@@ -207,20 +220,21 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
207
220
|
)}`;
|
|
208
221
|
}
|
|
209
222
|
// Parse jar files to get class names
|
|
210
|
-
const jarFiles =
|
|
223
|
+
const jarFiles = /\.(jar|aar)$/i.test(jarPath)
|
|
211
224
|
? [jarPath]
|
|
212
|
-
: getAllFiles(jarPath, "**/*.jar");
|
|
225
|
+
: getAllFiles(jarPath, "**/*.{jar,aar}");
|
|
213
226
|
if (jarFiles?.length) {
|
|
214
227
|
for (const jf of jarFiles) {
|
|
215
228
|
const jarName = basename(jf);
|
|
229
|
+
const isAar = jarName.toLowerCase().endsWith(".aar");
|
|
216
230
|
// Sources and javadoc jars hold no runtime classes. Reading them would
|
|
217
231
|
// attach their hashes to the main artifact's purl.
|
|
218
232
|
if (isDocumentationJar(jarName)) {
|
|
219
233
|
continue;
|
|
220
234
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
// Only the extension is replaced, never a match earlier in the path.
|
|
236
|
+
const toPom = (file) => `${file.slice(0, -".jar".length)}.pom`;
|
|
237
|
+
let pomname = pomPathMap[toPom(jarName)] || toPom(jf);
|
|
224
238
|
let pomData;
|
|
225
239
|
let purl;
|
|
226
240
|
let manifestLicenses;
|
|
@@ -229,7 +243,12 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
229
243
|
let searchDir = dirname(jf);
|
|
230
244
|
// in case of gradle, there would be hash directory that is different for jar vs pom
|
|
231
245
|
// so we need to start search from a level up
|
|
232
|
-
if (
|
|
246
|
+
if (
|
|
247
|
+
searchDir.includes(join(".gradle", "caches")) ||
|
|
248
|
+
// A copied cache, or one reached through GRADLE_CACHE_DIR, keeps
|
|
249
|
+
// the files-2.1 directory without the .gradle parent.
|
|
250
|
+
searchDir.split(/[\\/]/).includes("files-2.1")
|
|
251
|
+
) {
|
|
233
252
|
searchDir = join(searchDir, "..");
|
|
234
253
|
}
|
|
235
254
|
const pomSearch = getAllFiles(searchDir, "**/*.pom");
|
|
@@ -256,7 +275,9 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
256
275
|
}
|
|
257
276
|
} else {
|
|
258
277
|
const coordinates = inferMavenCoordinatesFromPath(jf);
|
|
259
|
-
|
|
278
|
+
// An aar gets the same type=jar purl the Gradle dependency tree gives
|
|
279
|
+
// it, so the two entries merge into one component.
|
|
280
|
+
if (coordinates && ["jar", "aar"].includes(coordinates.extension)) {
|
|
260
281
|
purl = jarPurl(
|
|
261
282
|
coordinates.group,
|
|
262
283
|
coordinates.name,
|
|
@@ -268,8 +289,9 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
268
289
|
// descriptor, so its metadata and manifest licence are read here,
|
|
269
290
|
// before any remote lookup. Only a jar whose path names its
|
|
270
291
|
// coordinates is read: they choose its descriptor, and an entry
|
|
271
|
-
// without a purl never becomes a component.
|
|
272
|
-
|
|
292
|
+
// without a purl never becomes a component. An aar keeps no
|
|
293
|
+
// descriptor of its own; its POM sits beside it in the cache.
|
|
294
|
+
if (purl && !isAar) {
|
|
273
295
|
const embedded = await readEmbeddedJarMetadata(jf, coordinates);
|
|
274
296
|
if (embedded?.pomXml) {
|
|
275
297
|
try {
|
|
@@ -294,7 +316,9 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
294
316
|
console.log(`Parsing ${jf}`);
|
|
295
317
|
}
|
|
296
318
|
const [nsList, hashValues] = await Promise.all([
|
|
297
|
-
|
|
319
|
+
// An aar is hashed as published, over the aar file itself; its
|
|
320
|
+
// classes come from the jars it holds.
|
|
321
|
+
isAar ? getAarClasses(jf) : getJarClasses(jf),
|
|
298
322
|
multiChecksumFile(["md5", "sha1", "sha256", "sha512"], jf).catch(
|
|
299
323
|
() => undefined,
|
|
300
324
|
),
|
|
@@ -330,12 +354,41 @@ export async function collectJarNS(jarPath, pomPathMap = {}) {
|
|
|
330
354
|
}
|
|
331
355
|
} else {
|
|
332
356
|
console.log(
|
|
333
|
-
`${jarPath} did not contain any jars. Try building the project to improve the BOM precision.`,
|
|
357
|
+
`${jarPath} did not contain any jars or aar files. Try building the project to improve the BOM precision.`,
|
|
334
358
|
);
|
|
335
359
|
}
|
|
336
360
|
return jarNSMapping;
|
|
337
361
|
}
|
|
338
362
|
|
|
363
|
+
/**
|
|
364
|
+
* The jar namespace map entries of components a jar scan produced, in the
|
|
365
|
+
* shape {@link collectJarNS} writes (`{ namespaces: string[] }`), from their
|
|
366
|
+
* `internal:Namespaces` properties. The scan reads each jar from a temporary
|
|
367
|
+
* copy, so no `jarFile` is recorded. Purls `existing` already maps keep the
|
|
368
|
+
* entry they have, which names the jar it was read from.
|
|
369
|
+
*
|
|
370
|
+
* @param {Object[]} components Components with `internal:Namespaces` properties
|
|
371
|
+
* @param {Object} [existing] Jar namespace map already collected
|
|
372
|
+
* @returns {Object} New entries keyed by purl
|
|
373
|
+
*/
|
|
374
|
+
export function namespaceMappingOfComponents(components, existing = {}) {
|
|
375
|
+
const mapping = {};
|
|
376
|
+
for (const component of components || []) {
|
|
377
|
+
if (!component?.purl || existing[component.purl]) {
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
const namespaces = (component.properties || [])
|
|
381
|
+
.filter((property) => property.name === "internal:Namespaces")
|
|
382
|
+
.flatMap((property) => String(property.value || "").split("\n"))
|
|
383
|
+
.map((namespace) => namespace.trim())
|
|
384
|
+
.filter(Boolean);
|
|
385
|
+
if (namespaces.length) {
|
|
386
|
+
mapping[component.purl] = { namespaces: [...new Set(namespaces)] };
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return mapping;
|
|
390
|
+
}
|
|
391
|
+
|
|
339
392
|
/**
|
|
340
393
|
* Convert a JAR namespace mapping (produced by {@link collectJarNS}) into an array
|
|
341
394
|
* of CycloneDX package component objects.
|
|
@@ -1101,6 +1154,81 @@ export async function getJarClasses(jarFile) {
|
|
|
1101
1154
|
return retList;
|
|
1102
1155
|
}
|
|
1103
1156
|
|
|
1157
|
+
/**
|
|
1158
|
+
* Method to get the classes of an Android library. An `.aar` keeps its code
|
|
1159
|
+
* in `classes.jar` at its root and any number of further jars under `libs/`,
|
|
1160
|
+
* each of which is read in turn.
|
|
1161
|
+
*
|
|
1162
|
+
* Each inner jar is unpacked to a temporary file, so in dry run mode, which
|
|
1163
|
+
* blocks those writes, an aar yields no classes. An inner jar that declares
|
|
1164
|
+
* more than `maxInnerJarBytes` uncompressed is skipped without being
|
|
1165
|
+
* decompressed, because the whole entry is held in memory while it is copied.
|
|
1166
|
+
*
|
|
1167
|
+
* @param {string} aarFile Aar file to read
|
|
1168
|
+
* @param {Object} [opts] Options
|
|
1169
|
+
* @param {number} [opts.maxInnerJarBytes] Uncompressed size bound for each
|
|
1170
|
+
* inner jar. Defaults to 256 MiB.
|
|
1171
|
+
*
|
|
1172
|
+
* @returns {Promise<string[]>} Sorted class names of every jar inside
|
|
1173
|
+
*/
|
|
1174
|
+
export async function getAarClasses(
|
|
1175
|
+
aarFile,
|
|
1176
|
+
{ maxInnerJarBytes = MAX_AAR_INNER_JAR_BYTES } = {},
|
|
1177
|
+
) {
|
|
1178
|
+
const classes = new Set();
|
|
1179
|
+
let zip;
|
|
1180
|
+
let tempDir;
|
|
1181
|
+
try {
|
|
1182
|
+
zip = new StreamZip.async({ file: aarFile });
|
|
1183
|
+
const innerJars = Object.values(await zip.entries())
|
|
1184
|
+
.filter(
|
|
1185
|
+
(entry) =>
|
|
1186
|
+
!entry.isDirectory &&
|
|
1187
|
+
(entry.name === "classes.jar" ||
|
|
1188
|
+
(entry.name.startsWith("libs/") && entry.name.endsWith(".jar"))),
|
|
1189
|
+
)
|
|
1190
|
+
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
1191
|
+
for (const entry of innerJars) {
|
|
1192
|
+
if (entry.size > maxInnerJarBytes) {
|
|
1193
|
+
if (DEBUG_MODE) {
|
|
1194
|
+
console.log(
|
|
1195
|
+
`Skipping ${entry.name} in ${aarFile}: ${entry.size} bytes exceeds the ${maxInnerJarBytes} byte limit.`,
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
continue;
|
|
1199
|
+
}
|
|
1200
|
+
tempDir ||= safeMkdtempSync(join(getTmpDir(), "aar-classes-"));
|
|
1201
|
+
// Entry names use forward slashes on every platform. node-stream-zip
|
|
1202
|
+
// rejects names with "..", a backslash or an absolute prefix, so the
|
|
1203
|
+
// file stays inside tempDir.
|
|
1204
|
+
const innerJar = join(tempDir, ...entry.name.split("/"));
|
|
1205
|
+
safeMkdirSync(dirname(innerJar), { recursive: true });
|
|
1206
|
+
safeWriteSync(innerJar, await zip.entryData(entry.name));
|
|
1207
|
+
// The write is skipped in dry run mode or without write permission.
|
|
1208
|
+
if (!safeExistsSync(innerJar)) {
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
for (const cls of await getJarClasses(innerJar)) {
|
|
1212
|
+
classes.add(cls);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
} catch (err) {
|
|
1216
|
+
if (DEBUG_MODE) {
|
|
1217
|
+
console.log(`Unable to read the jars inside ${aarFile}: ${err.message}`);
|
|
1218
|
+
}
|
|
1219
|
+
} finally {
|
|
1220
|
+
if (tempDir) {
|
|
1221
|
+
safeRmSync(tempDir, { recursive: true, force: true });
|
|
1222
|
+
}
|
|
1223
|
+
try {
|
|
1224
|
+
await zip?.close();
|
|
1225
|
+
} catch (_err) {
|
|
1226
|
+
// An archive that failed to open reports its close as well.
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
return [...classes].sort();
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1104
1232
|
/**
|
|
1105
1233
|
* Recursively flatten a Python package's transitive dependencies into the
|
|
1106
1234
|
* dependencies map and flat package list.
|