@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.
Files changed (380) hide show
  1. package/README.md +17 -10
  2. package/bin/audit.js +7 -4
  3. package/bin/cdxgen.js +260 -37
  4. package/bin/convert.js +146 -22
  5. package/bin/evinse.js +28 -3
  6. package/bin/repl.js +47 -3
  7. package/bin/sign.js +211 -34
  8. package/bin/tracebom.js +18 -6
  9. package/bin/validate.js +24 -3
  10. package/bin/verify.js +113 -5
  11. package/data/behavior-taxonomy.schema.json +1491 -0
  12. package/data/cyclonedx-2.0-bundled.schema.json +18606 -5528
  13. package/data/cyclonedx-2.0-cryptography-defs.schema.json +857 -0
  14. package/data/license-aliases.json +24 -2
  15. package/data/pqc-migration.json +239 -0
  16. package/data/remediations.json +176 -0
  17. package/data/rules/ai-bom.yaml +1 -1
  18. package/data/rules/brotli-decoder.yaml +107 -0
  19. package/data/rules/cbom-security.yaml +4 -3
  20. package/data/rules/package-integrity.yaml +28 -0
  21. package/data/rules/vscode-extensions.yaml +75 -0
  22. package/data/spdx-license-list.json +121 -7
  23. package/data/spdx-licenses.json +69 -0
  24. package/data/spdx.schema.json +845 -2
  25. package/lib/audit/index.js +25 -3
  26. package/lib/cli/bomAssembly.js +172 -4
  27. package/lib/cli/cliOptions.js +121 -17
  28. package/lib/cli/index.js +720 -902
  29. package/lib/cli/jsBom.js +156 -64
  30. package/lib/cli/jvmBom.js +602 -86
  31. package/lib/cli/managedBom.js +161 -19
  32. package/lib/cli/nativeBom.js +52 -5
  33. package/lib/core/boundedFile.js +344 -0
  34. package/lib/core/brotliProbe.js +182 -0
  35. package/lib/core/env.js +34 -0
  36. package/lib/core/fs.js +138 -3
  37. package/lib/core/globPatterns.js +218 -0
  38. package/lib/core/httpClient.js +98 -1
  39. package/lib/core/lockPaths.js +38 -0
  40. package/lib/core/paths.js +24 -1
  41. package/lib/core/processTree.js +100 -8
  42. package/lib/core/projectConfig.js +332 -25
  43. package/lib/core/toolRegistry.js +184 -0
  44. package/lib/ecosystems/cppEvidence.js +263 -106
  45. package/lib/ecosystems/cppIncludeResolver.js +16 -5
  46. package/lib/ecosystems/denoutils.js +2 -2
  47. package/lib/ecosystems/ecosystems.js +25 -10
  48. package/lib/ecosystems/gemHostProbe.js +301 -0
  49. package/lib/ecosystems/golem.js +3 -8
  50. package/lib/ecosystems/gradleutils.js +1909 -229
  51. package/lib/ecosystems/jsEvidence.js +90 -38
  52. package/lib/ecosystems/kosi.js +3 -5
  53. package/lib/ecosystems/npmVersionResolution.js +376 -0
  54. package/lib/ecosystems/parsers-bazel.js +107 -6
  55. package/lib/ecosystems/parsers-js.js +505 -22
  56. package/lib/ecosystems/parsers-misc.js +209 -20
  57. package/lib/ecosystems/parsers-python.js +178 -30
  58. package/lib/ecosystems/parsers-rust.js +117 -15
  59. package/lib/ecosystems/pythonutils.js +128 -2
  60. package/lib/ecosystems/remote/huggingface.js +22 -0
  61. package/lib/ecosystems/rubyutils.js +538 -31
  62. package/lib/ecosystems/rusi.js +2 -4
  63. package/lib/ecosystems/scalacliutils.js +2 -0
  64. package/lib/ecosystems/scalasem.js +798 -152
  65. package/lib/ecosystems/vendoredCode.js +237 -3
  66. package/lib/ecosystems/venvProbe.js +360 -0
  67. package/lib/evinser/evinser.js +536 -71
  68. package/lib/evinser/scalasem.js +5 -1
  69. package/lib/helpers/agenticToolutils.js +525 -94
  70. package/lib/helpers/bomSigner.js +43 -9
  71. package/lib/helpers/jssSigner.js +1276 -0
  72. package/lib/helpers/vsixutils.js +1574 -315
  73. package/lib/inventory/agentBlueprint.js +193 -0
  74. package/lib/inventory/agentToolNames.js +145 -0
  75. package/lib/inventory/aiCollector.js +153 -7
  76. package/lib/inventory/aiInventory.js +44 -8
  77. package/lib/inventory/aiProviders.js +324 -0
  78. package/lib/inventory/atomUtils.js +77 -0
  79. package/lib/inventory/bomUtils.js +8 -1
  80. package/lib/inventory/brotliDecoder.js +142 -0
  81. package/lib/inventory/buildToolRateLimit.js +1 -1
  82. package/lib/inventory/cbomutils.js +56 -7
  83. package/lib/inventory/ciParsers/githubActionsLock.js +821 -0
  84. package/lib/inventory/citations.js +31 -2
  85. package/lib/inventory/communityAiConfigParser.js +978 -80
  86. package/lib/inventory/cyclonedx20.js +152 -0
  87. package/lib/inventory/cyclonedx20Common.js +286 -0
  88. package/lib/inventory/cyclonedx20Derived.js +159 -0
  89. package/lib/inventory/cyclonedx20Parties.js +552 -0
  90. package/lib/inventory/cyclonedx20Read.js +768 -0
  91. package/lib/inventory/cyclonedx20ReadCommon.js +374 -0
  92. package/lib/inventory/cyclonedx20ReadComponents.js +692 -0
  93. package/lib/inventory/cyclonedx20ReadContext.js +380 -0
  94. package/lib/inventory/cyclonedx20ReadEvidence.js +466 -0
  95. package/lib/inventory/cyclonedx20ReadSections.js +599 -0
  96. package/lib/inventory/cyclonedx20Render.js +766 -0
  97. package/lib/inventory/cyclonedx20RenderComponents.js +716 -0
  98. package/lib/inventory/cyclonedx20RenderDefinitions.js +405 -0
  99. package/lib/inventory/cyclonedx20RenderEvidence.js +726 -0
  100. package/lib/inventory/cyclonedx20RenderHardware.js +203 -0
  101. package/lib/inventory/cyclonedx20RenderPatents.js +174 -0
  102. package/lib/inventory/cyclonedx20RenderRefIds.js +314 -0
  103. package/lib/inventory/cyclonedx20RenderSections.js +499 -0
  104. package/lib/inventory/cyclonedx20Tables.js +594 -0
  105. package/lib/inventory/deps.js +141 -13
  106. package/lib/inventory/dosai.js +375 -6
  107. package/lib/inventory/dosaiParsers.js +3 -6
  108. package/lib/inventory/dotnetRuntime.js +367 -0
  109. package/lib/inventory/ecosystemFormulationParsers.js +979 -0
  110. package/lib/inventory/envcontext.js +436 -48
  111. package/lib/inventory/evidenceUtils.js +13 -1
  112. package/lib/inventory/fetchBatch.js +1 -1
  113. package/lib/inventory/formulationParsers.js +124 -14
  114. package/lib/inventory/gtfobins.js +13 -0
  115. package/lib/inventory/hbom.js +45 -6
  116. package/lib/inventory/hbomLoader.js +166 -0
  117. package/lib/inventory/hostRuntimeProbe.js +686 -0
  118. package/lib/inventory/jvmLocalRepos.js +9 -2
  119. package/lib/inventory/jvmToolEnv.js +29 -0
  120. package/lib/inventory/licenseEnhancer.js +12 -0
  121. package/lib/inventory/mavenCentralMirror.js +534 -0
  122. package/lib/inventory/mcpConfigParser.js +5 -0
  123. package/lib/inventory/nodeBuildInfo.js +218 -0
  124. package/lib/inventory/nodeHostProbe.js +202 -0
  125. package/lib/inventory/occurrenceKey.js +90 -0
  126. package/lib/inventory/osPackageResolver.js +182 -0
  127. package/lib/inventory/phpBuildInfo.js +10 -59
  128. package/lib/inventory/phpHostProbe.js +32 -488
  129. package/lib/inventory/pqcMigration.js +426 -0
  130. package/lib/inventory/rubyBuildInfo.js +972 -0
  131. package/lib/inventory/rubyHostProbe.js +218 -0
  132. package/lib/inventory/rustFormulationParser.js +21 -10
  133. package/lib/inventory/scalaCoords.js +4 -3
  134. package/lib/inventory/scalaDedupe.js +440 -0
  135. package/lib/inventory/source.js +114 -8
  136. package/lib/managers/binary.js +337 -3
  137. package/lib/managers/docker.js +79 -0
  138. package/lib/parsers/huggingfaceManifest.js +9 -1
  139. package/lib/parsers/huggingfaceUtils.js +18 -0
  140. package/lib/parsers/kiroPermissions.js +166 -0
  141. package/lib/parsers/largeJson.js +28 -11
  142. package/lib/parsers/vscodeExtensionId.js +183 -0
  143. package/lib/server/server.js +48 -35
  144. package/lib/stages/postgen/postgen.js +41 -1
  145. package/lib/stages/postgen/ruleEngine.js +13 -5
  146. package/lib/stages/postgen/specVersionCompat.js +76 -0
  147. package/lib/stages/pregen/envAudit.js +1 -0
  148. package/lib/stages/pregen/pregen.js +114 -57
  149. package/lib/validator/bomValidator.js +14 -2
  150. package/lib/validator/complianceEngine.js +30 -3
  151. package/lib/validator/complianceRules.js +1416 -4
  152. package/lib/validator/generated/validate-1.6.mjs +1 -1
  153. package/lib/validator/generated/validate-1.7.mjs +1 -1
  154. package/lib/validator/generated/validate-2.0.mjs +57554 -13851
  155. package/lib/validator/index.js +49 -8
  156. package/lib/validator/reporters/json.js +6 -0
  157. package/package.json +11 -10
  158. package/types/bin/repl.d.ts.map +1 -1
  159. package/types/lib/audit/index.d.ts +6 -2
  160. package/types/lib/audit/index.d.ts.map +1 -1
  161. package/types/lib/cli/bomAssembly.d.ts +29 -1
  162. package/types/lib/cli/bomAssembly.d.ts.map +1 -1
  163. package/types/lib/cli/cliOptions.d.ts +6 -0
  164. package/types/lib/cli/cliOptions.d.ts.map +1 -1
  165. package/types/lib/cli/index.d.ts.map +1 -1
  166. package/types/lib/cli/jsBom.d.ts +3 -18
  167. package/types/lib/cli/jsBom.d.ts.map +1 -1
  168. package/types/lib/cli/jvmBom.d.ts +15 -0
  169. package/types/lib/cli/jvmBom.d.ts.map +1 -1
  170. package/types/lib/cli/managedBom.d.ts.map +1 -1
  171. package/types/lib/cli/nativeBom.d.ts.map +1 -1
  172. package/types/lib/core/boundedFile.d.ts +100 -0
  173. package/types/lib/core/boundedFile.d.ts.map +1 -0
  174. package/types/lib/core/brotliProbe.d.ts +37 -0
  175. package/types/lib/core/brotliProbe.d.ts.map +1 -0
  176. package/types/lib/core/env.d.ts +14 -0
  177. package/types/lib/core/env.d.ts.map +1 -1
  178. package/types/lib/core/fs.d.ts +4 -0
  179. package/types/lib/core/fs.d.ts.map +1 -1
  180. package/types/lib/core/globPatterns.d.ts +70 -0
  181. package/types/lib/core/globPatterns.d.ts.map +1 -0
  182. package/types/lib/core/httpClient.d.ts +24 -0
  183. package/types/lib/core/httpClient.d.ts.map +1 -1
  184. package/types/lib/core/lockPaths.d.ts +19 -0
  185. package/types/lib/core/lockPaths.d.ts.map +1 -0
  186. package/types/lib/core/paths.d.ts +9 -0
  187. package/types/lib/core/paths.d.ts.map +1 -1
  188. package/types/lib/core/processTree.d.ts +17 -4
  189. package/types/lib/core/processTree.d.ts.map +1 -1
  190. package/types/lib/core/projectConfig.d.ts +47 -8
  191. package/types/lib/core/projectConfig.d.ts.map +1 -1
  192. package/types/lib/core/toolRegistry.d.ts +36 -0
  193. package/types/lib/core/toolRegistry.d.ts.map +1 -0
  194. package/types/lib/ecosystems/cppEvidence.d.ts +40 -13
  195. package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
  196. package/types/lib/ecosystems/cppIncludeResolver.d.ts +2 -1
  197. package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -1
  198. package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
  199. package/types/lib/ecosystems/gemHostProbe.d.ts +28 -0
  200. package/types/lib/ecosystems/gemHostProbe.d.ts.map +1 -0
  201. package/types/lib/ecosystems/golem.d.ts.map +1 -1
  202. package/types/lib/ecosystems/gradleutils.d.ts +294 -20
  203. package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
  204. package/types/lib/ecosystems/jsEvidence.d.ts +14 -1
  205. package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
  206. package/types/lib/ecosystems/kosi.d.ts.map +1 -1
  207. package/types/lib/ecosystems/npmVersionResolution.d.ts +119 -0
  208. package/types/lib/ecosystems/npmVersionResolution.d.ts.map +1 -0
  209. package/types/lib/ecosystems/parsers-bazel.d.ts.map +1 -1
  210. package/types/lib/ecosystems/parsers-js.d.ts +17 -20
  211. package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
  212. package/types/lib/ecosystems/parsers-misc.d.ts +19 -0
  213. package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
  214. package/types/lib/ecosystems/parsers-python.d.ts +10 -0
  215. package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
  216. package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
  217. package/types/lib/ecosystems/pythonutils.d.ts +19 -1
  218. package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
  219. package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
  220. package/types/lib/ecosystems/rubyutils.d.ts +144 -12
  221. package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
  222. package/types/lib/ecosystems/rusi.d.ts.map +1 -1
  223. package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -1
  224. package/types/lib/ecosystems/scalasem.d.ts +58 -16
  225. package/types/lib/ecosystems/scalasem.d.ts.map +1 -1
  226. package/types/lib/ecosystems/vendoredCode.d.ts +26 -0
  227. package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -1
  228. package/types/lib/ecosystems/venvProbe.d.ts +40 -0
  229. package/types/lib/ecosystems/venvProbe.d.ts.map +1 -0
  230. package/types/lib/evinser/evinser.d.ts +120 -13
  231. package/types/lib/evinser/evinser.d.ts.map +1 -1
  232. package/types/lib/evinser/scalasem.d.ts.map +1 -1
  233. package/types/lib/helpers/agenticToolutils.d.ts +53 -19
  234. package/types/lib/helpers/agenticToolutils.d.ts.map +1 -1
  235. package/types/lib/helpers/bomSigner.d.ts +20 -3
  236. package/types/lib/helpers/bomSigner.d.ts.map +1 -1
  237. package/types/lib/helpers/jssSigner.d.ts +288 -0
  238. package/types/lib/helpers/jssSigner.d.ts.map +1 -0
  239. package/types/lib/helpers/vsixutils.d.ts +303 -19
  240. package/types/lib/helpers/vsixutils.d.ts.map +1 -1
  241. package/types/lib/inventory/agentBlueprint.d.ts +70 -0
  242. package/types/lib/inventory/agentBlueprint.d.ts.map +1 -0
  243. package/types/lib/inventory/agentToolNames.d.ts +51 -0
  244. package/types/lib/inventory/agentToolNames.d.ts.map +1 -0
  245. package/types/lib/inventory/aiCollector.d.ts.map +1 -1
  246. package/types/lib/inventory/aiInventory.d.ts.map +1 -1
  247. package/types/lib/inventory/aiProviders.d.ts +85 -0
  248. package/types/lib/inventory/aiProviders.d.ts.map +1 -0
  249. package/types/lib/inventory/atomUtils.d.ts +19 -0
  250. package/types/lib/inventory/atomUtils.d.ts.map +1 -1
  251. package/types/lib/inventory/bomUtils.d.ts.map +1 -1
  252. package/types/lib/inventory/brotliDecoder.d.ts +58 -0
  253. package/types/lib/inventory/brotliDecoder.d.ts.map +1 -0
  254. package/types/lib/inventory/cbomutils.d.ts +17 -0
  255. package/types/lib/inventory/cbomutils.d.ts.map +1 -1
  256. package/types/lib/inventory/ciParsers/githubActionsLock.d.ts +101 -0
  257. package/types/lib/inventory/ciParsers/githubActionsLock.d.ts.map +1 -0
  258. package/types/lib/inventory/citations.d.ts +5 -0
  259. package/types/lib/inventory/citations.d.ts.map +1 -1
  260. package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
  261. package/types/lib/inventory/cyclonedx20.d.ts +99 -0
  262. package/types/lib/inventory/cyclonedx20.d.ts.map +1 -0
  263. package/types/lib/inventory/cyclonedx20Common.d.ts +102 -0
  264. package/types/lib/inventory/cyclonedx20Common.d.ts.map +1 -0
  265. package/types/lib/inventory/cyclonedx20Derived.d.ts +74 -0
  266. package/types/lib/inventory/cyclonedx20Derived.d.ts.map +1 -0
  267. package/types/lib/inventory/cyclonedx20Parties.d.ts +91 -0
  268. package/types/lib/inventory/cyclonedx20Parties.d.ts.map +1 -0
  269. package/types/lib/inventory/cyclonedx20Read.d.ts +51 -0
  270. package/types/lib/inventory/cyclonedx20Read.d.ts.map +1 -0
  271. package/types/lib/inventory/cyclonedx20ReadCommon.d.ts +69 -0
  272. package/types/lib/inventory/cyclonedx20ReadCommon.d.ts.map +1 -0
  273. package/types/lib/inventory/cyclonedx20ReadComponents.d.ts +77 -0
  274. package/types/lib/inventory/cyclonedx20ReadComponents.d.ts.map +1 -0
  275. package/types/lib/inventory/cyclonedx20ReadContext.d.ts +118 -0
  276. package/types/lib/inventory/cyclonedx20ReadContext.d.ts.map +1 -0
  277. package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts +40 -0
  278. package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts.map +1 -0
  279. package/types/lib/inventory/cyclonedx20ReadSections.d.ts +45 -0
  280. package/types/lib/inventory/cyclonedx20ReadSections.d.ts.map +1 -0
  281. package/types/lib/inventory/cyclonedx20Render.d.ts +53 -0
  282. package/types/lib/inventory/cyclonedx20Render.d.ts.map +1 -0
  283. package/types/lib/inventory/cyclonedx20RenderComponents.d.ts +73 -0
  284. package/types/lib/inventory/cyclonedx20RenderComponents.d.ts.map +1 -0
  285. package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts +29 -0
  286. package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts.map +1 -0
  287. package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts +110 -0
  288. package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts.map +1 -0
  289. package/types/lib/inventory/cyclonedx20RenderHardware.d.ts +42 -0
  290. package/types/lib/inventory/cyclonedx20RenderHardware.d.ts.map +1 -0
  291. package/types/lib/inventory/cyclonedx20RenderPatents.d.ts +26 -0
  292. package/types/lib/inventory/cyclonedx20RenderPatents.d.ts.map +1 -0
  293. package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts +55 -0
  294. package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts.map +1 -0
  295. package/types/lib/inventory/cyclonedx20RenderSections.d.ts +45 -0
  296. package/types/lib/inventory/cyclonedx20RenderSections.d.ts.map +1 -0
  297. package/types/lib/inventory/cyclonedx20Tables.d.ts +134 -0
  298. package/types/lib/inventory/cyclonedx20Tables.d.ts.map +1 -0
  299. package/types/lib/inventory/deps.d.ts +35 -2
  300. package/types/lib/inventory/deps.d.ts.map +1 -1
  301. package/types/lib/inventory/dosai.d.ts +36 -1
  302. package/types/lib/inventory/dosai.d.ts.map +1 -1
  303. package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
  304. package/types/lib/inventory/dotnetRuntime.d.ts +91 -0
  305. package/types/lib/inventory/dotnetRuntime.d.ts.map +1 -0
  306. package/types/lib/inventory/ecosystemFormulationParsers.d.ts +73 -0
  307. package/types/lib/inventory/ecosystemFormulationParsers.d.ts.map +1 -0
  308. package/types/lib/inventory/envcontext.d.ts +74 -12
  309. package/types/lib/inventory/envcontext.d.ts.map +1 -1
  310. package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
  311. package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
  312. package/types/lib/inventory/gtfobins.d.ts.map +1 -1
  313. package/types/lib/inventory/hbom.d.ts +11 -0
  314. package/types/lib/inventory/hbom.d.ts.map +1 -1
  315. package/types/lib/inventory/hbomLoader.d.ts +54 -0
  316. package/types/lib/inventory/hbomLoader.d.ts.map +1 -1
  317. package/types/lib/inventory/hostRuntimeProbe.d.ts +44 -0
  318. package/types/lib/inventory/hostRuntimeProbe.d.ts.map +1 -0
  319. package/types/lib/inventory/jvmLocalRepos.d.ts +5 -1
  320. package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -1
  321. package/types/lib/inventory/jvmToolEnv.d.ts +12 -0
  322. package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -1
  323. package/types/lib/inventory/licenseEnhancer.d.ts.map +1 -1
  324. package/types/lib/inventory/mavenCentralMirror.d.ts +170 -0
  325. package/types/lib/inventory/mavenCentralMirror.d.ts.map +1 -0
  326. package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
  327. package/types/lib/inventory/nodeBuildInfo.d.ts +95 -0
  328. package/types/lib/inventory/nodeBuildInfo.d.ts.map +1 -0
  329. package/types/lib/inventory/nodeHostProbe.d.ts +15 -0
  330. package/types/lib/inventory/nodeHostProbe.d.ts.map +1 -0
  331. package/types/lib/inventory/occurrenceKey.d.ts +52 -0
  332. package/types/lib/inventory/occurrenceKey.d.ts.map +1 -0
  333. package/types/lib/inventory/osPackageResolver.d.ts +38 -0
  334. package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
  335. package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -1
  336. package/types/lib/inventory/phpHostProbe.d.ts.map +1 -1
  337. package/types/lib/inventory/pqcMigration.d.ts +84 -0
  338. package/types/lib/inventory/pqcMigration.d.ts.map +1 -0
  339. package/types/lib/inventory/rubyBuildInfo.d.ts +271 -0
  340. package/types/lib/inventory/rubyBuildInfo.d.ts.map +1 -0
  341. package/types/lib/inventory/rubyHostProbe.d.ts +47 -0
  342. package/types/lib/inventory/rubyHostProbe.d.ts.map +1 -0
  343. package/types/lib/inventory/rustFormulationParser.d.ts +7 -2
  344. package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
  345. package/types/lib/inventory/scalaCoords.d.ts.map +1 -1
  346. package/types/lib/inventory/scalaDedupe.d.ts +43 -0
  347. package/types/lib/inventory/scalaDedupe.d.ts.map +1 -0
  348. package/types/lib/inventory/source.d.ts +25 -0
  349. package/types/lib/inventory/source.d.ts.map +1 -1
  350. package/types/lib/managers/binary.d.ts.map +1 -1
  351. package/types/lib/managers/docker.d.ts +12 -0
  352. package/types/lib/managers/docker.d.ts.map +1 -1
  353. package/types/lib/parsers/huggingfaceManifest.d.ts +10 -1
  354. package/types/lib/parsers/huggingfaceManifest.d.ts.map +1 -1
  355. package/types/lib/parsers/huggingfaceUtils.d.ts +12 -0
  356. package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
  357. package/types/lib/parsers/kiroPermissions.d.ts +62 -0
  358. package/types/lib/parsers/kiroPermissions.d.ts.map +1 -0
  359. package/types/lib/parsers/largeJson.d.ts +4 -3
  360. package/types/lib/parsers/largeJson.d.ts.map +1 -1
  361. package/types/lib/parsers/vscodeExtensionId.d.ts +48 -0
  362. package/types/lib/parsers/vscodeExtensionId.d.ts.map +1 -0
  363. package/types/lib/server/server.d.ts.map +1 -1
  364. package/types/lib/stages/postgen/postgen.d.ts +7 -0
  365. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  366. package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
  367. package/types/lib/stages/postgen/specVersionCompat.d.ts +25 -0
  368. package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
  369. package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
  370. package/types/lib/stages/pregen/pregen.d.ts +12 -8
  371. package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
  372. package/types/lib/validator/bomValidator.d.ts +5 -1
  373. package/types/lib/validator/bomValidator.d.ts.map +1 -1
  374. package/types/lib/validator/complianceEngine.d.ts +4 -4
  375. package/types/lib/validator/complianceEngine.d.ts.map +1 -1
  376. package/types/lib/validator/complianceRules.d.ts +14 -2
  377. package/types/lib/validator/complianceRules.d.ts.map +1 -1
  378. package/types/lib/validator/index.d.ts +10 -0
  379. package/types/lib/validator/index.d.ts.map +1 -1
  380. package/types/lib/validator/reporters/json.d.ts.map +1 -1
@@ -0,0 +1,499 @@
1
+ /**
2
+ * Render the CycloneDX 2.0 sections that sit beside the inventory:
3
+ * compositions, annotations, citations, vulnerabilities and formulation.
4
+ * Each converter restores an entry readCycloneDx20 kept as a shadow while
5
+ * the entry is unchanged.
6
+ */
7
+
8
+ import {
9
+ clone,
10
+ convertEnvironmentVars,
11
+ copyDefined,
12
+ countDrop,
13
+ countUnmapped,
14
+ isNonEmptyString,
15
+ isObjectRecord,
16
+ setDefined,
17
+ takeShadow,
18
+ uniqueByValue,
19
+ } from "./cyclonedx20Common.js";
20
+ import { toCommonContact, toCommonEntity } from "./cyclonedx20Parties.js";
21
+ import {
22
+ convertAttachment,
23
+ convertComponent,
24
+ convertService,
25
+ convertTools,
26
+ } from "./cyclonedx20RenderComponents.js";
27
+ import { AGGREGATE_1X_TO_20 } from "./cyclonedx20Tables.js";
28
+
29
+ /** A unique list of the non-empty string refs of a 1.x composition field. */
30
+ function compositionRefs(value) {
31
+ return Array.isArray(value)
32
+ ? [...new Set(value.filter(isNonEmptyString))]
33
+ : [];
34
+ }
35
+
36
+ /**
37
+ * Map one 1.x composition onto 2.0 compositions, one per scope: `assemblies`
38
+ * → kind `components` (the inventory when the list is only the subject),
39
+ * `dependencies` → kind `dependencies`, `vulnerabilities` → kind
40
+ * `vulnerabilities` (kind enum in
41
+ * #/$defs/cyclonedx-composition-2.0/$defs/composition). A composition with no
42
+ * scope describes the inventory, as cdxgen's autoCompositions emits it.
43
+ */
44
+ function compositionsFor(composition, aggregate, inventory, stats) {
45
+ const scoped = [];
46
+ const assemblies = compositionRefs(composition.assemblies);
47
+ if (assemblies.length) {
48
+ const onlySubject =
49
+ inventory.inventoryRefId &&
50
+ assemblies.length === 1 &&
51
+ assemblies[0] === inventory.subjectRef;
52
+ scoped.push({
53
+ kind: "components",
54
+ aggregate,
55
+ targets: onlySubject ? [inventory.inventoryRefId] : assemblies,
56
+ });
57
+ }
58
+ for (const kind of ["dependencies", "vulnerabilities"]) {
59
+ const targets = compositionRefs(composition[kind]);
60
+ if (targets.length) {
61
+ scoped.push({ kind, aggregate, targets });
62
+ }
63
+ }
64
+ if (scoped.length) {
65
+ return scoped;
66
+ }
67
+ if (inventory.inventoryRefId) {
68
+ return [
69
+ { kind: "components", aggregate, targets: [inventory.inventoryRefId] },
70
+ ];
71
+ }
72
+ countDrop(stats, "composition (no target in a subject-less document)");
73
+ return [];
74
+ }
75
+
76
+ /**
77
+ * Render compositions (#/$defs/cyclonedx-composition-2.0/$defs/composition,
78
+ * required `[kind, aggregate, targets]`). The composition's own 1.x
79
+ * `bom-ref` (cdxgen sets it to the subject's bom-ref) is not carried, so it
80
+ * cannot collide with the subject's refId.
81
+ */
82
+ export function renderCompositions(compositions, inventory, carried, stats) {
83
+ // Compositions a 2.0 read could not express in 1.x (licenses,
84
+ // certifications or custom kinds) come back after the converted ones.
85
+ const carriedCompositions = Array.isArray(carried) ? clone(carried) : [];
86
+ if (
87
+ (!Array.isArray(compositions) || !compositions.length) &&
88
+ !carriedCompositions.length
89
+ ) {
90
+ return undefined;
91
+ }
92
+ const converted = [];
93
+ for (const composition of Array.isArray(compositions) ? compositions : []) {
94
+ const shadow = takeShadow(stats, "composition", composition);
95
+ if (shadow) {
96
+ converted.push(shadow);
97
+ continue;
98
+ }
99
+ const aggregate =
100
+ isObjectRecord(composition) &&
101
+ typeof composition.aggregate === "string" &&
102
+ Object.hasOwn(AGGREGATE_1X_TO_20, composition.aggregate)
103
+ ? AGGREGATE_1X_TO_20[composition.aggregate]
104
+ : undefined;
105
+ if (!aggregate) {
106
+ countDrop(stats, "composition (aggregate outside the 2.0 enum)");
107
+ continue;
108
+ }
109
+ converted.push(
110
+ ...compositionsFor(composition, aggregate, inventory, stats),
111
+ );
112
+ countUnmapped(
113
+ stats,
114
+ "composition",
115
+ composition,
116
+ new Set(["aggregate", "assemblies", "dependencies", "vulnerabilities"]),
117
+ );
118
+ }
119
+ converted.push(...carriedCompositions);
120
+ const unique = uniqueByValue(converted);
121
+ return unique.length ? unique : undefined;
122
+ }
123
+
124
+ /**
125
+ * Convert an annotator. 2.0 allows `organization`, `individual` or
126
+ * `component` (#/$defs/cyclonedx-annotation-2.0/$defs/annotation/properties/annotator),
127
+ * so a 1.x `service` annotator becomes a component of type `service`.
128
+ */
129
+ function convertAnnotator(annotator, stats) {
130
+ if (!isObjectRecord(annotator)) {
131
+ return undefined;
132
+ }
133
+ if (isObjectRecord(annotator.component)) {
134
+ return { component: convertComponent(annotator.component, stats) };
135
+ }
136
+ if (isObjectRecord(annotator.service)) {
137
+ return { component: convertService(annotator.service, stats) };
138
+ }
139
+ if (isObjectRecord(annotator.organization)) {
140
+ return { organization: toCommonEntity(annotator.organization, stats) };
141
+ }
142
+ const individual = toCommonContact(annotator.individual, stats);
143
+ return individual ? { individual } : undefined;
144
+ }
145
+
146
+ /**
147
+ * Render annotations (#/$defs/cyclonedx-annotation-2.0/$defs/annotation,
148
+ * required `[subjects, annotator, timestamp, text]`). Subjects are checked
149
+ * against the declared refIds once the whole document exists
150
+ * (see resolveAnnotationSubjects).
151
+ */
152
+ export function renderAnnotations(annotations, stats) {
153
+ if (!Array.isArray(annotations) || !annotations.length) {
154
+ return undefined;
155
+ }
156
+ const converted = [];
157
+ for (const annotation of annotations) {
158
+ if (!isObjectRecord(annotation)) {
159
+ continue;
160
+ }
161
+ const shadow = takeShadow(stats, "annotation", annotation);
162
+ if (shadow) {
163
+ converted.push(shadow);
164
+ continue;
165
+ }
166
+ const annotator = convertAnnotator(annotation.annotator, stats);
167
+ if (!annotator) {
168
+ countDrop(stats, "annotation (no annotator)");
169
+ continue;
170
+ }
171
+ const entry = {};
172
+ if (isNonEmptyString(annotation["bom-ref"])) {
173
+ entry.refId = annotation["bom-ref"];
174
+ }
175
+ entry.subjects = (annotation.subjects || []).filter(isNonEmptyString);
176
+ entry.annotator = annotator;
177
+ entry.timestamp = annotation.timestamp;
178
+ entry.text = annotation.text;
179
+ if (annotation.signature !== undefined) {
180
+ countDrop(stats, "annotation.signature");
181
+ }
182
+ converted.push(entry);
183
+ }
184
+ return converted.length ? converted : undefined;
185
+ }
186
+
187
+ /**
188
+ * Rewrite a 1.x citation JSONPath expression to the 2.0 document shape. The
189
+ * plain inventory statement path and component-targeting paths both start at
190
+ * `$.components` in 1.x and move under inventories (or definitions, when the
191
+ * document has no subject component).
192
+ */
193
+ function convertCitationExpression(expression, usesInventory) {
194
+ if (typeof expression !== "string") {
195
+ return expression;
196
+ }
197
+ if (expression === "$.components") {
198
+ return usesInventory ? "$.inventories" : "$.definitions.components";
199
+ }
200
+ if (expression.startsWith("$.components")) {
201
+ return usesInventory
202
+ ? `$.inventories[0].components${expression.slice("$.components".length)}`
203
+ : `$.definitions.components${expression.slice("$.components".length)}`;
204
+ }
205
+ if (expression === "$.services") {
206
+ return usesInventory
207
+ ? "$.inventories[0].components[?(@.type=='service')]"
208
+ : "$.definitions.components[?(@.type=='service')]";
209
+ }
210
+ return expression;
211
+ }
212
+
213
+ /**
214
+ * Render citations (#/$defs/cyclonedx-citation-2.0/$defs/citation).
215
+ * `attributedTo` is a refLinkType, so it names a declared object's refId; the
216
+ * cdxgen tool's bom-ref becomes exactly that refId. A citation may carry
217
+ * `attributedTo`, `process` or both, so only the ref rename and the
218
+ * expression rewrite are targeted.
219
+ */
220
+ export function renderCitations(citations, usesInventory, stats) {
221
+ if (!Array.isArray(citations) || !citations.length) {
222
+ return undefined;
223
+ }
224
+ return citations.filter(isObjectRecord).map((citation) => {
225
+ const shadow = takeShadow(stats, "citation", citation);
226
+ if (shadow) {
227
+ return shadow;
228
+ }
229
+ const converted = clone(citation);
230
+ if (converted["bom-ref"]) {
231
+ converted.refId = converted["bom-ref"];
232
+ delete converted["bom-ref"];
233
+ }
234
+ if (Array.isArray(converted.expressions)) {
235
+ converted.expressions = converted.expressions.map((expression) =>
236
+ convertCitationExpression(expression, usesInventory),
237
+ );
238
+ }
239
+ return converted;
240
+ });
241
+ }
242
+
243
+ /**
244
+ * 1.x `cwes` numbers as 2.0 weaknesses
245
+ * (#/$defs/cyclonedx-weakness-2.0/$defs/weakness, kind `flaw`, identifier
246
+ * scheme `cwe` with the `CWE-<n>` value).
247
+ */
248
+ function cwesToWeaknesses(cwes, stats) {
249
+ const weaknesses = [];
250
+ for (const cwe of Array.isArray(cwes) ? cwes : []) {
251
+ if (Number.isInteger(cwe) && cwe >= 0) {
252
+ weaknesses.push({
253
+ kind: "flaw",
254
+ identifiers: [{ scheme: "cwe", value: `CWE-${cwe}` }],
255
+ });
256
+ } else {
257
+ countDrop(stats, "vulnerability.cwes (not a CWE number)");
258
+ }
259
+ }
260
+ return uniqueByValue(weaknesses);
261
+ }
262
+
263
+ // 1.x vulnerability members whose 2.0 form is the same
264
+ // (#/$defs/cyclonedx-vulnerability-2.0/$defs/vulnerability).
265
+ const VULNERABILITY_COPY_FIELDS = [
266
+ "id",
267
+ "source",
268
+ "references",
269
+ "ratings",
270
+ "description",
271
+ "detail",
272
+ "recommendation",
273
+ "workaround",
274
+ "advisories",
275
+ "created",
276
+ "published",
277
+ "updated",
278
+ "rejected",
279
+ "analysis",
280
+ "affects",
281
+ "properties",
282
+ ];
283
+ const VULNERABILITY_HANDLED_FIELDS = new Set([
284
+ ...VULNERABILITY_COPY_FIELDS,
285
+ "bom-ref",
286
+ "cwes",
287
+ "credits",
288
+ "proofOfConcept",
289
+ "tools",
290
+ ]);
291
+
292
+ /** Credits: organizations and individuals take the 2.0 common shapes. */
293
+ function convertCredits(credits, stats) {
294
+ if (!isObjectRecord(credits)) {
295
+ countDrop(stats, "vulnerability.credits (not an object)");
296
+ return undefined;
297
+ }
298
+ const converted = {};
299
+ const organizations = (
300
+ Array.isArray(credits.organizations) ? credits.organizations : []
301
+ )
302
+ .map((organization) => toCommonEntity(organization, stats))
303
+ .filter((organization) => organization && Object.keys(organization).length);
304
+ if (organizations.length) {
305
+ converted.organizations = organizations;
306
+ }
307
+ const individuals = (
308
+ Array.isArray(credits.individuals) ? credits.individuals : []
309
+ )
310
+ .map((individual) => toCommonContact(individual, stats))
311
+ .filter(Boolean);
312
+ if (individuals.length) {
313
+ converted.individuals = individuals;
314
+ }
315
+ countUnmapped(
316
+ stats,
317
+ "vulnerability.credits",
318
+ credits,
319
+ new Set(["organizations", "individuals"]),
320
+ );
321
+ return Object.keys(converted).length ? converted : undefined;
322
+ }
323
+
324
+ /** Proof of concept: the supporting material is a list of attachments. */
325
+ function convertProofOfConcept(proofOfConcept, stats) {
326
+ if (!isObjectRecord(proofOfConcept)) {
327
+ countDrop(stats, "vulnerability.proofOfConcept (not an object)");
328
+ return undefined;
329
+ }
330
+ const converted = {};
331
+ copyDefined(converted, proofOfConcept, ["reproductionSteps", "environment"]);
332
+ if (Array.isArray(proofOfConcept.supportingMaterial)) {
333
+ const material = proofOfConcept.supportingMaterial
334
+ .map((attachment) =>
335
+ convertAttachment(
336
+ attachment,
337
+ stats,
338
+ "vulnerability.proofOfConcept.supportingMaterial",
339
+ ),
340
+ )
341
+ .filter(Boolean);
342
+ if (material.length) {
343
+ converted.supportingMaterial = material;
344
+ }
345
+ }
346
+ countUnmapped(
347
+ stats,
348
+ "vulnerability.proofOfConcept",
349
+ proofOfConcept,
350
+ new Set(["reproductionSteps", "environment", "supportingMaterial"]),
351
+ );
352
+ return Object.keys(converted).length ? converted : undefined;
353
+ }
354
+
355
+ /**
356
+ * Render vulnerabilities: `bom-ref` → `refId`, `cwes` → `weaknesses`, the
357
+ * tools object, credits as 2.0 organizations and contacts and the proof of
358
+ * concept's attachments. Members 2.0 has no field for are counted; `affects`
359
+ * references are resolved once every refId is known (resolveAffectsRefs).
360
+ */
361
+ export function renderVulnerabilities(vulnerabilities, stats) {
362
+ if (!Array.isArray(vulnerabilities) || !vulnerabilities.length) {
363
+ return undefined;
364
+ }
365
+ return vulnerabilities.map((vulnerability) => {
366
+ if (!isObjectRecord(vulnerability)) {
367
+ return clone(vulnerability);
368
+ }
369
+ const shadow = takeShadow(stats, "vulnerability", vulnerability);
370
+ if (shadow) {
371
+ return shadow;
372
+ }
373
+ const converted = {};
374
+ if (isNonEmptyString(vulnerability["bom-ref"])) {
375
+ converted.refId = vulnerability["bom-ref"];
376
+ }
377
+ for (const [key, value] of Object.entries(vulnerability)) {
378
+ if (value === undefined || !VULNERABILITY_HANDLED_FIELDS.has(key)) {
379
+ continue;
380
+ }
381
+ if (VULNERABILITY_COPY_FIELDS.includes(key)) {
382
+ converted[key] = clone(value);
383
+ } else if (key === "cwes") {
384
+ const weaknesses = cwesToWeaknesses(value, stats);
385
+ if (weaknesses.length) {
386
+ converted.weaknesses = weaknesses;
387
+ }
388
+ } else if (key === "credits") {
389
+ setDefined(converted, "credits", convertCredits(value, stats));
390
+ } else if (key === "proofOfConcept") {
391
+ setDefined(
392
+ converted,
393
+ "proofOfConcept",
394
+ convertProofOfConcept(value, stats),
395
+ );
396
+ } else if (key === "tools") {
397
+ setDefined(converted, "tools", convertTools(value, stats));
398
+ }
399
+ }
400
+ countUnmapped(
401
+ stats,
402
+ "vulnerability",
403
+ vulnerability,
404
+ VULNERABILITY_HANDLED_FIELDS,
405
+ );
406
+ return converted;
407
+ });
408
+ }
409
+
410
+ /** Convert formulation inputs/outputs, whose entries may carry env vars. */
411
+ function convertFormulationIo(entries, stats) {
412
+ return entries.map((entry) => {
413
+ const converted = clone(entry);
414
+ if (isObjectRecord(converted) && converted.environmentVars !== undefined) {
415
+ converted.environmentVars = convertEnvironmentVars(
416
+ converted.environmentVars,
417
+ stats,
418
+ );
419
+ }
420
+ return converted;
421
+ });
422
+ }
423
+
424
+ /**
425
+ * formulation → workflows/tasks/triggers with refId renames. The 2.0 formula
426
+ * allows only refId, properties and workflows
427
+ * (#/$defs/cyclonedx-formulation-2.0/$defs/formula), so the 1.x
428
+ * formula.components move to definitions.components (upstream's
429
+ * valid-formulation-2.0.json declares them there too) and are collected in
430
+ * `stats.formulaComponents`.
431
+ */
432
+ export function convertFormulation(formulation, stats) {
433
+ if (!Array.isArray(formulation)) {
434
+ return clone(formulation);
435
+ }
436
+ const refIdSubjects = (entry) => {
437
+ if (!isObjectRecord(entry)) {
438
+ return clone(entry);
439
+ }
440
+ const converted = {};
441
+ if (entry["bom-ref"]) {
442
+ converted.refId = entry["bom-ref"];
443
+ }
444
+ for (const [key, value] of Object.entries(entry)) {
445
+ if (key === "bom-ref") {
446
+ continue;
447
+ }
448
+ if (key === "components" && Array.isArray(value)) {
449
+ stats.formulaComponents.push(
450
+ ...value.map((c) => convertComponent(c, stats)),
451
+ );
452
+ } else if (key === "services" && Array.isArray(value)) {
453
+ stats.formulaComponents.push(
454
+ ...value.map((s) => convertService(s, stats)),
455
+ );
456
+ } else if (FORMULATION_LIST_KEYS.has(key) && Array.isArray(value)) {
457
+ converted[key] = value.map(refIdSubjects);
458
+ } else if (key === "trigger" && isObjectRecord(value)) {
459
+ converted.trigger = refIdSubjects(value);
460
+ } else if (key === "environmentVars") {
461
+ converted.environmentVars = convertEnvironmentVars(value, stats);
462
+ } else if (
463
+ (key === "inputs" || key === "outputs") &&
464
+ Array.isArray(value)
465
+ ) {
466
+ converted[key] = convertFormulationIo(value, stats);
467
+ } else {
468
+ converted[key] = clone(value);
469
+ }
470
+ }
471
+ return converted;
472
+ };
473
+ return formulation.map((formula, index) => {
474
+ if (!isObjectRecord(formula)) {
475
+ return clone(formula);
476
+ }
477
+ // A formula read from 2.0 is restored while unchanged; its components
478
+ // still go to definitions. The refIds of each formula's components are
479
+ // kept in stats.formulaMembership for a subject-less document (see
480
+ // cyclonedx20Render.js).
481
+ const start = stats.formulaComponents.length;
482
+ const { components, services, ...own } = formula;
483
+ const shadow = takeShadow(stats, "formula", own);
484
+ let converted;
485
+ if (shadow) {
486
+ refIdSubjects({ components, services });
487
+ converted = shadow;
488
+ } else {
489
+ converted = refIdSubjects(formula);
490
+ }
491
+ stats.formulaMembership[index] = stats.formulaComponents.slice(start);
492
+ return converted;
493
+ });
494
+ }
495
+
496
+ // Formulation members holding lists of objects that carry a bom-ref.
497
+ const FORMULATION_LIST_KEYS = Object.freeze(
498
+ new Set(["workflows", "tasks", "triggers", "workspaces"]),
499
+ );