@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,288 @@
1
+ /**
2
+ * JSON Signature Scheme (JSS) signing and verification for CycloneDX 2.0.
3
+ *
4
+ * Implemented from Recommendation ITU-T X.590 (10/2023), "JSON signature
5
+ * scheme". Clause citations below refer to that text:
6
+ *
7
+ * - clause 6.2.1: the signature object members (`hash_algorithm`,
8
+ * `algorithm`, `public_key`, `value`, the countersignature `signature`)
9
+ * and, in its footnote, that one of `public_key`, `public_cert_chain`,
10
+ * `cert_url` or `thumbprint` is present;
11
+ * - clause 6.2.2 and Table 1: the algorithm vocabulary;
12
+ * - clause 7.1.2: existing signatures are temporarily removed;
13
+ * - clause 7.1.3: the new signature object (without its value) is added;
14
+ * - clause 7.1.4: the entire JSON object is canonicalized with JCS
15
+ * [IETF RFC 8785];
16
+ * - clause 7.1.5: the JCS version is hashed with `hash_algorithm`, and the
17
+ * hash is presented in (lowercase) hex;
18
+ * - clause 7.1.6: that hash is signed with `algorithm` and the result is
19
+ * base64URL-encoded;
20
+ * - clause 7.1.7: pre-existing signatures are restored at the start of the
21
+ * list and the new entry is appended with its `value`;
22
+ * - clause 7.2: a countersignature is a signature object nested in the
23
+ * `signature` member of the signature it countersigns. The countersigned
24
+ * entry keeps its `value` in the signed view (7.2.1, 7.2.3, 7.2.4) and the
25
+ * other entries are removed (7.2.2);
26
+ * - clause 8.1: verification keeps only the entry under verification
27
+ * (8.1.1), removes its `value` (8.1.2), takes the key from the entry or a
28
+ * trusted source (8.1.3), canonicalizes (8.1.4), hashes (8.1.5) and
29
+ * validates (8.1.6).
30
+ *
31
+ * The signed message. The clause 7.1.6 example value
32
+ * (`F1Sj4V...`) and the clause 7.2.6 countersignature value (`b_7Xu5...`)
33
+ * are reproduced byte for byte only when the message given to the signing
34
+ * primitive is the UTF-8 text of the lowercase hex hash of clause 7.1.5
35
+ * (and 7.2.5). Ed25519 and Ed448 sign that message directly. RS*, PS* and
36
+ * ES* pass the same message to the JOSE primitive named in Table 1 (JWA
37
+ * [IETF RFC 7518] sections 3.3 to 3.5), which hashes it again with its own
38
+ * SHA-2 digest; clause 6.2.1 `hash_algorithm` notes that the signing
39
+ * process "sometimes uses an internal hashing algorithm". X.590 has no
40
+ * RSA or ECDSA example, so that part follows from the text and the Ed25519
41
+ * vectors rather than from a published vector.
42
+ *
43
+ * Trust. Clause 8.1.3 allows the key to be parsed from the entry or fetched
44
+ * from a trusted source, and clause 8.1.6 leaves "public key lookup methods"
45
+ * to policy. An embedded key with no trust anchor proves integrity only, so
46
+ * {@link verifyJss} requires caller-supplied trusted keys and uses the
47
+ * embedded key only with the explicit `allowEmbeddedKey` option, whose
48
+ * results carry `trusted: false`.
49
+ *
50
+ * The signature object shape is also fixed by the pinned draft schema,
51
+ * #/$defs/cyclonedx-jss_X590_2023_10-2.0/$defs/signatureObject. The
52
+ * `public_key` value is the base64 form of the DER SubjectPublicKeyInfo
53
+ * without the PEM armor (clause 6.2.1); the clause 7.1 examples store it
54
+ * without base64 padding, which the schema pattern also allows.
55
+ */
56
+ import { KeyObject } from "node:crypto";
57
+ /**
58
+ * Quantum-safe algorithm names from X.590 Table 1 (clause 6.2.2) that
59
+ * node:crypto cannot provide: every XMSS (IETF RFC 8391 section 5.3) and
60
+ * LMS (IETF RFC 8554 section 5.1) value of the table.
61
+ */
62
+ export declare const UNSUPPORTED_JSS_ALGORITHMS: readonly string[];
63
+ /**
64
+ * The clause 6.2.1 `hash_algorithm` values accepted, by their IANA Named
65
+ * Information Hash Algorithm Registry names, mapped to the node:crypto
66
+ * digest. Anything else (md5, sha1, sha-224, unknown names) is refused when
67
+ * signing and fails verification: clause 6.2.1 asks for a "current and
68
+ * widely accepted hashing algorithm" defined in the IANA registry.
69
+ */
70
+ export declare const JSS_HASH_ALGORITHMS: any;
71
+ /** JSS algorithm names this module signs and verifies. */
72
+ export declare const JSS_SIGNATURE_ALGORITHMS: readonly (string | string[] | null)[];
73
+ /**
74
+ * Whether this runtime's crypto provides Ed448. Bun links BoringSSL, which
75
+ * has no Ed448, so key generation and key loading fail there with an
76
+ * OpenSSL error; this check turns that into a clear message.
77
+ *
78
+ * @returns {boolean} true when Ed448 keys can be created
79
+ */
80
+ export declare function isEd448Available(): boolean;
81
+ /**
82
+ * Checks that a key fits a JSS algorithm, the binding X.590 Table 1 (clause
83
+ * 6.2.2) defines through JWA [IETF RFC 7518] sections 3.3 to 3.5 and
84
+ * [IETF RFC 8037]: RS* need an rsa key, PS* an rsa or rsa-pss key, both of
85
+ * at least 2048 bits; ES256, ES384 and ES512 need an ec key on P-256, P-384
86
+ * and P-521 exactly; Ed25519 and Ed448 need that key type. Sign and verify
87
+ * both call it, so a mislabelled entry fails before any signature math.
88
+ *
89
+ * @param {string} algorithm - JSS algorithm name
90
+ * @param {KeyObject} key - Public or private key
91
+ * @throws {Error} When the key does not fit the algorithm
92
+ */
93
+ export declare function assertJssKeyMatchesAlgorithm(algorithm: string, key: KeyObject): void;
94
+ /**
95
+ * Picks the JSS algorithm for a key: ES256, ES384 or ES512 by curve, RS256
96
+ * for rsa, PS256 for rsa-pss, Ed25519 or Ed448 for those key types.
97
+ *
98
+ * @param {KeyObject} key - Public or private key
99
+ * @returns {string} JSS algorithm name
100
+ * @throws {Error} For a key type no JSS algorithm here supports
101
+ */
102
+ export declare function selectJssAlgorithmForKey(key: KeyObject): string;
103
+ /**
104
+ * Sign a JSON object with JSS (X.590 clause 7.1). Existing entries stay
105
+ * valid: they are removed while the new entry is computed (clause 7.1.2)
106
+ * and restored ahead of it (clause 7.1.7). The input is not mutated.
107
+ *
108
+ * @param {object} document - The JSON object to sign
109
+ * @param {object} options
110
+ * @param {string} options.algorithm - JSS algorithm name (clause 6.2.2)
111
+ * @param {KeyObject|string|Buffer} options.privateKey - Private key (KeyObject or PEM)
112
+ * @param {string} [options.hashAlgorithm] - Clause 6.2.1 hash; one of {@link JSS_HASH_ALGORITHMS}
113
+ * @returns {object} A new object carrying the `signatures` array
114
+ */
115
+ export declare function signJss(document: object, { algorithm, privateKey, hashAlgorithm }?: {
116
+ algorithm: string;
117
+ privateKey: KeyObject | string | Buffer;
118
+ hashAlgorithm?: string;
119
+ }): object;
120
+ /**
121
+ * Countersign a JSS signature (X.590 clause 7.2): the new signature object
122
+ * goes into the `signature` member at the end of the countersignature chain
123
+ * of `signatures[index]`, and covers the document plus that entry and its
124
+ * chain, values included. Other entries are left out of the signed view
125
+ * (clause 7.2.2) and restored ahead of the countersigned entry (clause
126
+ * 7.2.7). The input is not mutated.
127
+ *
128
+ * @param {object} document - The signed JSON object
129
+ * @param {object} options
130
+ * @param {string} options.algorithm - JSS algorithm name (clause 6.2.2)
131
+ * @param {KeyObject|string|Buffer} options.privateKey - Private key (KeyObject or PEM)
132
+ * @param {string} [options.hashAlgorithm] - Clause 6.2.1 hash
133
+ * @param {number} [options.index] - Entry to countersign; required when there are several
134
+ * @returns {object} A new object carrying the countersigned `signatures` array
135
+ */
136
+ export declare function countersignJss(document: object, { algorithm, privateKey, hashAlgorithm, index }?: {
137
+ algorithm: string;
138
+ privateKey: KeyObject | string | Buffer;
139
+ hashAlgorithm?: string;
140
+ index?: number;
141
+ }): object;
142
+ /**
143
+ * Verify the JSS signatures of a JSON object (X.590 clauses 8.1 and 7.2).
144
+ *
145
+ * Each entry is verified on its own view: the other entries are removed
146
+ * (clause 8.1.1) and the entry loses only its `value` (clause 8.1.2) and any
147
+ * nested countersignature, so every other member (`signee`, `valid_until`,
148
+ * `revoked`, ...) is covered. Each countersignature in an entry's `signature`
149
+ * chain is verified on the clause 7.2 view and reported with `depth` > 0.
150
+ *
151
+ * Trust comes from the caller (clause 8.1.3 "fetch it from a trusted
152
+ * source"). An entry whose `public_key` is a trusted key is checked with that
153
+ * key only; an entry without `public_key` (thumbprint, certificate chain,
154
+ * certificate URL) is checked with every trusted key. The embedded key is
155
+ * used only with `allowEmbeddedKey`, and such results carry
156
+ * `trusted: false`.
157
+ *
158
+ * Policy: with trusted keys, the object verifies when at least one
159
+ * signature object verifies with a trusted key and no signature object that
160
+ * names a trusted key fails. With `requireAll`, every signature object must
161
+ * verify with a trusted key, and with `requireEveryKey` every trusted key
162
+ * must verify one of them. With `allowEmbeddedKey` and no trusted keys,
163
+ * every signature object must verify with its embedded key, and the result
164
+ * is `trusted: false`.
165
+ *
166
+ * @param {object} document - The signed JSON object
167
+ * @param {object} options
168
+ * @param {KeyObject|string|Buffer} [options.publicKey] - A trusted public key
169
+ * @param {Array<KeyObject|string|Buffer>} [options.publicKeys] - Trusted public keys
170
+ * @param {boolean} [options.allowEmbeddedKey] - Fall back to each entry's embedded public_key for an integrity-only check (results are `trusted: false`)
171
+ * @param {boolean} [options.requireAll] - Every signature object must verify with a trusted key
172
+ * @param {boolean} [options.requireEveryKey] - With requireAll, every trusted key must verify a signature object
173
+ * @returns {{valid: boolean, trusted: boolean, reasons: string[], keysMatched: boolean[], results: Array<{index: number, depth: number, path: string, algorithm: any, hashAlgorithm: any, status: string, valid: boolean, trusted: boolean, claimsTrustedKey: boolean, keyIndex: (number|undefined), reason: (string|undefined)}>}}
174
+ * @throws {Error} When neither a trusted key nor allowEmbeddedKey is given
175
+ */
176
+ export declare function verifyJss(document: object, options?: {
177
+ publicKey?: KeyObject | string | Buffer;
178
+ publicKeys?: Array<KeyObject | string | Buffer>;
179
+ allowEmbeddedKey?: boolean;
180
+ requireAll?: boolean;
181
+ requireEveryKey?: boolean;
182
+ }): {
183
+ valid: boolean;
184
+ trusted: boolean;
185
+ reasons: string[];
186
+ keysMatched: boolean[];
187
+ results: Array<{
188
+ index: number;
189
+ depth: number;
190
+ path: string;
191
+ algorithm: any;
192
+ hashAlgorithm: any;
193
+ status: string;
194
+ valid: boolean;
195
+ trusted: boolean;
196
+ claimsTrustedKey: boolean;
197
+ keyIndex: (number | undefined);
198
+ reason: (string | undefined);
199
+ }>;
200
+ };
201
+ /**
202
+ * Remove every JSS signature from a CycloneDX 2.0 BOM: the root and the
203
+ * nested members {@link signJssBom} signs. Members are only touched where
204
+ * they carry `signatures`. The input is not mutated.
205
+ *
206
+ * @param {object} bom20 - CycloneDX 2.0 document
207
+ * @returns {{bom: object, removed: number}} The unsigned document and the number of signature entries removed
208
+ */
209
+ export declare function removeJssSignatures(bom20: object): {
210
+ bom: object;
211
+ removed: number;
212
+ };
213
+ /**
214
+ * Sign a CycloneDX 2.0 BOM: the root document plus, with `deep`, the nested
215
+ * members the draft schema gives a `signatures` member to (inventories, the
216
+ * components inside an inventory, compositions and annotations). Nested
217
+ * members are signed first and the root last, so the root signature covers
218
+ * them.
219
+ *
220
+ * Existing root entries stay valid when only the root is signed (clause
221
+ * 7.1.2). Signing nested members changes content that existing root entries
222
+ * cover (clause 7.1.4 canonicalizes the whole object), so `deep` signing of
223
+ * a BOM that already carries root signatures is refused unless
224
+ * `allowInvalidatingSignatures` is set.
225
+ *
226
+ * @param {object} bom20 - Rendered CycloneDX 2.0 document
227
+ * @param {object} options - Passed to {@link signJss}
228
+ * @param {boolean} [options.deep] - Also sign nested members (default true)
229
+ * @param {boolean} [options.allowInvalidatingSignatures] - Sign nested members even though existing root signatures will no longer verify
230
+ * @returns {object} The signed document
231
+ */
232
+ export declare function signJssBom(bom20: object, options?: {
233
+ deep?: boolean;
234
+ allowInvalidatingSignatures?: boolean;
235
+ }): object;
236
+ /**
237
+ * Verify the JSS signatures of a CycloneDX 2.0 BOM, root and nested, with
238
+ * the same policy {@link verifyBomSignatures} applies to JSF:
239
+ *
240
+ * - the root must carry `specFormat` (or `bomFormat`) "CycloneDX" and
241
+ * `specVersion`, and only members CycloneDX defines at the root;
242
+ * - the root signatures verify as {@link verifyJss} defines; with
243
+ * `requireAll`, every root signature object verifies with a trusted key
244
+ * and every trusted key verifies one of them;
245
+ * - with `deep` (default), every signed inventory, inventory component,
246
+ * composition and annotation verifies the same way (without the
247
+ * every-key rule) and carries none of `bomFormat`, `specFormat`,
248
+ * `specVersion`;
249
+ * - a BOM without root signatures fails unless `allowNestedOnly` is set;
250
+ * then `deep` must be on and every nested member must be signed.
251
+ *
252
+ * @param {object} bom20 - Signed CycloneDX 2.0 document
253
+ * @param {object} options - Trust options passed to {@link verifyJss}
254
+ * @param {boolean} [options.deep] - Also verify nested signatures (default true)
255
+ * @param {boolean} [options.requireAll] - Every signature object must verify with a trusted key
256
+ * @param {boolean} [options.allowNestedOnly] - Accept a BOM without root signatures when every nested member is signed
257
+ * @returns {{valid: boolean, trusted: boolean, errors: string[], root: (object|null), results: Array, nested: Array<{path: string, valid: boolean, trusted: boolean, reasons: string[], results: Array}>}}
258
+ * @throws {Error} When neither a trusted key nor allowEmbeddedKey is given
259
+ */
260
+ export declare function verifyJssBom(bom20: object, options?: {
261
+ deep?: boolean;
262
+ requireAll?: boolean;
263
+ allowNestedOnly?: boolean;
264
+ }): {
265
+ valid: boolean;
266
+ trusted: boolean;
267
+ errors: string[];
268
+ root: (object | null);
269
+ results: any[];
270
+ nested: Array<{
271
+ path: string;
272
+ valid: boolean;
273
+ trusted: boolean;
274
+ reasons: string[];
275
+ results: any[];
276
+ }>;
277
+ };
278
+ /**
279
+ * Generate a JSS key pair for an algorithm (used by --generate-key-and-sign).
280
+ *
281
+ * @param {string} algorithm - JSS algorithm name
282
+ * @returns {{privateKey: KeyObject, publicKey: KeyObject}}
283
+ */
284
+ export declare function generateJssKeyPair(algorithm: string): {
285
+ privateKey: KeyObject;
286
+ publicKey: KeyObject;
287
+ };
288
+ //# sourceMappingURL=jssSigner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jssSigner.d.ts","sourceRoot":"","sources":["../../../lib/helpers/jssSigner.js"],"names":[],"mappings":"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"}
@@ -3,28 +3,136 @@
3
3
  */
4
4
  export declare const VSCODE_EXTENSION_PURL_TYPE = "vscode-extension";
5
5
  /**
6
- * IDE configuration entries describing where each IDE stores its extensions.
7
- * Each entry contains the IDE name and an array of candidate extension
8
- * directory paths for Windows, macOS, and Linux (including remote/server
9
- * environments).
6
+ * Namespace of the `pkg:generic` purl given to an installed editor, which has
7
+ * no package type of its own.
8
+ */
9
+ export declare const IDE_PURL_NAMESPACE = "cdxgen-ide";
10
+ /**
11
+ * VS Code-family editors and remote servers whose installed extensions cdxgen
12
+ * can inventory.
13
+ *
14
+ * Every editor built from VS Code installs extensions into
15
+ * `<home>/<dataFolderName>/extensions` on Windows, macOS and Linux alike, and
16
+ * its remote server installs them into `<home>/<serverDataFolderName>/extensions`
17
+ * on the remote host. Settings and global storage live elsewhere (for example
18
+ * `~/Library/Application Support/Cursor/User`), and that folder never holds
19
+ * extensions.
20
+ *
21
+ * `apps` lists where the editor itself is installed, relative to the
22
+ * platform's application folders, so its version can be read from
23
+ * `resources/app/product.json` and `package.json`.
24
+ */
25
+ export declare const IDE_PRODUCTS: ({
26
+ id: string;
27
+ name: string;
28
+ dataFolderName: string;
29
+ serverDataFolderName: string;
30
+ apps: {
31
+ darwin: string[];
32
+ linux: string[];
33
+ win32: string[];
34
+ };
35
+ } | {
36
+ serverDataFolderName?: undefined;
37
+ id: string;
38
+ name: string;
39
+ dataFolderName: string;
40
+ apps: {
41
+ darwin?: undefined;
42
+ linux?: undefined;
43
+ win32?: undefined;
44
+ };
45
+ })[];
46
+ /**
47
+ * Describe where each known editor and remote server installs extensions for
48
+ * the given home directory.
10
49
  *
11
- * The paths use platform-specific logic via `homedir()` and common
12
- * environment variables.
50
+ * Each desktop editor contributes one entry for its own extensions folder and,
51
+ * when it has a remote server, a second entry for the server's folder. For the
52
+ * current user's home, the `VSCODE_EXTENSIONS` environment variable, which VS
53
+ * Code reads in place of the default folder, adds one more entry.
54
+ *
55
+ * @param {string} [home] Home directory to resolve the folders against
56
+ * @returns {Array<{id: string, name: string, kind: string, dirs: string[]}>}
57
+ * One entry per editor or server, with `kind` set to `desktop` or `server`
13
58
  */
14
- export declare function getIdeExtensionDirs(): {
59
+ export declare function getIdeExtensionDirs(home?: string): Array<{
60
+ id: string;
15
61
  name: string;
16
- dirs: any[];
17
- }[];
62
+ kind: string;
63
+ dirs: string[];
64
+ }>;
18
65
  /**
19
- * Discover all existing IDE extension directories on the current system.
66
+ * Discover the extension folders that exist for the given home directory.
20
67
  *
21
- * @returns {Array<{name: string, dir: string}>} Array of objects with IDE name
22
- * and the existing directory path.
68
+ * @param {string} [home] Home directory to resolve the folders against
69
+ * @returns {Array<{id: string, name: string, kind: string, dir: string, home: string}>}
70
+ * One entry per existing folder
23
71
  */
24
- export declare function discoverIdeExtensionDirs(): Array<{
72
+ export declare function discoverIdeExtensionDirs(home?: string): Array<{
73
+ id: string;
25
74
  name: string;
75
+ kind: string;
26
76
  dir: string;
77
+ home: string;
27
78
  }>;
79
+ /**
80
+ * Find the editor or server an extensions folder belongs to from its path,
81
+ * such as `~/.cursor/extensions` or `/home/dev/.cursor-server/extensions`.
82
+ *
83
+ * @param {string} extensionsDir Path to an extensions folder
84
+ * @returns {{id: string, name: string, kind: string, home: string}|undefined}
85
+ * The match, with the home folder it sits in, or undefined for a folder no
86
+ * known editor uses
87
+ */
88
+ export declare function identifyIdeFromExtensionsDir(extensionsDir: string): {
89
+ id: string;
90
+ name: string;
91
+ kind: string;
92
+ home: string;
93
+ } | undefined;
94
+ /**
95
+ * Read an editor's identity from the `product.json` and `package.json` in its
96
+ * `resources/app` folder (or the root of a remote server).
97
+ *
98
+ * Forks report their own release in different fields of `product.json`:
99
+ * `version` (Cursor, Kiro), `windsurfVersion` (Windsurf and Devin Desktop),
100
+ * `positronVersion`, `appVersion` (Trae) and `codeServerVersion`. VS Code
101
+ * itself has none of these and keeps its release in `package.json`, as every
102
+ * fork does for the VS Code release it is based on.
103
+ *
104
+ * @param {string} appDir Folder holding `product.json`
105
+ * @returns {Object|undefined} `{ version, vscodeVersion, commit, quality,
106
+ * nameLong, dataFolderName, serverDataFolderName, appDir }`, or undefined
107
+ * when there is no product.json
108
+ */
109
+ export declare function readIdeProductInfo(appDir: string): Object | undefined;
110
+ /**
111
+ * Find the installed editor (or remote server) for an extensions folder and
112
+ * read its identity.
113
+ *
114
+ * A remote server is looked up in the home the folder is in. A desktop editor
115
+ * and code-server are looked up in the application folders of the machine
116
+ * running cdxgen, so that lookup happens only when `probeApps` is true: for a
117
+ * scan of this host, not for a folder copied from another machine.
118
+ *
119
+ * @param {{id: string, kind: string}} ide Entry from discoverIdeExtensionDirs
120
+ * @param {string} [home] Home directory
121
+ * @param {Object} [options] Lookup options
122
+ * @param {boolean} [options.probeApps] Look in this machine's application
123
+ * folders; defaults to true only for the current user's home
124
+ * @param {string[]} [options.appDirs] Folders to read in place of the
125
+ * application folders
126
+ * @returns {Object|undefined} Result of readIdeProductInfo for the newest
127
+ * installation whose data folder matches, or undefined
128
+ */
129
+ export declare function findIdeProductInfo(ide: {
130
+ id: string;
131
+ kind: string;
132
+ }, home?: string, options?: {
133
+ probeApps?: boolean;
134
+ appDirs?: string[];
135
+ }): Object | undefined;
28
136
  /**
29
137
  * Parse a `.vsixmanifest` XML string and extract extension metadata.
30
138
  *
@@ -78,6 +186,14 @@ export declare function extractExtensionCapabilities(pkg: Object): Object;
78
186
  * @returns {Object|undefined} CycloneDX component object or undefined
79
187
  */
80
188
  export declare function toComponent(extInfo: Object, ideName?: string): Object | undefined;
189
+ /**
190
+ * True when a .vsix path is a regular file. A FIFO or a device named `*.vsix`
191
+ * would block or never end, and a root scan does not follow a symlink.
192
+ *
193
+ * @param {string} vsixFile Path to the .vsix
194
+ * @returns {boolean} true when the archive can be opened
195
+ */
196
+ export declare function isReadableVsix(vsixFile: string): boolean;
81
197
  /**
82
198
  * Extract a `.vsix` file (ZIP archive) to a temporary directory for deep
83
199
  * analysis. The caller is responsible for cleaning up the temp directory.
@@ -100,23 +216,156 @@ export declare function cleanupTempDir(tempDir: string): void;
100
216
  */
101
217
  export declare function parseVsixFile(vsixFile: string): Promise<Object | undefined>;
102
218
  /**
103
- * Parse a single installed extension directory (already extracted).
104
- * Looks for `package.json` (preferred) and `.vsixmanifest`.
219
+ * Read the install registry an editor keeps beside its extensions.
220
+ *
221
+ * `extensions.json` lists every installed extension with where it came from
222
+ * and when it was installed. `.obsolete` names the folders of extensions that
223
+ * were uninstalled or replaced by an update but are still on disk until the
224
+ * editor next starts. Folder names from either file are only compared with the
225
+ * names in the folder, never turned into paths.
226
+ *
227
+ * @param {string} extensionsDir Extensions folder
228
+ * @returns {{records: Map<string, Object>, obsolete: Set<string>, hasRegistry: boolean}}
229
+ * Install records keyed by folder name, the obsolete folder names, and
230
+ * whether an extensions.json was read
231
+ */
232
+ export declare function readInstalledExtensionsRegistry(extensionsDir: string): {
233
+ records: Map<string, Object>;
234
+ obsolete: Set<string>;
235
+ hasRegistry: boolean;
236
+ };
237
+ /**
238
+ * Hash the `main` and `browser` entry files of an installed extension the way
239
+ * the extension host resolves them: the path as written, with a `.js` suffix,
240
+ * or as a folder holding `index.js`. Only regular files that stay inside the
241
+ * extension folder are read; a symlink, a FIFO or a path that leaves the
242
+ * folder is not.
243
+ *
244
+ * @param {string} extDir Installed extension folder
245
+ * @param {{main?: string, browser?: string}} entries Entry points from
246
+ * package.json
247
+ * @returns {Array<{role: string, name: string, digest: string, path: string}>}
248
+ * One entry per hashed file, with its path relative to the folder
249
+ */
250
+ export declare function hashExtensionEntryFiles(extDir: string, entries: {
251
+ main?: string;
252
+ browser?: string;
253
+ }): Array<{
254
+ role: string;
255
+ name: string;
256
+ digest: string;
257
+ path: string;
258
+ }>;
259
+ /**
260
+ * Describe the code an installed extension runs as `file` components with
261
+ * their SHA-256, so the extension can be matched against a published hash of
262
+ * a known good or known bad build.
263
+ *
264
+ * @param {string} extDir Installed extension folder
265
+ * @param {Object} capabilities Capabilities from extractExtensionCapabilities
266
+ * @param {string} parentRef bom-ref of the extension component
267
+ * @returns {Object[]} File components, empty when no entry file is found
268
+ */
269
+ export declare function describeExtensionEntryFiles(extDir: string, capabilities: Object, parentRef: string): Object[];
270
+ /**
271
+ * Parse a single installed extension folder.
105
272
  *
106
- * @param {string} extDir Absolute path to the extension directory (e.g. `~/.vscode/extensions/ms-python.python-2023.1.0`)
107
- * @param {string} [ideName] Optional IDE name
273
+ * `package.json` gives the identity and capabilities. The `.vsixmanifest` the
274
+ * editor keeps beside it adds the target platform, links and manifest
275
+ * properties, and the folder name supplies the platform when neither does.
276
+ *
277
+ * @param {string} extDir Absolute path to the extension folder (e.g. `~/.cursor/extensions/anthropic.claude-code-2.1.313-darwin-arm64`)
278
+ * @param {string} [ideName] Name of the editor the folder belongs to
279
+ * @param {Object} [installRecord] Entry for the folder from extensions.json
280
+ * @param {Object} [options] Parse options
281
+ * @param {boolean} [options.nameOnly] Read only the folder name, as a root
282
+ * scan does for a symlinked folder
108
283
  * @returns {Object|undefined} CycloneDX component object or undefined
109
284
  */
110
- export declare function parseInstalledExtensionDir(extDir: string, ideName?: string): Object | undefined;
285
+ export declare function parseInstalledExtensionDir(extDir: string, ideName?: string, installRecord?: Object, options?: {
286
+ nameOnly?: boolean;
287
+ }): Object | undefined;
111
288
  /**
112
289
  * Attempt to extract extension metadata from a directory name following the
113
- * pattern `publisher.name-version`.
290
+ * pattern `publisher.name-version` or `publisher.name-version-platform`.
114
291
  *
115
292
  * @param {string} extDir Absolute path to extension directory
116
293
  * @param {string} [ideName] IDE name
117
294
  * @returns {Object|undefined} CycloneDX component or undefined
118
295
  */
119
296
  export declare function parseExtensionDirName(extDir: string, ideName?: string): Object | undefined;
297
+ /**
298
+ * Decide whether a folder is an editor's extensions folder: one at a path a
299
+ * known editor uses, or one holding the `extensions.json` or `.obsolete` an
300
+ * editor writes. A source repository whose subfolders happen to include an
301
+ * extension is not one.
302
+ *
303
+ * @param {string} dir Folder to check
304
+ * @returns {boolean} True when the folder is an extensions folder
305
+ */
306
+ export declare function isInstalledExtensionsDir(dir: string): boolean;
307
+ /**
308
+ * Decide whether a folder is one installed extension: a `.vsixmanifest`, or a
309
+ * package.json with a publisher and a `vscode` engine.
310
+ *
311
+ * @param {string} dir Folder to check
312
+ * @returns {boolean} True for an extension folder
313
+ */
314
+ export declare function isInstalledExtensionDir(dir: string): boolean;
315
+ /**
316
+ * Build a CycloneDX component for an installed editor or remote server.
317
+ *
318
+ * @param {{id: string, name: string, kind: string, dirs?: string[], dir?: string, home?: string}} ide
319
+ * Discovered extensions folder, or folders, of one editor
320
+ * @param {Object} [productInfo] Result of findIdeProductInfo
321
+ * @param {number} extensionCount Number of extension builds found
322
+ * @returns {Object} CycloneDX application component
323
+ */
324
+ export declare function toIdeComponent(ide: {
325
+ id: string;
326
+ name: string;
327
+ kind: string;
328
+ dirs?: string[];
329
+ dir?: string;
330
+ home?: string;
331
+ }, productInfo?: Object, extensionCount: number): Object;
332
+ /**
333
+ * Collect the installed extensions of each editor folder, plus a component for
334
+ * each editor and the dependency edges from an editor to its extensions.
335
+ *
336
+ * One extension installed in two editors is one component: the editors are
337
+ * listed in `cdx:vscode-extension:ide`, every folder it was found in is an
338
+ * occurrence, and every copy's entry files are hashed. When two copies of the
339
+ * same build have different entry-file bytes, each digest becomes its own file
340
+ * component and the extension is marked `cdx:vscode-extension:entryHashMismatch`.
341
+ *
342
+ * @param {Array<{id?: string, name?: string, kind?: string, dir: string, home?: string, only?: string, probeApps?: boolean}>} ideDirs
343
+ * Extensions folders, as returned by discoverIdeExtensionDirs. `only` limits
344
+ * a folder to one extension; `home` and `probeApps` say where the editor's
345
+ * own version is looked up (see findIdeProductInfo)
346
+ * @param {Object} [options] Collection options
347
+ * @param {boolean} [options.includeIdeComponents=true] Emit a component for
348
+ * each editor and link it to its extensions
349
+ * @param {string} [options.home] Home directory used when a folder names none
350
+ * @param {boolean} [options.probeApps] Default for folders that do not say
351
+ * @returns {{components: Object[], dependencies: Object[]}} Inventory
352
+ */
353
+ export declare function collectIdeInventory(ideDirs: Array<{
354
+ id?: string;
355
+ name?: string;
356
+ kind?: string;
357
+ dir: string;
358
+ home?: string;
359
+ only?: string;
360
+ probeApps?: boolean;
361
+ }>, options?: {
362
+ includeIdeComponents?: boolean;
363
+ home?: string;
364
+ probeApps?: boolean;
365
+ }): {
366
+ components: Object[];
367
+ dependencies: Object[];
368
+ };
120
369
  /**
121
370
  * Collect all installed extensions from a set of IDE extension directories.
122
371
  *
@@ -127,4 +376,39 @@ export declare function collectInstalledExtensions(ideDirs: Array<{
127
376
  name: string;
128
377
  dir: string;
129
378
  }>): Object[];
379
+ /**
380
+ * Merge two descriptions of the same extension build, such as a `.vsix` file
381
+ * and the folder it was installed into, so neither loses its hashes,
382
+ * occurrences, entry files or properties.
383
+ *
384
+ * @param {Object[]} components Components, some of which share a bom-ref
385
+ * @returns {Object[]} Components with one entry per extension bom-ref
386
+ */
387
+ export declare function mergeExtensionComponents(components: Object[]): Object[];
388
+ /**
389
+ * Add the host's editors and the extensions osquery could not see to an OBOM
390
+ * component list.
391
+ *
392
+ * osquery's `vscode_extensions` table reads `extensions.json` for a fixed set
393
+ * of editors, so extensions of other editors, and folders an editor never
394
+ * registered, are missing from its rows. The editor folders of each home are
395
+ * read here: an extension osquery already reported keeps its row and gains the
396
+ * editor names, the occurrences and the hashed entry files, and the rest are
397
+ * added. Every editor found also becomes a component. No dependency edges are
398
+ * added, because an OBOM has no dependency graph.
399
+ *
400
+ * @param {Object[]} pkgList OBOM components, which are updated in place
401
+ * @param {Object} [options] Collection options
402
+ * @param {string[]} [options.homes] Home directories to read
403
+ * @param {string} [options.home] One home directory to read, used when
404
+ * `homes` is not given; defaults to the current user's
405
+ * @param {Array<Object>} [options.ideDirs] Extensions folders to read in place
406
+ * of discovering them
407
+ * @returns {Object[]} Components to append to the OBOM
408
+ */
409
+ export declare function collectObomIdeInventory(pkgList: Object[], options?: {
410
+ homes?: string[];
411
+ home?: string;
412
+ ideDirs?: Array<Object>;
413
+ }): Object[];
130
414
  //# sourceMappingURL=vsixutils.d.ts.map