@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,184 @@
1
+ import { basename } from "node:path";
2
+
3
+ import { registerRunReset } from "./runState.js";
4
+
5
+ /**
6
+ * Run-scoped registry of the external tools cdxgen actually executed, feeding
7
+ * the `metadata.tools` section (issue #598). `safeSpawnSync` records a command
8
+ * once the process has started, so a binary that is missing or a spawn that
9
+ * was blocked never appears, and the stages that already know a tool's
10
+ * version - such as the JVM tool resolution in pregen - enrich the entry; no
11
+ * process is ever spawned just to learn a version.
12
+ *
13
+ * The registry is filled in as the run progresses and read once per BOM when
14
+ * the metadata section is assembled. A run that spawns nothing external keeps
15
+ * it empty, which is what keeps such BOMs byte-identical to the previous
16
+ * behaviour. It is per-run state: a long-lived process such as the server
17
+ * empties it between scans through {@link resetRunState}.
18
+ *
19
+ * @type {Map<string, {name: string, version: (string|undefined)}>}
20
+ */
21
+ const EXECUTED_TOOLS = new Map();
22
+
23
+ /**
24
+ * Versions stages already resolved for a tool, keyed like EXECUTED_TOOLS. They
25
+ * are applied only to tools that actually started, so provisioning a tool the
26
+ * run then never invokes adds nothing to `metadata.tools`.
27
+ *
28
+ * @type {Map<string, string>}
29
+ */
30
+ const KNOWN_VERSIONS = new Map();
31
+
32
+ /**
33
+ * Interpreter and shell binaries that wrap the real work. They appear on
34
+ * nearly every spawn, so recording them would drown the tools that actually
35
+ * generated the BOM.
36
+ *
37
+ * @type {Set<string>}
38
+ */
39
+ const WRAPPER_BASENAMES = new Set([
40
+ "bash",
41
+ "cmd",
42
+ "cmd.exe",
43
+ "node",
44
+ "powershell",
45
+ "powershell.exe",
46
+ "pwsh",
47
+ "sh",
48
+ "zsh",
49
+ ]);
50
+
51
+ /**
52
+ * Commands cdxgen runs to learn about the machine it runs on rather than the
53
+ * project, such as `ldd --version` choosing between the glibc and musl
54
+ * plugin binaries. They did not help generate the BOM, so they are not tools
55
+ * of it.
56
+ *
57
+ * @type {Set<string>}
58
+ */
59
+ const HOST_PROBE_BASENAMES = new Set(["ldd"]);
60
+
61
+ /**
62
+ * Strip a trailing Windows executable suffix from a binary name.
63
+ *
64
+ * @param {string} name Binary name
65
+ * @returns {string} Name without a trailing `.exe`, `.bat`, or `.cmd`
66
+ */
67
+ function trimWindowsSuffix(name) {
68
+ for (const suffix of [".exe", ".bat", ".cmd"]) {
69
+ if (name.endsWith(suffix)) {
70
+ return name.slice(0, -suffix.length);
71
+ }
72
+ }
73
+ return name;
74
+ }
75
+
76
+ /**
77
+ * Name a tool the way the registry keys it: the basename without a Windows
78
+ * executable suffix, and without the `-cdxgen-<os>-<arch>` suffix of a
79
+ * bundled cdxgen-plugins-bin helper, so `trivy-cdxgen-linux-amd64` is `trivy`
80
+ * on every platform and matches its plugin manifest entry.
81
+ *
82
+ * @param {string} name Tool name as invoked (a bare name or a path)
83
+ * @returns {string} Tool name
84
+ */
85
+ function toolNameOf(name) {
86
+ const toolName = trimWindowsSuffix(basename(`${name}`.split("\\").join("/")));
87
+ const pluginSuffixAt = toolName.lastIndexOf("-cdxgen-");
88
+ if (
89
+ pluginSuffixAt > 0 &&
90
+ toolName.slice(pluginSuffixAt + "-cdxgen-".length).split("-").length === 2
91
+ ) {
92
+ return toolName.slice(0, pluginSuffixAt);
93
+ }
94
+ return toolName;
95
+ }
96
+
97
+ /**
98
+ * Record an external tool cdxgen executed. The first version seen wins unless
99
+ * it was unknown, so an enriched probe never overwrites a concrete version
100
+ * with `undefined` and a later concrete version fills an earlier gap.
101
+ *
102
+ * @param {string} name Tool name as invoked (a bare name or a path)
103
+ * @param {string|undefined} version Version when cheaply known
104
+ */
105
+ export function recordExecutedTool(name, version) {
106
+ if (typeof name !== "string" || !name) {
107
+ return;
108
+ }
109
+ const toolName = toolNameOf(name);
110
+ if (
111
+ !toolName ||
112
+ WRAPPER_BASENAMES.has(toolName) ||
113
+ HOST_PROBE_BASENAMES.has(toolName)
114
+ ) {
115
+ return;
116
+ }
117
+ const key = toolName.toLowerCase();
118
+ const existing = EXECUTED_TOOLS.get(key);
119
+ if (!existing) {
120
+ EXECUTED_TOOLS.set(key, {
121
+ name: toolName,
122
+ version: typeof version === "string" && version ? version : undefined,
123
+ });
124
+ return;
125
+ }
126
+ if (typeof version === "string" && version && !existing.version) {
127
+ existing.version = version;
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Remember the version a stage already resolved for a tool, such as the JVM
133
+ * build tool pregen provisioned. The version shows in `metadata.tools` only if
134
+ * the tool is executed; the first version recorded wins.
135
+ *
136
+ * @param {string} name Tool name as it will be invoked (a bare name or a path)
137
+ * @param {string} version Resolved version
138
+ */
139
+ export function recordToolVersion(name, version) {
140
+ if (typeof name !== "string" || !name) {
141
+ return;
142
+ }
143
+ if (typeof version !== "string" || !version) {
144
+ return;
145
+ }
146
+ const key = toolNameOf(name).toLowerCase();
147
+ if (key && !KNOWN_VERSIONS.has(key)) {
148
+ KNOWN_VERSIONS.set(key, version);
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Snapshot of the tools recorded so far, sorted by name so the assembled
154
+ * `metadata.tools` diff stays stable between runs.
155
+ *
156
+ * @returns {Array<{name: string, version: (string|undefined)}>} Sorted tool records
157
+ */
158
+ export function getExecutedTools() {
159
+ return [...EXECUTED_TOOLS.entries()]
160
+ .map(([key, tool]) => ({
161
+ name: tool.name,
162
+ version: tool.version || KNOWN_VERSIONS.get(key),
163
+ }))
164
+ .sort((a, b) =>
165
+ a.name === b.name
166
+ ? 0
167
+ : a.name.toLowerCase() < b.name.toLowerCase()
168
+ ? -1
169
+ : 1,
170
+ );
171
+ }
172
+
173
+ /**
174
+ * Clear the registry. The server calls it between scans through the run-state
175
+ * reset; tests call it directly.
176
+ *
177
+ * @returns {void}
178
+ */
179
+ export function resetExecutedTools() {
180
+ EXECUTED_TOOLS.clear();
181
+ KNOWN_VERSIONS.clear();
182
+ }
183
+
184
+ registerRunReset("toolRegistry.executedTools", resetExecutedTools);
@@ -19,6 +19,7 @@ import {
19
19
  import { build } from "@cdxgen/cdx-purl";
20
20
 
21
21
  import { DEBUG_MODE } from "../core/activity.js";
22
+ import { readRegularTextFile } from "../core/boundedFile.js";
22
23
  import { getAllFiles, safeExistsSync } from "../core/fs.js";
23
24
  import { thoughtLog } from "../core/logger.js";
24
25
  import { CPP_STD_MODULES } from "../core/state.js";
@@ -29,6 +30,7 @@ import { locateGenericPackage } from "../inventory/purl.js";
29
30
  import {
30
31
  createIncludeAttributor,
31
32
  parseCIncludeSlices,
33
+ readVcpkgInstalledIndex,
32
34
  } from "./cppIncludeResolver.js";
33
35
  import {
34
36
  parseCmakeLikeFile,
@@ -218,6 +220,243 @@ export function hasCppSources(src, options = {}) {
218
220
  );
219
221
  }
220
222
 
223
+ const MAX_VCPKG_MANIFEST_BYTES = 4 * 1024 * 1024;
224
+
225
+ /**
226
+ * The ports vcpkg installed into the `vcpkg_installed` directories of a
227
+ * project and its build trees, by lower-case port name.
228
+ *
229
+ * @param {string} src project directory
230
+ * @param {Object} options CLI options, for the build-directory candidates
231
+ * @returns {Map<string, {version: string, triplet: string}>}
232
+ */
233
+ export function installedVcpkgPorts(src, options = {}) {
234
+ const ports = new Map();
235
+ const installedDirs = [src, ...cmakeBuildDirCandidates(src, options)]
236
+ .map((dir) => join(dir, "vcpkg_installed"))
237
+ .filter((dir) => safeExistsSync(dir));
238
+ if (!installedDirs.length) {
239
+ return ports;
240
+ }
241
+ for (const { port, version, triplet, portVersion } of readVcpkgInstalledIndex(
242
+ installedDirs,
243
+ ).values()) {
244
+ if (!ports.has(port.toLowerCase())) {
245
+ ports.set(port.toLowerCase(), {
246
+ version,
247
+ triplet,
248
+ ...(portVersion ? { portVersion } : {}),
249
+ });
250
+ }
251
+ }
252
+ return ports;
253
+ }
254
+
255
+ /**
256
+ * The version a vcpkg manifest pins for a port in its `overrides`, from any of
257
+ * the four version fields vcpkg accepts, and the port version, which is a
258
+ * packaging revision of the same upstream release.
259
+ * https://learn.microsoft.com/vcpkg/reference/vcpkg-json#overrides
260
+ *
261
+ * @param {Object} override one `overrides` entry
262
+ * @returns {{version: string, portVersion?: string}|undefined}
263
+ */
264
+ function vcpkgOverrideVersion(override) {
265
+ if (!override || typeof override !== "object") {
266
+ return undefined;
267
+ }
268
+ const version = [
269
+ "version",
270
+ "version-semver",
271
+ "version-date",
272
+ "version-string",
273
+ ]
274
+ .map((field) => override[field])
275
+ .find((value) => typeof value === "string" && value.trim());
276
+ if (!version) {
277
+ return undefined;
278
+ }
279
+ const portVersion = Number(override["port-version"]);
280
+ return Number.isInteger(portVersion) && portVersion > 0
281
+ ? { version: version.trim(), portVersion: String(portVersion) }
282
+ : { version: version.trim() };
283
+ }
284
+
285
+ /**
286
+ * Read a vcpkg manifest (vcpkg.json) in a directory: the project it describes
287
+ * and the ports it declares. A port's version comes from what vcpkg installed
288
+ * in the build tree when that is known, otherwise from the manifest's
289
+ * `overrides`, which pin it exactly. A `version>=` constraint is only a
290
+ * minimum, so it is kept as a property, never as the version.
291
+ * https://learn.microsoft.com/vcpkg/reference/vcpkg-json
292
+ *
293
+ * The read is cheap and runs no tool, so it does not wait for the atom-based
294
+ * analysis that getCppModules adds.
295
+ *
296
+ * @param {string} src directory that may hold vcpkg.json
297
+ * @param {Object} [options] options
298
+ * @param {Map<string, {version: string, triplet: string}>} [options.installedPorts]
299
+ * ports vcpkg installed, by lower-case name
300
+ * @param {function(string): boolean} [options.isListed] whether another source
301
+ * already lists a port by that name
302
+ * @returns {{parentComponent: Object|undefined, pkgList: Object[]}}
303
+ */
304
+ export function parseVcpkgManifest(src, options = {}) {
305
+ const pkgType = "generic";
306
+ const result = { parentComponent: undefined, pkgList: [] };
307
+ const manifestFile = join(src, "vcpkg.json");
308
+ if (!safeExistsSync(manifestFile)) {
309
+ return result;
310
+ }
311
+ let vcPkgData;
312
+ try {
313
+ // A regular file only: a FIFO named vcpkg.json would block a plain read.
314
+ vcPkgData = JSON.parse(
315
+ readRegularTextFile(manifestFile, MAX_VCPKG_MANIFEST_BYTES) ?? "",
316
+ );
317
+ } catch {
318
+ return result;
319
+ }
320
+ if (!vcPkgData || typeof vcPkgData !== "object") {
321
+ return result;
322
+ }
323
+ const installedPorts = options.installedPorts || new Map();
324
+ const isListed = options.isListed || (() => false);
325
+ const overrides = new Map();
326
+ if (Array.isArray(vcPkgData.overrides)) {
327
+ for (const override of vcPkgData.overrides) {
328
+ const version = vcpkgOverrideVersion(override);
329
+ if (typeof override?.name === "string" && version) {
330
+ overrides.set(override.name.toLowerCase(), version);
331
+ }
332
+ }
333
+ }
334
+ if (vcPkgData.name) {
335
+ const parentPurl = build({
336
+ type: pkgType,
337
+ namespace: null,
338
+ name: vcPkgData.name,
339
+ version: vcPkgData.version || vcPkgData["version-string"] || null,
340
+ });
341
+ const parentComponent = {
342
+ name: vcPkgData.name,
343
+ version: vcPkgData.version || vcPkgData["version-string"] || "",
344
+ description: vcPkgData.description,
345
+ license: vcPkgData.license,
346
+ purl: parentPurl,
347
+ type: "application",
348
+ "bom-ref": decodeURIComponent(parentPurl),
349
+ };
350
+ if (vcPkgData.homepage) {
351
+ parentComponent.homepage = { url: vcPkgData.homepage };
352
+ }
353
+ // The builtin baseline is the vcpkg commit that pins every port version,
354
+ // so it identifies the version set the manifest resolves against.
355
+ if (typeof vcPkgData["builtin-baseline"] === "string") {
356
+ parentComponent.properties = [
357
+ {
358
+ name: "cdx:vcpkg:baseline",
359
+ value: vcPkgData["builtin-baseline"],
360
+ },
361
+ ];
362
+ }
363
+ result.parentComponent = parentComponent;
364
+ }
365
+ if (!Array.isArray(vcPkgData.dependencies)) {
366
+ return result;
367
+ }
368
+ const added = new Set();
369
+ for (const avcdep of vcPkgData.dependencies) {
370
+ let avcpkgName;
371
+ let scope;
372
+ let vcpkgFeatures;
373
+ let minimumVersion;
374
+ if (typeof avcdep === "string" || avcdep instanceof String) {
375
+ avcpkgName = `${avcdep}`;
376
+ } else if (avcdep && typeof avcdep === "object" && avcdep.name) {
377
+ avcpkgName = avcdep.name;
378
+ if (avcdep.host) {
379
+ scope = "optional";
380
+ }
381
+ vcpkgFeatures = Array.isArray(avcdep.features)
382
+ ? avcdep.features
383
+ .map((feature) =>
384
+ typeof feature === "string" ? feature : feature?.name,
385
+ )
386
+ .filter(Boolean)
387
+ .join(",")
388
+ : undefined;
389
+ if (typeof avcdep["version>="] === "string") {
390
+ minimumVersion = avcdep["version>="];
391
+ }
392
+ }
393
+ // Is this a dependency we haven't seen before including the all lower and upper case version?
394
+ if (!avcpkgName || isListed(avcpkgName) || added.has(avcpkgName)) {
395
+ continue;
396
+ }
397
+ added.add(avcpkgName);
398
+ // the version vcpkg installed, when the build tree has the port, else the
399
+ // version the manifest's overrides pin
400
+ const installed = installedPorts.get(avcpkgName.toLowerCase());
401
+ const overridden = overrides.get(avcpkgName.toLowerCase());
402
+ const version = installed?.version || overridden?.version || "";
403
+ const pkgPurl = build({
404
+ type: pkgType,
405
+ namespace: null,
406
+ name: avcpkgName,
407
+ version: version || null,
408
+ });
409
+ result.pkgList.push({
410
+ group: "",
411
+ name: avcpkgName,
412
+ type: pkgType,
413
+ version,
414
+ purl: pkgPurl,
415
+ scope,
416
+ "bom-ref": decodeURIComponent(pkgPurl),
417
+ properties: [
418
+ { name: "cdx:vcpkg:declared", value: "true" },
419
+ ...(vcpkgFeatures
420
+ ? [{ name: "cdx:vcpkg:features", value: vcpkgFeatures }]
421
+ : []),
422
+ ...(installed
423
+ ? [{ name: "cdx:vcpkg:triplet", value: installed.triplet }]
424
+ : []),
425
+ ...(!installed && overridden
426
+ ? [{ name: "cdx:vcpkg:versionSource", value: "override" }]
427
+ : []),
428
+ ...((installed ? installed.portVersion : overridden?.portVersion)
429
+ ? [
430
+ {
431
+ name: "cdx:vcpkg:portVersion",
432
+ value: installed
433
+ ? installed.portVersion
434
+ : overridden.portVersion,
435
+ },
436
+ ]
437
+ : []),
438
+ ...(minimumVersion
439
+ ? [{ name: "cdx:vcpkg:minimumVersion", value: minimumVersion }]
440
+ : []),
441
+ ],
442
+ evidence: {
443
+ identity: {
444
+ field: "purl",
445
+ confidence: 0.5,
446
+ methods: [
447
+ {
448
+ technique: "source-code-analysis",
449
+ confidence: 0.5,
450
+ value: `Filename ${manifestFile}`,
451
+ },
452
+ ],
453
+ },
454
+ },
455
+ });
456
+ }
457
+ return result;
458
+ }
459
+
221
460
  /**
222
461
  * Method to find c/c++ modules by collecting usages with atom
223
462
  *
@@ -263,111 +502,24 @@ export function getCppModules(
263
502
  const vcpkgPorts = attributeInclude.vcpkgPorts();
264
503
  // Let's look for any vcpkg.json file to tell us about the directory we're scanning
265
504
  // users can use this file to give us a clue even if they do not use vcpkg library manager
266
- if (safeExistsSync(join(src, "vcpkg.json"))) {
267
- const vcPkgData = JSON.parse(
268
- readFileSync(join(src, "vcpkg.json"), { encoding: "utf-8" }),
269
- );
270
- if (vcPkgData && Object.keys(vcPkgData).length && vcPkgData.name) {
271
- const parentPurl = build({
272
- type: pkgType,
273
- namespace: "" || null,
274
- name: vcPkgData.name,
275
- version: vcPkgData.version || "" || null,
276
- });
277
- parentComponent = {
278
- name: vcPkgData.name,
279
- version: vcPkgData.version || "",
280
- description: vcPkgData.description,
281
- license: vcPkgData.license,
282
- purl: parentPurl,
283
- type: "application",
284
- "bom-ref": decodeURIComponent(parentPurl),
285
- };
286
- if (vcPkgData.homepage) {
287
- parentComponent.homepage = { url: vcPkgData.homepage };
288
- }
289
- // The builtin baseline is the vcpkg commit that pins every port version,
290
- // so it identifies the version set the manifest resolves against.
291
- if (typeof vcPkgData["builtin-baseline"] === "string") {
292
- parentComponent.properties = [
293
- {
294
- name: "cdx:vcpkg:baseline",
295
- value: vcPkgData["builtin-baseline"],
296
- },
297
- ];
298
- }
299
- // Are there any dependencies declared in vcpkg.json
300
- if (vcPkgData.dependencies && Array.isArray(vcPkgData.dependencies)) {
301
- for (const avcdep of vcPkgData.dependencies) {
302
- let avcpkgName;
303
- let scope;
304
- let vcpkgFeatures;
305
- if (typeof avcdep === "string" || avcdep instanceof String) {
306
- avcpkgName = avcdep;
307
- } else if (Object.keys(avcdep).length && avcdep.name) {
308
- avcpkgName = avcdep.name;
309
- if (avcdep.host) {
310
- scope = "optional";
311
- }
312
- vcpkgFeatures = Array.isArray(avcdep.features)
313
- ? avcdep.features.join(",")
314
- : undefined;
315
- }
316
- // Is this a dependency we haven't seen before including the all lower and upper case version?
317
- if (
318
- avcpkgName &&
319
- !epkgMap[epkgKey("", avcpkgName)] &&
320
- !epkgMap[epkgKey("", avcpkgName.toLowerCase())] &&
321
- !epkgMap[epkgKey("", avcpkgName.toUpperCase())]
322
- ) {
323
- // the version vcpkg installed, when the build tree has the port
324
- const installed = vcpkgPorts.get(avcpkgName.toLowerCase());
325
- const pkgPurl = build({
326
- type: pkgType,
327
- namespace: "" || null,
328
- name: avcpkgName,
329
- version: installed?.version || null,
330
- });
331
- const apkg = {
332
- group: "",
333
- name: avcpkgName,
334
- type: pkgType,
335
- version: installed?.version || "",
336
- purl: pkgPurl,
337
- scope,
338
- "bom-ref": decodeURIComponent(pkgPurl),
339
- properties: [
340
- { name: "cdx:vcpkg:declared", value: "true" },
341
- ...(vcpkgFeatures
342
- ? [{ name: "cdx:vcpkg:features", value: vcpkgFeatures }]
343
- : []),
344
- ...(installed
345
- ? [{ name: "cdx:vcpkg:triplet", value: installed.triplet }]
346
- : []),
347
- ],
348
- evidence: {
349
- identity: {
350
- field: "purl",
351
- confidence: 0.5,
352
- methods: [
353
- {
354
- technique: "source-code-analysis",
355
- confidence: 0.5,
356
- value: `Filename ${join(src, "vcpkg.json")}`,
357
- },
358
- ],
359
- },
360
- },
361
- };
362
- if (!pkgAddedMap[avcpkgName]) {
363
- pkgList.push(apkg);
364
- dependsOn.add(apkg["bom-ref"]);
365
- pkgAddedMap[avcpkgName] = true;
366
- }
367
- }
368
- }
369
- }
370
- } // if
505
+ const manifest = parseVcpkgManifest(src, {
506
+ installedPorts: vcpkgPorts,
507
+ isListed: (name) =>
508
+ Boolean(
509
+ epkgMap[epkgKey("", name)] ||
510
+ epkgMap[epkgKey("", name.toLowerCase())] ||
511
+ epkgMap[epkgKey("", name.toUpperCase())],
512
+ ),
513
+ });
514
+ if (manifest.parentComponent) {
515
+ parentComponent = manifest.parentComponent;
516
+ }
517
+ for (const apkg of manifest.pkgList) {
518
+ if (!pkgAddedMap[apkg.name]) {
519
+ pkgList.push(apkg);
520
+ dependsOn.add(apkg["bom-ref"]);
521
+ pkgAddedMap[apkg.name] = true;
522
+ }
371
523
  }
372
524
  // xmake locks its resolved requirements in `xmake-requires.lock`; the
373
525
  // entries are additions to whatever other evidence collectors found.
@@ -464,7 +616,12 @@ export function getCppModules(
464
616
  name: target.port,
465
617
  version: target.version || null,
466
618
  }),
467
- properties: [{ name: "cdx:vcpkg:triplet", value: target.triplet }],
619
+ properties: [
620
+ { name: "cdx:vcpkg:triplet", value: target.triplet },
621
+ ...(target.portVersion
622
+ ? [{ name: "cdx:vcpkg:portVersion", value: target.portVersion }]
623
+ : []),
624
+ ],
468
625
  technique: "manifest-analysis",
469
626
  };
470
627
  } else {
@@ -70,7 +70,7 @@ export function parseCIncludeSlices(sliceData) {
70
70
  * line relative to the installed directory.
71
71
  *
72
72
  * @param {string[]} installedDirs `vcpkg_installed` directories
73
- * @returns {Map<string, {port: string, version: string, triplet: string}>}
73
+ * @returns {Map<string, {port: string, version: string, triplet: string, portVersion?: string}>}
74
74
  */
75
75
  export function readVcpkgInstalledIndex(installedDirs) {
76
76
  const index = new Map();
@@ -90,7 +90,9 @@ export function readVcpkgInstalledIndex(installedDirs) {
90
90
  continue;
91
91
  }
92
92
  const port = stem.slice(0, first);
93
- const version = stem.slice(first + 1, last);
93
+ // vcpkg spells a port version as `<version>#<port-version>`; the port
94
+ // version is a packaging revision of the same upstream release.
95
+ const [version, portVersion] = stem.slice(first + 1, last).split("#");
94
96
  const triplet = stem.slice(last + 1);
95
97
  let text = "";
96
98
  try {
@@ -103,7 +105,12 @@ export function readVcpkgInstalledIndex(installedDirs) {
103
105
  if (!rel || rel.endsWith("/")) {
104
106
  continue;
105
107
  }
106
- index.set(resolve(dir, rel), { port, version, triplet });
108
+ index.set(resolve(dir, rel), {
109
+ port,
110
+ version,
111
+ triplet,
112
+ ...(portVersion ? { portVersion } : {}),
113
+ });
107
114
  }
108
115
  }
109
116
  }
@@ -282,9 +289,13 @@ export function createIncludeAttributor(context) {
282
289
  attribute.vcpkgPorts = () => {
283
290
  const ports = new Map();
284
291
  if (installedDirs.length) {
285
- for (const { port, version, triplet } of vcpkg().values()) {
292
+ for (const { port, version, triplet, portVersion } of vcpkg().values()) {
286
293
  if (!ports.has(port)) {
287
- ports.set(port, { version, triplet });
294
+ ports.set(port, {
295
+ version,
296
+ triplet,
297
+ ...(portVersion ? { portVersion } : {}),
298
+ });
288
299
  }
289
300
  }
290
301
  }
@@ -721,7 +721,7 @@ export async function parseDenoLock(lockFile, options = {}) {
721
721
  // Deterministic canonical jsr page for the original specifier, e.g.
722
722
  // `https://jsr.io/@std/assert@1.0.19`. The npm-mirror tarball URL is only
723
723
  // available after a registry lookup, so this gives every jsr component a
724
- // stable reference even without --fetch-license.
724
+ // stable reference even when FETCH_LICENSE is not set.
725
725
  const jsrHomepage = `https://jsr.io/${group ? `${group}/` : ""}${name}@${version}`;
726
726
  const pkgObj = {
727
727
  group: JSR_NPM_SCOPE,
@@ -1056,7 +1056,7 @@ export async function parseDenoLock(lockFile, options = {}) {
1056
1056
 
1057
1057
  // Offline enrichment first: mine license/description/repository from a
1058
1058
  // project's node_modules and the global deno npm cache. This needs no
1059
- // network and runs even without --fetch-license.
1059
+ // network and runs even when FETCH_LICENSE is not set.
1060
1060
  mineInstalledMetadata(
1061
1061
  pkgList,
1062
1062
  options.projectRoot || dirname(lockFile),