@openai/codex-security 0.8.3 → 0.9.1

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 (534) hide show
  1. package/README.md +192 -151
  2. package/_bundled_plugin/.mcp.json +5 -1
  3. package/_bundled_plugin/examples/completed-scan/findings.json +16 -4
  4. package/_bundled_plugin/examples/completed-scan/report.md +11 -8
  5. package/_bundled_plugin/examples/completed-scan/scan-manifest.json +4 -2
  6. package/_bundled_plugin/mcp/fzstd-LICENSE.txt +21 -0
  7. package/_bundled_plugin/mcp/helpers.mjs +2 -11
  8. package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
  9. package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +3 -210
  10. package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
  11. package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
  12. package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
  13. package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
  14. package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
  15. package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
  16. package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
  17. package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
  18. package/_bundled_plugin/mcp/package.json +1 -0
  19. package/_bundled_plugin/mcp/permission-profile-preflight.mjs +5 -2
  20. package/_bundled_plugin/mcp/server.mjs +2 -11
  21. package/_bundled_plugin/mcp/server.mjs.br +0 -0
  22. package/_bundled_plugin/mcp/session-decompression.mjs +712 -0
  23. package/_bundled_plugin/references/default-severity-rubric.md +9 -4
  24. package/_bundled_plugin/references/final-report.md +5 -3
  25. package/_bundled_plugin/references/finding-detail-fields.md +18 -18
  26. package/_bundled_plugin/references/sarif-adapter.md +8 -2
  27. package/_bundled_plugin/references/scan-artifacts.md +21 -12
  28. package/_bundled_plugin/references/scan-contract.md +27 -33
  29. package/_bundled_plugin/schemas/tools/scan-draft.schema.json +2 -2
  30. package/_bundled_plugin/scripts/check_deep_scan_target.py +97 -0
  31. package/_bundled_plugin/scripts/codex_profile.mjs +7 -1
  32. package/_bundled_plugin/scripts/deep_scan_config.py +20 -1
  33. package/_bundled_plugin/scripts/deep_scan_workbench.py +165 -342
  34. package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
  35. package/_bundled_plugin/scripts/finalize_scan_contract.py +153 -227
  36. package/_bundled_plugin/scripts/finding_preview.py +20 -0
  37. package/_bundled_plugin/scripts/launch_codex_security_mcp +1 -0
  38. package/_bundled_plugin/scripts/legacy_findings.py +148 -0
  39. package/_bundled_plugin/scripts/posix_scan_local_files.py +11 -0
  40. package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
  41. package/_bundled_plugin/scripts/report_projection.py +81 -43
  42. package/_bundled_plugin/scripts/review_state.py +8 -2
  43. package/_bundled_plugin/scripts/servicenow_avit.py +20 -0
  44. package/_bundled_plugin/scripts/snapshot_sqlite.py +1 -0
  45. package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
  46. package/_bundled_plugin/scripts/validate_scan_contract.py +7 -1
  47. package/_bundled_plugin/scripts/windows_scan_local_files.py +388 -17
  48. package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
  49. package/_bundled_plugin/scripts/workbench/handoff.py +47 -0
  50. package/_bundled_plugin/scripts/workbench/retained_coverage.py +30 -51
  51. package/_bundled_plugin/scripts/workbench/retained_records.py +18 -30
  52. package/_bundled_plugin/scripts/workbench/runtime_toml.py +4 -1
  53. package/_bundled_plugin/scripts/workbench/saved_coverage.py +9 -17
  54. package/_bundled_plugin/scripts/workbench/saved_outputs.py +9 -0
  55. package/_bundled_plugin/scripts/workbench/saved_sources.py +47 -40
  56. package/_bundled_plugin/scripts/workbench/storage.py +71 -7
  57. package/_bundled_plugin/scripts/workbench_cli.py +30 -12
  58. package/_bundled_plugin/scripts/workbench_constants.py +10 -0
  59. package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
  60. package/_bundled_plugin/scripts/workbench_db.py +369 -137
  61. package/_bundled_plugin/scripts/workbench_feedback.py +8 -7
  62. package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
  63. package/_bundled_plugin/scripts/workbench_finding_workflows.py +4 -0
  64. package/_bundled_plugin/scripts/workbench_native_indexes.py +12 -12
  65. package/_bundled_plugin/scripts/workbench_progress.py +10 -1
  66. package/_bundled_plugin/scripts/workbench_publication.py +14 -10
  67. package/_bundled_plugin/scripts/workbench_remediation.py +13 -0
  68. package/_bundled_plugin/scripts/workbench_saved_results.py +132 -77
  69. package/_bundled_plugin/scripts/workbench_scan_history.py +117 -55
  70. package/_bundled_plugin/scripts/workbench_scan_start.py +83 -24
  71. package/_bundled_plugin/scripts/workbench_scan_usage.py +644 -68
  72. package/_bundled_plugin/scripts/workbench_schema.py +44 -55
  73. package/_bundled_plugin/scripts/workbench_setup.py +13 -1
  74. package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
  75. package/_bundled_plugin/scripts/workbench_source_scopes.py +18 -0
  76. package/_bundled_plugin/scripts/workbench_target.py +127 -56
  77. package/_bundled_plugin/scripts/workbench_target_state.py +3 -0
  78. package/_bundled_plugin/scripts/workbench_validation.py +43 -3
  79. package/_bundled_plugin/shared/workbench-history-repairs.json +19 -23
  80. package/_bundled_plugin/shared/workbench-migrations.json +34 -0
  81. package/_bundled_plugin/skills/cloud-findings/SKILL.md +5 -5
  82. package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
  83. package/_bundled_plugin/skills/fix-finding/SKILL.md +1 -1
  84. package/_bundled_plugin/skills/publish-findings/SKILL.md +32 -25
  85. package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
  86. package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +3 -3
  87. package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +464 -0
  88. package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +22 -1
  89. package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -2
  90. package/dist/api.d.ts +39 -4
  91. package/dist/api.d.ts.map +1 -1
  92. package/dist/api.js +774 -292
  93. package/dist/api.js.map +1 -1
  94. package/dist/auth.d.ts.map +1 -1
  95. package/dist/auth.js +4 -6
  96. package/dist/auth.js.map +1 -1
  97. package/dist/bedrock-oss-pricing.d.ts +6 -0
  98. package/dist/bedrock-oss-pricing.d.ts.map +1 -0
  99. package/dist/bedrock-oss-pricing.js +58 -0
  100. package/dist/bedrock-oss-pricing.js.map +1 -0
  101. package/dist/bedrock-pricing.d.ts +15 -0
  102. package/dist/bedrock-pricing.d.ts.map +1 -0
  103. package/dist/bedrock-pricing.js +117 -0
  104. package/dist/bedrock-pricing.js.map +1 -0
  105. package/dist/blackduck-findings.d.ts.map +1 -1
  106. package/dist/blackduck-findings.js +35 -20
  107. package/dist/blackduck-findings.js.map +1 -1
  108. package/dist/bulk-scan-discovery.d.ts.map +1 -1
  109. package/dist/bulk-scan-discovery.js +4 -4
  110. package/dist/bulk-scan-discovery.js.map +1 -1
  111. package/dist/checkmarx-evidence.d.ts +19 -0
  112. package/dist/checkmarx-evidence.d.ts.map +1 -0
  113. package/dist/checkmarx-evidence.js +36 -0
  114. package/dist/checkmarx-evidence.js.map +1 -0
  115. package/dist/checkmarx-findings.d.ts +4 -0
  116. package/dist/checkmarx-findings.d.ts.map +1 -0
  117. package/dist/checkmarx-findings.js +27 -0
  118. package/dist/checkmarx-findings.js.map +1 -0
  119. package/dist/checkmarx-one.d.ts +4 -0
  120. package/dist/checkmarx-one.d.ts.map +1 -0
  121. package/dist/checkmarx-one.js +53 -0
  122. package/dist/checkmarx-one.js.map +1 -0
  123. package/dist/checkmarx-repository.d.ts +12 -0
  124. package/dist/checkmarx-repository.d.ts.map +1 -0
  125. package/dist/checkmarx-repository.js +181 -0
  126. package/dist/checkmarx-repository.js.map +1 -0
  127. package/dist/checkmarx-xml.d.ts +12 -0
  128. package/dist/checkmarx-xml.d.ts.map +1 -0
  129. package/dist/checkmarx-xml.js +196 -0
  130. package/dist/checkmarx-xml.js.map +1 -0
  131. package/dist/classify-severity-records.d.ts +1 -9
  132. package/dist/classify-severity-records.d.ts.map +1 -1
  133. package/dist/classify-severity-records.js +3 -13
  134. package/dist/classify-severity-records.js.map +1 -1
  135. package/dist/classify-severity.d.ts.map +1 -1
  136. package/dist/classify-severity.js +2 -4
  137. package/dist/classify-severity.js.map +1 -1
  138. package/dist/cli.d.ts +11 -5
  139. package/dist/cli.d.ts.map +1 -1
  140. package/dist/cli.js +1734 -1238
  141. package/dist/cli.js.map +1 -1
  142. package/dist/cloud-publish.js +2 -2
  143. package/dist/cloud-publish.js.map +1 -1
  144. package/dist/component-scan.d.ts +16 -3
  145. package/dist/component-scan.d.ts.map +1 -1
  146. package/dist/component-scan.js +27 -2
  147. package/dist/component-scan.js.map +1 -1
  148. package/dist/config.d.ts.map +1 -1
  149. package/dist/config.js +100 -66
  150. package/dist/config.js.map +1 -1
  151. package/dist/continuum-findings.d.ts.map +1 -1
  152. package/dist/continuum-findings.js +80 -12
  153. package/dist/continuum-findings.js.map +1 -1
  154. package/dist/contract-values.d.ts +2 -0
  155. package/dist/contract-values.d.ts.map +1 -1
  156. package/dist/contract-values.js +12 -9
  157. package/dist/contract-values.js.map +1 -1
  158. package/dist/cost-model.d.ts +13 -1
  159. package/dist/cost-model.d.ts.map +1 -1
  160. package/dist/cost-model.js +66 -112
  161. package/dist/cost-model.js.map +1 -1
  162. package/dist/cost.d.ts +42 -3
  163. package/dist/cost.d.ts.map +1 -1
  164. package/dist/cost.js +483 -104
  165. package/dist/cost.js.map +1 -1
  166. package/dist/custom-publish.d.ts +4 -0
  167. package/dist/custom-publish.d.ts.map +1 -1
  168. package/dist/custom-publish.js +40 -3
  169. package/dist/custom-publish.js.map +1 -1
  170. package/dist/deduplication/local.d.ts +2 -2
  171. package/dist/deduplication/local.d.ts.map +1 -1
  172. package/dist/deduplication/local.js +2 -2
  173. package/dist/deduplication/local.js.map +1 -1
  174. package/dist/deduplication/refusal.d.ts.map +1 -1
  175. package/dist/deduplication/refusal.js +25 -5
  176. package/dist/deduplication/refusal.js.map +1 -1
  177. package/dist/deduplication/scan.d.ts +3 -0
  178. package/dist/deduplication/scan.d.ts.map +1 -1
  179. package/dist/deduplication/scan.js +1 -1
  180. package/dist/deduplication/scan.js.map +1 -1
  181. package/dist/deep-config.d.ts +0 -1
  182. package/dist/deep-config.d.ts.map +1 -1
  183. package/dist/deep-config.js +22 -33
  184. package/dist/deep-config.js.map +1 -1
  185. package/dist/deep-scan-defaults.d.ts +2 -0
  186. package/dist/deep-scan-defaults.d.ts.map +1 -1
  187. package/dist/deep-scan-defaults.js +28 -1
  188. package/dist/deep-scan-defaults.js.map +1 -1
  189. package/dist/deep-scan.d.ts +2 -0
  190. package/dist/deep-scan.d.ts.map +1 -1
  191. package/dist/deep-scan.js +28 -4
  192. package/dist/deep-scan.js.map +1 -1
  193. package/dist/default-severity-rubric.d.ts +1 -1
  194. package/dist/default-severity-rubric.d.ts.map +1 -1
  195. package/dist/default-severity-rubric.js +1 -1
  196. package/dist/default-severity-rubric.js.map +1 -1
  197. package/dist/endor-findings.d.ts +3 -1
  198. package/dist/endor-findings.d.ts.map +1 -1
  199. package/dist/endor-findings.js +103 -45
  200. package/dist/endor-findings.js.map +1 -1
  201. package/dist/errors.d.ts +1 -1
  202. package/dist/errors.d.ts.map +1 -1
  203. package/dist/errors.js +8 -1
  204. package/dist/errors.js.map +1 -1
  205. package/dist/external-findings-import.d.ts +5 -3
  206. package/dist/external-findings-import.d.ts.map +1 -1
  207. package/dist/external-findings-import.js +7 -6
  208. package/dist/external-findings-import.js.map +1 -1
  209. package/dist/external-findings-local.d.ts +7 -5
  210. package/dist/external-findings-local.d.ts.map +1 -1
  211. package/dist/external-findings-local.js +337 -89
  212. package/dist/external-findings-local.js.map +1 -1
  213. package/dist/external-findings-publish.d.ts +8 -6
  214. package/dist/external-findings-publish.d.ts.map +1 -1
  215. package/dist/external-findings-publish.js +1318 -258
  216. package/dist/external-findings-publish.js.map +1 -1
  217. package/dist/external-findings-read.d.ts +20 -2
  218. package/dist/external-findings-read.d.ts.map +1 -1
  219. package/dist/external-findings-read.js +148 -66
  220. package/dist/external-findings-read.js.map +1 -1
  221. package/dist/external-findings.d.ts +15 -3
  222. package/dist/external-findings.d.ts.map +1 -1
  223. package/dist/external-findings.js +42 -1
  224. package/dist/external-findings.js.map +1 -1
  225. package/dist/external-import-contract.d.ts +5 -1
  226. package/dist/external-import-contract.d.ts.map +1 -1
  227. package/dist/external-import-contract.js +23 -9
  228. package/dist/external-import-contract.js.map +1 -1
  229. package/dist/external-import-models.d.ts +1 -1
  230. package/dist/external-import-models.d.ts.map +1 -1
  231. package/dist/external-import-models.js.map +1 -1
  232. package/dist/feedback.d.ts.map +1 -1
  233. package/dist/feedback.js +5 -4
  234. package/dist/feedback.js.map +1 -1
  235. package/dist/finding-prompt.d.ts +5 -0
  236. package/dist/finding-prompt.d.ts.map +1 -0
  237. package/dist/finding-prompt.js +32 -0
  238. package/dist/finding-prompt.js.map +1 -0
  239. package/dist/findings-client.d.ts +1 -0
  240. package/dist/findings-client.d.ts.map +1 -1
  241. package/dist/findings-client.js +27 -3
  242. package/dist/findings-client.js.map +1 -1
  243. package/dist/github-advisories.d.ts.map +1 -1
  244. package/dist/github-advisories.js +0 -2
  245. package/dist/github-advisories.js.map +1 -1
  246. package/dist/github-dependabot-findings.d.ts.map +1 -1
  247. package/dist/github-dependabot-findings.js +15 -4
  248. package/dist/github-dependabot-findings.js.map +1 -1
  249. package/dist/github-findings.d.ts +4 -1
  250. package/dist/github-findings.d.ts.map +1 -1
  251. package/dist/github-findings.js +55 -30
  252. package/dist/github-findings.js.map +1 -1
  253. package/dist/hosted-git-remotes.d.ts +5 -0
  254. package/dist/hosted-git-remotes.d.ts.map +1 -0
  255. package/dist/hosted-git-remotes.js +285 -0
  256. package/dist/hosted-git-remotes.js.map +1 -0
  257. package/dist/hosted-git-repository.d.ts +28 -0
  258. package/dist/hosted-git-repository.d.ts.map +1 -0
  259. package/dist/hosted-git-repository.js +222 -0
  260. package/dist/hosted-git-repository.js.map +1 -0
  261. package/dist/hosted-scan-protocol.js +2 -2
  262. package/dist/hosted-scan-protocol.js.map +1 -1
  263. package/dist/hosted-scan.d.ts.map +1 -1
  264. package/dist/hosted-scan.js +16 -11
  265. package/dist/hosted-scan.js.map +1 -1
  266. package/dist/hosted-scanner-http.d.ts +21 -0
  267. package/dist/hosted-scanner-http.d.ts.map +1 -0
  268. package/dist/hosted-scanner-http.js +204 -0
  269. package/dist/hosted-scanner-http.js.map +1 -0
  270. package/dist/hosted-scanner-v1.d.ts +6 -0
  271. package/dist/hosted-scanner-v1.d.ts.map +1 -0
  272. package/dist/hosted-scanner-v1.js +60 -0
  273. package/dist/hosted-scanner-v1.js.map +1 -0
  274. package/dist/import-scan.d.ts.map +1 -1
  275. package/dist/import-scan.js +3 -0
  276. package/dist/import-scan.js.map +1 -1
  277. package/dist/index.d.ts +18 -7
  278. package/dist/index.d.ts.map +1 -1
  279. package/dist/index.js +10 -2
  280. package/dist/index.js.map +1 -1
  281. package/dist/inspector-findings.d.ts.map +1 -1
  282. package/dist/inspector-findings.js +47 -65
  283. package/dist/inspector-findings.js.map +1 -1
  284. package/dist/knowledge-base.d.ts.map +1 -1
  285. package/dist/knowledge-base.js +68 -5
  286. package/dist/knowledge-base.js.map +1 -1
  287. package/dist/local-git-metadata.d.ts +1 -1
  288. package/dist/local-git-metadata.d.ts.map +1 -1
  289. package/dist/local-git-metadata.js +1 -2
  290. package/dist/local-git-metadata.js.map +1 -1
  291. package/dist/multiscan.d.ts +6 -4
  292. package/dist/multiscan.d.ts.map +1 -1
  293. package/dist/multiscan.js +138 -65
  294. package/dist/multiscan.js.map +1 -1
  295. package/dist/native-json-findings.d.ts +2 -1
  296. package/dist/native-json-findings.d.ts.map +1 -1
  297. package/dist/native-json-findings.js +12 -2
  298. package/dist/native-json-findings.js.map +1 -1
  299. package/dist/opengrep-findings.d.ts +1 -0
  300. package/dist/opengrep-findings.d.ts.map +1 -1
  301. package/dist/opengrep-findings.js +17 -13
  302. package/dist/opengrep-findings.js.map +1 -1
  303. package/dist/operation-telemetry.d.ts +104 -0
  304. package/dist/operation-telemetry.d.ts.map +1 -0
  305. package/dist/operation-telemetry.js +293 -0
  306. package/dist/operation-telemetry.js.map +1 -0
  307. package/dist/plugin-python-probe.d.ts +4 -0
  308. package/dist/plugin-python-probe.d.ts.map +1 -0
  309. package/dist/plugin-python-probe.js +10 -0
  310. package/dist/plugin-python-probe.js.map +1 -0
  311. package/dist/private-finding-import.d.ts +97 -2
  312. package/dist/private-finding-import.d.ts.map +1 -1
  313. package/dist/private-finding-import.js +58 -34
  314. package/dist/private-finding-import.js.map +1 -1
  315. package/dist/provider-profile.d.ts +1 -1
  316. package/dist/provider-profile.d.ts.map +1 -1
  317. package/dist/provider-profile.js +8 -1
  318. package/dist/provider-profile.js.map +1 -1
  319. package/dist/publication-telemetry.d.ts +45 -0
  320. package/dist/publication-telemetry.d.ts.map +1 -0
  321. package/dist/publication-telemetry.js +50 -0
  322. package/dist/publication-telemetry.js.map +1 -0
  323. package/dist/publish.d.ts +4 -0
  324. package/dist/publish.d.ts.map +1 -1
  325. package/dist/publish.js +42 -2
  326. package/dist/publish.js.map +1 -1
  327. package/dist/reader-selection.d.ts +2 -0
  328. package/dist/reader-selection.d.ts.map +1 -1
  329. package/dist/reader-selection.js +8 -0
  330. package/dist/reader-selection.js.map +1 -1
  331. package/dist/remediation.d.ts +1 -4
  332. package/dist/remediation.d.ts.map +1 -1
  333. package/dist/remediation.js +3 -7
  334. package/dist/remediation.js.map +1 -1
  335. package/dist/request-metadata.d.ts +3 -0
  336. package/dist/request-metadata.d.ts.map +1 -1
  337. package/dist/request-metadata.js +9 -0
  338. package/dist/request-metadata.js.map +1 -1
  339. package/dist/result.d.ts +4 -0
  340. package/dist/result.d.ts.map +1 -1
  341. package/dist/result.js +1 -1
  342. package/dist/result.js.map +1 -1
  343. package/dist/retry-windows-rename.d.ts +8 -0
  344. package/dist/retry-windows-rename.d.ts.map +1 -0
  345. package/dist/retry-windows-rename.js +24 -0
  346. package/dist/retry-windows-rename.js.map +1 -0
  347. package/dist/runtime.d.ts +20 -0
  348. package/dist/runtime.d.ts.map +1 -1
  349. package/dist/runtime.js +313 -110
  350. package/dist/runtime.js.map +1 -1
  351. package/dist/saved-scan-bootstrap.d.ts +1 -0
  352. package/dist/saved-scan-bootstrap.d.ts.map +1 -1
  353. package/dist/saved-scan-bootstrap.js +18 -15
  354. package/dist/saved-scan-bootstrap.js.map +1 -1
  355. package/dist/scan-activity.d.ts.map +1 -1
  356. package/dist/scan-activity.js +141 -56
  357. package/dist/scan-activity.js.map +1 -1
  358. package/dist/scan-comparison.d.ts +10 -5
  359. package/dist/scan-comparison.d.ts.map +1 -1
  360. package/dist/scan-comparison.js +60 -15
  361. package/dist/scan-comparison.js.map +1 -1
  362. package/dist/scan-dashboard.d.ts +6 -6
  363. package/dist/scan-dashboard.d.ts.map +1 -1
  364. package/dist/scan-dashboard.js +75 -42
  365. package/dist/scan-dashboard.js.map +1 -1
  366. package/dist/scan-executor.d.ts +10 -1
  367. package/dist/scan-executor.d.ts.map +1 -1
  368. package/dist/scan-executor.js +22 -2
  369. package/dist/scan-executor.js.map +1 -1
  370. package/dist/scan-history-renderer.d.ts.map +1 -1
  371. package/dist/scan-history-renderer.js +9 -19
  372. package/dist/scan-history-renderer.js.map +1 -1
  373. package/dist/scan-logs.d.ts +12 -0
  374. package/dist/scan-logs.d.ts.map +1 -1
  375. package/dist/scan-logs.js +106 -77
  376. package/dist/scan-logs.js.map +1 -1
  377. package/dist/scan-measurement.d.ts +26 -0
  378. package/dist/scan-measurement.d.ts.map +1 -0
  379. package/dist/scan-measurement.js +77 -0
  380. package/dist/scan-measurement.js.map +1 -0
  381. package/dist/scan-progress.d.ts +1 -0
  382. package/dist/scan-progress.d.ts.map +1 -1
  383. package/dist/scan-progress.js +3 -0
  384. package/dist/scan-progress.js.map +1 -1
  385. package/dist/scan-sessions.d.ts.map +1 -1
  386. package/dist/scan-sessions.js +4 -1
  387. package/dist/scan-sessions.js.map +1 -1
  388. package/dist/scan-settings.d.ts +1 -1
  389. package/dist/scan-settings.d.ts.map +1 -1
  390. package/dist/scan-settings.js +1 -24
  391. package/dist/scan-settings.js.map +1 -1
  392. package/dist/scanner-import.d.ts +20 -2
  393. package/dist/scanner-import.d.ts.map +1 -1
  394. package/dist/scanner-import.js +200 -8
  395. package/dist/scanner-import.js.map +1 -1
  396. package/dist/scanner-repository-url.d.ts +4 -1
  397. package/dist/scanner-repository-url.d.ts.map +1 -1
  398. package/dist/scanner-repository-url.js +10 -6
  399. package/dist/scanner-repository-url.js.map +1 -1
  400. package/dist/security-policy.d.ts +1 -1
  401. package/dist/security-policy.d.ts.map +1 -1
  402. package/dist/security-policy.js.map +1 -1
  403. package/dist/semgrep-findings.d.ts +6 -3
  404. package/dist/semgrep-findings.d.ts.map +1 -1
  405. package/dist/semgrep-findings.js +107 -43
  406. package/dist/semgrep-findings.js.map +1 -1
  407. package/dist/semgrep-guardian-findings.d.ts +38 -0
  408. package/dist/semgrep-guardian-findings.d.ts.map +1 -0
  409. package/dist/semgrep-guardian-findings.js +165 -0
  410. package/dist/semgrep-guardian-findings.js.map +1 -0
  411. package/dist/semgrep-platform-collector.d.ts +26 -0
  412. package/dist/semgrep-platform-collector.d.ts.map +1 -0
  413. package/dist/semgrep-platform-collector.js +108 -0
  414. package/dist/semgrep-platform-collector.js.map +1 -0
  415. package/dist/semgrep-platform-findings.d.ts +207 -6
  416. package/dist/semgrep-platform-findings.d.ts.map +1 -1
  417. package/dist/semgrep-platform-findings.js +983 -103
  418. package/dist/semgrep-platform-findings.js.map +1 -1
  419. package/dist/semgrep-platform-v1.d.ts +6 -0
  420. package/dist/semgrep-platform-v1.d.ts.map +1 -0
  421. package/dist/semgrep-platform-v1.js +83 -0
  422. package/dist/semgrep-platform-v1.js.map +1 -0
  423. package/dist/server/api.d.ts +1 -1
  424. package/dist/server/api.d.ts.map +1 -1
  425. package/dist/server/api.js.map +1 -1
  426. package/dist/server/embedding-tokenizer.cdx.json +33 -0
  427. package/dist/server/embedding-tokenizer.d.ts +2 -0
  428. package/dist/server/embedding-tokenizer.d.ts.map +1 -0
  429. package/dist/server/embedding-tokenizer.js +322 -0
  430. package/dist/server/embedding-tokenizer.js.map +6 -0
  431. package/dist/server/embeddings.d.ts +16 -2
  432. package/dist/server/embeddings.d.ts.map +1 -1
  433. package/dist/server/embeddings.js +35 -5
  434. package/dist/server/embeddings.js.map +1 -1
  435. package/dist/session-lines.d.ts +5 -0
  436. package/dist/session-lines.d.ts.map +1 -0
  437. package/dist/session-lines.js +60 -0
  438. package/dist/session-lines.js.map +1 -0
  439. package/dist/severity-review.d.ts +3 -1
  440. package/dist/severity-review.d.ts.map +1 -1
  441. package/dist/severity-review.js +3 -2
  442. package/dist/severity-review.js.map +1 -1
  443. package/dist/skill-authentication.d.ts +1 -0
  444. package/dist/skill-authentication.d.ts.map +1 -1
  445. package/dist/skill-authentication.js +1 -0
  446. package/dist/skill-authentication.js.map +1 -1
  447. package/dist/snyk-findings.d.ts +7 -2
  448. package/dist/snyk-findings.d.ts.map +1 -1
  449. package/dist/snyk-findings.js +93 -70
  450. package/dist/snyk-findings.js.map +1 -1
  451. package/dist/snyk-rest-findings.d.ts +76 -0
  452. package/dist/snyk-rest-findings.d.ts.map +1 -0
  453. package/dist/snyk-rest-findings.js +1051 -0
  454. package/dist/snyk-rest-findings.js.map +1 -0
  455. package/dist/snyk-rest-v1.d.ts +28 -0
  456. package/dist/snyk-rest-v1.d.ts.map +1 -0
  457. package/dist/snyk-rest-v1.js +132 -0
  458. package/dist/snyk-rest-v1.js.map +1 -0
  459. package/dist/snyk-token-origin.d.ts +4 -0
  460. package/dist/snyk-token-origin.d.ts.map +1 -0
  461. package/dist/snyk-token-origin.js +82 -0
  462. package/dist/snyk-token-origin.js.map +1 -0
  463. package/dist/sonar-collector.d.ts.map +1 -1
  464. package/dist/sonar-collector.js +0 -3
  465. package/dist/sonar-collector.js.map +1 -1
  466. package/dist/sonar-import.d.ts.map +1 -1
  467. package/dist/sonar-import.js +2 -4
  468. package/dist/sonar-import.js.map +1 -1
  469. package/dist/target-drift.d.ts +9 -0
  470. package/dist/target-drift.d.ts.map +1 -0
  471. package/dist/target-drift.js +27 -0
  472. package/dist/target-drift.js.map +1 -0
  473. package/dist/targets.d.ts +2 -0
  474. package/dist/targets.d.ts.map +1 -1
  475. package/dist/targets.js +56 -20
  476. package/dist/targets.js.map +1 -1
  477. package/dist/tenable-findings.d.ts +9 -0
  478. package/dist/tenable-findings.d.ts.map +1 -0
  479. package/dist/tenable-findings.js +122 -0
  480. package/dist/tenable-findings.js.map +1 -0
  481. package/dist/terminal-stream.d.ts +13 -0
  482. package/dist/terminal-stream.d.ts.map +1 -0
  483. package/dist/terminal-stream.js +35 -0
  484. package/dist/terminal-stream.js.map +1 -0
  485. package/dist/trivy-findings.d.ts +19 -0
  486. package/dist/trivy-findings.d.ts.map +1 -0
  487. package/dist/trivy-findings.js +435 -0
  488. package/dist/trivy-findings.js.map +1 -0
  489. package/dist/trivy-import.d.ts +19 -0
  490. package/dist/trivy-import.d.ts.map +1 -0
  491. package/dist/trivy-import.js +151 -0
  492. package/dist/trivy-import.js.map +1 -0
  493. package/dist/validation-records.js +1 -1
  494. package/dist/validation-records.js.map +1 -1
  495. package/dist/veracode-findings.d.ts +2 -0
  496. package/dist/veracode-findings.d.ts.map +1 -1
  497. package/dist/veracode-findings.js +49 -11
  498. package/dist/veracode-findings.js.map +1 -1
  499. package/dist/vertex-pricing.d.ts +8 -0
  500. package/dist/vertex-pricing.d.ts.map +1 -0
  501. package/dist/vertex-pricing.js +20 -0
  502. package/dist/vertex-pricing.js.map +1 -0
  503. package/dist/windows-path.d.ts +1 -0
  504. package/dist/windows-path.d.ts.map +1 -1
  505. package/dist/windows-path.js +26 -1
  506. package/dist/windows-path.js.map +1 -1
  507. package/dist/wiz-findings.d.ts +4 -0
  508. package/dist/wiz-findings.d.ts.map +1 -1
  509. package/dist/wiz-findings.js +57 -3
  510. package/dist/wiz-findings.js.map +1 -1
  511. package/docs/classify-severity-records.md +27 -12
  512. package/docs/cli.md +497 -550
  513. package/docs/dedupe-records.md +44 -24
  514. package/docs/findings-service.md +66 -39
  515. package/docs/hosted-remediation.md +14 -7
  516. package/docs/hosted-scans.md +50 -42
  517. package/docs/telemetry.md +236 -0
  518. package/docs/validate-records.md +78 -44
  519. package/package.json +18 -15
  520. package/schemas/external-findings.schema.json +3 -1
  521. package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
  522. package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
  523. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  524. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  525. package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
  526. package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +0 -96
  527. package/dist/external-imports-feature.d.ts +0 -6
  528. package/dist/external-imports-feature.d.ts.map +0 -1
  529. package/dist/external-imports-feature.js +0 -51
  530. package/dist/external-imports-feature.js.map +0 -1
  531. package/dist/finding-normalization.d.ts +0 -5
  532. package/dist/finding-normalization.d.ts.map +0 -1
  533. package/dist/finding-normalization.js +0 -155
  534. package/dist/finding-normalization.js.map +0 -1
@@ -0,0 +1,435 @@
1
+ import { posix, sep } from "node:path";
2
+ import { validateExternalEvidence } from "./external-import-contract.js";
3
+ import { isGitHubCloudHost, isGitSsh, parseGitRemote } from "./git-remote.js";
4
+ import { hostedRepositoryUrlKey, normalizeHostedGitRepositoryUrl, } from "./hosted-git-repository.js";
5
+ import { isRecord } from "./record.js";
6
+ import { array, normalizeRecords, readScannerJson, record, relativePath, reportableScannerSeverity, requiredText, stableId, strings, text, } from "./scanner-import.js";
7
+ const urlScheme = /^[a-z][a-z\d+.-]*:\/\//iu;
8
+ const javaArchiveAncestor = /\.(?:jar|war|ear|par)\//iu;
9
+ const cloudLocationLimit = 100;
10
+ const curlUrlPrefix = /^(?:(?:https?|ftps?)::)?(?:https?|ftps?):\/{1,3}/iu;
11
+ const unsafeRepositoryUrl = "Use a Trivy repository URL without credentials, a query, or a fragment.";
12
+ function hasHttpUserinfo(value, allowImplicitHttps) {
13
+ if (!value)
14
+ return false;
15
+ const prefix = curlUrlPrefix.exec(value)?.[0];
16
+ if (!prefix && (!allowImplicitHttps || /^[a-z]:[\\/]/iu.test(value)))
17
+ return false;
18
+ // Git's HTTP transport treats backslashes before @ as part of userinfo.
19
+ const authority = value.slice(prefix?.length ?? 0).split(/[/?#]/u, 1)[0];
20
+ const at = authority.lastIndexOf("@");
21
+ const colon = authority.indexOf(":");
22
+ const scp = colon > authority.indexOf("@");
23
+ // A bare user@host:path is Git's SSH form. Trivy reads user@host/path as HTTPS.
24
+ return at > 0 && (!!prefix || (!scp && !authority.includes("\\", at + 1)));
25
+ }
26
+ function networkRepository(value) {
27
+ const source = text(value);
28
+ if (!source || /^(?:[a-z]:|[./\\])/iu.test(source))
29
+ return null;
30
+ const remote = parseGitRemote(source);
31
+ if (!remote)
32
+ return null;
33
+ const { url } = remote;
34
+ const ssh = isGitSsh(url.protocol);
35
+ if (url.password || (!ssh && url.username) || /[?#\t\r\n]/u.test(source))
36
+ throw new Error(unsafeRepositoryUrl);
37
+ if (url.protocol === "file:")
38
+ return null;
39
+ if (!url.hostname ||
40
+ !remote.path ||
41
+ (!ssh &&
42
+ !["http:", "https:", "git:", "ftp:", "ftps:"].includes(url.protocol)))
43
+ throw new Error("Unsupported Trivy repository URL.");
44
+ return source;
45
+ }
46
+ function comparableGitHubRemote(remote, cloudRepositoryUrl) {
47
+ if (/[?#\t\r\n]/u.test(remote))
48
+ return undefined;
49
+ let parsed;
50
+ try {
51
+ parsed = parseGitRemote(remote);
52
+ }
53
+ catch {
54
+ // A checkout can have unrelated remotes with no comparable URL.
55
+ return undefined;
56
+ }
57
+ if (!parsed)
58
+ return undefined;
59
+ const prefix = `${parsed.url.protocol}//`;
60
+ // Git dispatches mixed-case schemes to distinct remote helpers.
61
+ if (!parsed.scpStyle && !remote.startsWith(prefix))
62
+ return undefined;
63
+ const host = parsed.url.hostname.toLowerCase();
64
+ const githubUrl = cloudRepositoryUrl ??
65
+ (isGitHubCloudHost(host) ? `https://${host}` : undefined);
66
+ const normalized = normalizeHostedGitRepositoryUrl(remote, githubUrl, githubUrl !== undefined);
67
+ if (!/^https?:\/\//iu.test(normalized))
68
+ return undefined;
69
+ if (!isGitHubCloudHost(new URL(normalized).hostname) &&
70
+ (!cloudRepositoryUrl || new URL(cloudRepositoryUrl).hostname !== host))
71
+ return undefined;
72
+ return normalized;
73
+ }
74
+ export function trivyRemoteKey(remote, cloudRepositoryUrl, checkout = false) {
75
+ const normalized = comparableGitHubRemote(remote, cloudRepositoryUrl);
76
+ if (!normalized)
77
+ return remote;
78
+ // GitHub identifies an HTTPS repository by host and path. Other Git servers
79
+ // may use the HTTP username to select the repository.
80
+ const url = checkout
81
+ ? normalized.replace(/^(https?:\/\/)[^/\\?#]*@/iu, "$1")
82
+ : normalized;
83
+ return hostedRepositoryUrlKey(url, true, false, cloudRepositoryUrl ? "cloud" : "local");
84
+ }
85
+ const sshScheme = /^(?:ssh|git\+ssh|ssh\+git):\/\//u;
86
+ export function trivyRemoteOmitsSshUser(url) {
87
+ return sshScheme.test(url) && !new URL(url).username;
88
+ }
89
+ export const trivyHeaderFields = [
90
+ "SchemaVersion",
91
+ "ArtifactType",
92
+ "ArtifactID",
93
+ "ReportID",
94
+ "CreatedAt",
95
+ ];
96
+ // Go may rewrite escaped separators or unreserved bytes in mixed Unicode paths.
97
+ // Only escape spaces and non-ASCII bytes when existing escapes are unambiguous.
98
+ function escapedHttpTarget(target) {
99
+ return target.replace(/^(https?:\/\/[^/]+)(\/(?:[^%]|%(?:2[05]|[89A-F][\dA-F]))*)$/u, (_, authority, path) => authority + path.replace(/[ \P{ASCII}]+/gu, encodeURIComponent));
100
+ }
101
+ export function trivyReportRemotes(report) {
102
+ if (!isRecord(report))
103
+ return { urls: [] };
104
+ const metadata = report["Metadata"];
105
+ const repoUrl = text(isRecord(metadata) && metadata["RepoURL"]);
106
+ const name = text(report["ArtifactName"]);
107
+ if (hasHttpUserinfo(repoUrl, true) ||
108
+ hasHttpUserinfo(name, report["ArtifactType"] !== "filesystem"))
109
+ throw new Error(unsafeRepositoryUrl);
110
+ const repository = networkRepository(repoUrl);
111
+ let artifact = name && urlScheme.test(name) ? networkRepository(name) : null;
112
+ if (report["SchemaVersion"] !== 2)
113
+ return { urls: [] };
114
+ // A filesystem display label is validated but never identifies the repository.
115
+ if (report["ArtifactType"] === "filesystem")
116
+ return { urls: repository ? [repository] : [] };
117
+ // Trivy accepts scheme-less HTTPS targets and relative checkout paths.
118
+ // A scheme-less name identifies a remote only when Git metadata corroborates it.
119
+ const target = artifact ??
120
+ (name && /^[^./:\\][^/:\\]*\//u.test(name) ? `https://${name}` : null);
121
+ if (target &&
122
+ repository &&
123
+ report["ArtifactType"] === "repository" &&
124
+ (target === repository || escapedHttpTarget(target) === repository))
125
+ artifact = repository;
126
+ // A checkout-supplied label cannot restore an omitted SSH user. Keep any
127
+ // other difference visible when validating the report's repository claims.
128
+ if (repository &&
129
+ trivyRemoteOmitsSshUser(repository) &&
130
+ artifact?.replace(/^([^:]+:\/\/)[^/@]+@/u, "$1") === repository)
131
+ return { urls: [repository] };
132
+ return {
133
+ urls: [repository, artifact].filter((url) => url !== null),
134
+ uncorroboratedTarget: repository ? null : artifact,
135
+ };
136
+ }
137
+ function matchingTrivyRemotes([repository, artifact], githubUrl) {
138
+ return (!!repository &&
139
+ !!artifact &&
140
+ trivyRemoteKey(repository, githubUrl) ===
141
+ trivyRemoteKey(artifact, githubUrl));
142
+ }
143
+ /** Compare the report's claims using the authenticated host when available. */
144
+ export function trivyRepositoryUrl(report, cloudRepositoryUrl) {
145
+ const { urls } = trivyReportRemotes(report);
146
+ if (urls.length > 1 && !matchingTrivyRemotes(urls, cloudRepositoryUrl))
147
+ throw new Error("Trivy source URLs identify different repositories.");
148
+ const remote = urls[0];
149
+ return remote && cloudRepositoryUrl
150
+ ? (comparableGitHubRemote(remote, cloudRepositoryUrl) ?? remote)
151
+ : (remote ?? null);
152
+ }
153
+ function repositoryPath(value, directory = false) {
154
+ const raw = text(value);
155
+ if (!raw || !relativePath(raw))
156
+ return null;
157
+ // Check the emitted spelling across platforms while retaining literal POSIX backslashes.
158
+ const path = posix.normalize(raw);
159
+ const portable = posix.normalize(path.replaceAll("\\", "/"));
160
+ const firstComponent = portable.split("/", 1)[0];
161
+ const at = firstComponent.indexOf("@", 1);
162
+ const scpStyle = at !== -1 && firstComponent.indexOf(":", at + 2) !== -1;
163
+ return relativePath(portable) &&
164
+ (directory || (portable !== "." && !portable.endsWith("/"))) &&
165
+ !scpStyle &&
166
+ !/^[a-z][a-z\d+.-]*:\//iu.test(portable)
167
+ ? path
168
+ : null;
169
+ }
170
+ const aggregateTargets = new Map([
171
+ ["python-pkg", "Python"],
172
+ ["conda-pkg", "Conda"],
173
+ ["gemspec", "Ruby"],
174
+ ["node-pkg", "Node.js"],
175
+ ["jar", "Java"],
176
+ ["kubernetes", "Kubernetes"],
177
+ ]);
178
+ const nonManifestTypes = new Set([
179
+ "gobinary",
180
+ "rustbinary",
181
+ "jar",
182
+ "javascript",
183
+ ]);
184
+ function resolveScanRoot(scanRoot, remoteRepository) {
185
+ if (scanRoot === undefined) {
186
+ if (remoteRepository)
187
+ return ".";
188
+ throw new Error("Specify --trivy-scan-root relative to the repository; use . for a whole-checkout scan.");
189
+ }
190
+ const root = repositoryPath(scanRoot.split(sep).join("/"), true)?.replace(/\/$/u, "");
191
+ if (!root)
192
+ throw new Error("--trivy-scan-root must be a repository-relative directory without traversal.");
193
+ if (remoteRepository && root !== ".")
194
+ throw new Error("A remote Trivy repository scan starts at the checkout root; --trivy-scan-root must be .");
195
+ return root;
196
+ }
197
+ function scopedPath(root, value) {
198
+ const path = repositoryPath(value);
199
+ return path === null ? null : posix.join(root, path);
200
+ }
201
+ function pick(source, fields) {
202
+ return Object.fromEntries(fields
203
+ .filter((field) => Object.hasOwn(source, field))
204
+ .map((field) => [field, source[field]]));
205
+ }
206
+ function packageKeys(row, inventory) {
207
+ const path = row[inventory ? "FilePath" : "PkgPath"];
208
+ const identifier = row[inventory ? "Identifier" : "PkgIdentifier"];
209
+ const name = row[inventory ? "Name" : "PkgName"];
210
+ const version = row[inventory ? "Version" : "InstalledVersion"];
211
+ const file = repositoryPath(path) ?? text(path);
212
+ const key = (kind, value) => text(value) && JSON.stringify([kind, value, file]);
213
+ const native = isRecord(identifier) ? identifier : {};
214
+ return {
215
+ id: key("id", row[inventory ? "ID" : "PkgID"]),
216
+ uid: key("uid", native["UID"]),
217
+ purl: key("purl", native["PURL"]),
218
+ bomRef: key("bomRef", native["BOMRef"]),
219
+ nameVersion: text(name) &&
220
+ text(version) &&
221
+ JSON.stringify(["name-version", name, version, file]),
222
+ };
223
+ }
224
+ function indexPackages(packages) {
225
+ const index = new Map();
226
+ for (const value of array(packages ?? [], "Trivy Packages")) {
227
+ const pkg = record(value, "Trivy package");
228
+ const keys = packageKeys(pkg, true);
229
+ const match = { pkg, keys };
230
+ for (const key of Object.values(keys))
231
+ if (key)
232
+ index.set(key, index.has(key) ? null : match);
233
+ }
234
+ return index;
235
+ }
236
+ function matchingPackage(vulnerability, index) {
237
+ const keys = packageKeys(vulnerability, false);
238
+ const supplied = ["uid", "id", "purl", "bomRef"].filter((field) => keys[field]);
239
+ for (const field of supplied.length ? supplied : ["nameVersion"]) {
240
+ const key = keys[field];
241
+ const match = key && index.get(key);
242
+ if (match &&
243
+ agreesWhenPresent(vulnerability["PkgName"], match.pkg["Name"]) &&
244
+ agreesWhenPresent(vulnerability["InstalledVersion"], match.pkg["Version"]) &&
245
+ supplied.every((id) => !match.keys[id] || keys[id] === match.keys[id]))
246
+ return match.pkg;
247
+ }
248
+ return null;
249
+ }
250
+ function agreesWhenPresent(detected, inventoried) {
251
+ return !text(detected) || !text(inventoried) || detected === inventoried;
252
+ }
253
+ function occurrence(entry, root) {
254
+ if (typeof entry === "string")
255
+ throw new Error(entry);
256
+ const vulnerability = record(entry.value, "Trivy vulnerability");
257
+ const { Target, Type } = entry.result;
258
+ return {
259
+ ...entry,
260
+ vulnerability,
261
+ advisory: requiredText(vulnerability["VulnerabilityID"], "Trivy VulnerabilityID"),
262
+ name: requiredText(vulnerability["PkgName"], "Trivy PkgName"),
263
+ pkgPath: text(vulnerability["PkgPath"]),
264
+ targetPath: aggregateTargets.get(Type) === Target ? null : scopedPath(root, Target),
265
+ packagePath: scopedPath(root, vulnerability["PkgPath"]),
266
+ };
267
+ }
268
+ /** Import native Trivy dependency occurrences. Local scans require their checkout-relative
269
+ * scan root. The package ecosystem is the PURL type when supplied, otherwise the analyzer. */
270
+ export function normalizeTrivyFindings(input, target = "cloud", scanRoot) {
271
+ const locationLimit = target === "cloud" ? cloudLocationLimit : Infinity;
272
+ return normalizeReport(input, target, scanRoot, locationLimit);
273
+ }
274
+ /** @internal Only a finding at the Cloud location limit can have a different prior selection. */
275
+ export function needsPreviousTrivyProjection({ findings }) {
276
+ return findings.some(({ evidence }) => evidence.locations?.length === cloudLocationLimit);
277
+ }
278
+ /** @internal Reconstruct the original selection for an interrupted Cloud request. */
279
+ export function normalizePreviousTrivyFindings(input, target = "cloud", scanRoot) {
280
+ return normalizeReport(input, target, scanRoot, Infinity);
281
+ }
282
+ function normalizeReport(input, target, scanRoot, locationLimit) {
283
+ const document = record(input, "Trivy report");
284
+ if (document["SchemaVersion"] !== 2)
285
+ throw new Error("Expected a native Trivy JSON report with SchemaVersion 2.");
286
+ if (document["ArtifactType"] !== "repository" &&
287
+ document["ArtifactType"] !== "filesystem")
288
+ throw new Error("Only Trivy repository and filesystem reports are supported.");
289
+ const metadata = record(document["Metadata"] ?? {}, "Trivy Metadata");
290
+ const { urls } = trivyReportRemotes(document);
291
+ const report = {
292
+ ...pick(document, trivyHeaderFields),
293
+ ...(isRecord(document["Trivy"])
294
+ ? { Trivy: pick(document["Trivy"], ["Version"]) }
295
+ : {}),
296
+ ...(typeof document["ArtifactName"] === "string"
297
+ ? { ArtifactName: document["ArtifactName"] }
298
+ : {}),
299
+ Metadata: pick(metadata, ["RepoURL", "Branch", "Commit"]),
300
+ };
301
+ // A scan root requires corroboration. Explicit-root readers can inspect a report
302
+ // whose declarations still have to agree with the destination at import.
303
+ const root = resolveScanRoot(scanRoot, matchingTrivyRemotes(urls));
304
+ const entries = [];
305
+ for (const group of array(document["Results"] ?? [], "Trivy Results")) {
306
+ const result = record(group, "Trivy result");
307
+ if (result["Class"] !== "lang-pkgs") {
308
+ entries.push(`Unsupported Trivy result class: ${text(result["Class"]) ?? "(missing)"}. Only lang-pkgs vulnerabilities are imported.`);
309
+ continue;
310
+ }
311
+ for (const field of [
312
+ "Misconfigurations",
313
+ "Secrets",
314
+ "Licenses",
315
+ "CryptoAssets",
316
+ "CustomResources",
317
+ "ExperimentalModifiedFindings",
318
+ ])
319
+ if (array(result[field] ?? [], `Trivy ${field}`).length)
320
+ entries.push(`Unsupported Trivy ${field} in lang-pkgs result.`);
321
+ const vulnerabilities = array(result["Vulnerabilities"] ?? [], "Trivy Vulnerabilities");
322
+ if (!vulnerabilities.length)
323
+ continue;
324
+ const reportedTarget = result["Target"];
325
+ if (reportedTarget != null && typeof reportedTarget !== "string")
326
+ throw new Error("Trivy result Target must be text.");
327
+ const context = {
328
+ ...(reportedTarget == null ? {} : { Target: reportedTarget }),
329
+ Type: requiredText(result["Type"], "Trivy result Type"),
330
+ Class: result["Class"],
331
+ };
332
+ const packages = indexPackages(result["Packages"]);
333
+ for (const value of vulnerabilities)
334
+ entries.push({ result: context, packages, value });
335
+ }
336
+ const findings = normalizeRecords(entries, (entry) => {
337
+ const row = occurrence(entry, root);
338
+ const { result, packages, vulnerability, advisory, name, targetPath } = row;
339
+ const identifier = vulnerability["PkgIdentifier"];
340
+ const purl = isRecord(identifier) ? text(identifier["PURL"]) : null;
341
+ const ecosystem = purl?.match(/^pkg:([a-z][a-z\d.+-]*)\//iu)?.[1]?.toLowerCase() ??
342
+ result.Type;
343
+ const pkg = matchingPackage(vulnerability, packages);
344
+ const manifest = nonManifestTypes.has(result.Type) ? null : targetPath;
345
+ // Trivy uses the same spelling for archive members and files in exploded archives.
346
+ let declaration = row.pkgPath ? row.packagePath : manifest;
347
+ if (result.Type === "jar" &&
348
+ row.pkgPath !== null &&
349
+ javaArchiveAncestor.test(row.pkgPath) &&
350
+ /\.(?:jar|ear|war)$/u.test(row.pkgPath))
351
+ declaration = null;
352
+ const locations = [];
353
+ if (targetPath && targetPath !== declaration)
354
+ locations.push({ path: targetPath, line: null });
355
+ if (declaration) {
356
+ // The scan target already consumes a slot when it differs from this declaration.
357
+ const lineLimit = locationLimit - locations.length;
358
+ const lines = new Set();
359
+ for (const range of array(pkg?.["Locations"] ?? [], "Trivy package Locations")) {
360
+ const start = isRecord(range) && range["StartLine"];
361
+ if (typeof start === "number" &&
362
+ Number.isSafeInteger(start) &&
363
+ start > 0 &&
364
+ lines.size < lineLimit)
365
+ lines.add(start);
366
+ }
367
+ if (!lines.size)
368
+ locations.push({ path: declaration, line: null });
369
+ for (const line of lines)
370
+ locations.push({ path: declaration, line });
371
+ }
372
+ return validateExternalEvidence({
373
+ title: text(vulnerability["Title"]) ?? `${advisory} in ${name}`,
374
+ severity: reportableScannerSeverity(vulnerability["Severity"]),
375
+ description: text(vulnerability["Description"]),
376
+ url: text(vulnerability["PrimaryURL"]),
377
+ advisory_ids: [
378
+ ...new Set([advisory, ...strings(vulnerability["VendorIDs"])]),
379
+ ],
380
+ packages: [
381
+ {
382
+ name,
383
+ ecosystem,
384
+ manifest_path: manifest,
385
+ installed_version: text(vulnerability["InstalledVersion"]),
386
+ fixed_versions: text(vulnerability["FixedVersion"])
387
+ ?.split(",")
388
+ .map((version) => version.trim())
389
+ .filter(Boolean) ?? [],
390
+ },
391
+ ],
392
+ locations,
393
+ branch: text(metadata["Branch"]),
394
+ source_scan_id: text(document["ReportID"]),
395
+ source_data: structuredClone({
396
+ scanRoot: root,
397
+ report,
398
+ result,
399
+ vulnerability,
400
+ ...(pkg
401
+ ? {
402
+ package: pick(pkg, [
403
+ "ID",
404
+ "Name",
405
+ "Version",
406
+ "Identifier",
407
+ "FilePath",
408
+ "Relationship",
409
+ "Locations",
410
+ ]),
411
+ }
412
+ : {}),
413
+ }),
414
+ }, target);
415
+ }, (entry) => {
416
+ const { result, advisory, name, pkgPath, targetPath, packagePath } = occurrence(entry, root);
417
+ const manifest = targetPath ?? text(result.Target);
418
+ const concretePath = packagePath ?? pkgPath;
419
+ return stableId("trivy", [
420
+ result.Type,
421
+ manifest,
422
+ advisory,
423
+ name,
424
+ concretePath === manifest ? null : concretePath,
425
+ ...(!targetPath && !packagePath && root !== "." ? [root] : []),
426
+ ]);
427
+ }, target);
428
+ if (!findings.findings.length)
429
+ findings.report = report;
430
+ return findings;
431
+ }
432
+ export async function readTrivyFindings(path, target = "cloud", scanRoot) {
433
+ return normalizeTrivyFindings(await readScannerJson(path), target, scanRoot);
434
+ }
435
+ //# sourceMappingURL=trivy-findings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trivy-findings.js","sourceRoot":"","sources":["../src/trivy-findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,eAAe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E,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,MAAM,GAAyB,OAAO,EACtC,QAAiB;IAEjB,OAAO,sBAAsB,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { posix, sep } from \"node:path\";\nimport type { ExternalImportTarget } from \"./external-import-contract.js\";\nimport { validateExternalEvidence } from \"./external-import-contract.js\";\nimport type { ExternalFindings } from \"./external-findings.js\";\nimport { isGitHubCloudHost, isGitSsh, parseGitRemote } from \"./git-remote.js\";\nimport {\n hostedRepositoryUrlKey,\n normalizeHostedGitRepositoryUrl,\n} from \"./hosted-git-repository.js\";\nimport { isRecord } from \"./record.js\";\nimport {\n array,\n normalizeRecords,\n readScannerJson,\n record,\n relativePath,\n reportableScannerSeverity,\n requiredText,\n stableId,\n strings,\n text,\n} from \"./scanner-import.js\";\n\ntype NativeRecord = Record<string, unknown>;\n\nconst urlScheme = /^[a-z][a-z\\d+.-]*:\\/\\//iu;\nconst javaArchiveAncestor = /\\.(?:jar|war|ear|par)\\//iu;\nconst cloudLocationLimit = 100;\n\nconst curlUrlPrefix = /^(?:(?:https?|ftps?)::)?(?:https?|ftps?):\\/{1,3}/iu;\nconst unsafeRepositoryUrl =\n \"Use a Trivy repository URL without credentials, a query, or a fragment.\";\n\nfunction hasHttpUserinfo(\n value: string | null,\n allowImplicitHttps: boolean,\n): boolean {\n if (!value) return false;\n const prefix = curlUrlPrefix.exec(value)?.[0];\n if (!prefix && (!allowImplicitHttps || /^[a-z]:[\\\\/]/iu.test(value)))\n return false;\n // Git's HTTP transport treats backslashes before @ as part of userinfo.\n const authority = value.slice(prefix?.length ?? 0).split(/[/?#]/u, 1)[0]!;\n const at = authority.lastIndexOf(\"@\");\n const colon = authority.indexOf(\":\");\n const scp = colon > authority.indexOf(\"@\");\n // A bare user@host:path is Git's SSH form. Trivy reads user@host/path as HTTPS.\n return at > 0 && (!!prefix || (!scp && !authority.includes(\"\\\\\", at + 1)));\n}\n\nfunction networkRepository(value: unknown): string | null {\n const source = text(value);\n if (!source || /^(?:[a-z]:|[./\\\\])/iu.test(source)) return null;\n const remote = parseGitRemote(source);\n if (!remote) return null;\n const { url } = remote;\n const ssh = isGitSsh(url.protocol);\n if (url.password || (!ssh && url.username) || /[?#\\t\\r\\n]/u.test(source))\n throw new Error(unsafeRepositoryUrl);\n if (url.protocol === \"file:\") return null;\n if (\n !url.hostname ||\n !remote.path ||\n (!ssh &&\n ![\"http:\", \"https:\", \"git:\", \"ftp:\", \"ftps:\"].includes(url.protocol))\n )\n throw new Error(\"Unsupported Trivy repository URL.\");\n return source;\n}\n\nfunction comparableGitHubRemote(\n remote: string,\n cloudRepositoryUrl?: string,\n): string | undefined {\n if (/[?#\\t\\r\\n]/u.test(remote)) return undefined;\n let parsed;\n try {\n parsed = parseGitRemote(remote);\n } catch {\n // A checkout can have unrelated remotes with no comparable URL.\n return undefined;\n }\n if (!parsed) return undefined;\n const prefix = `${parsed.url.protocol}//`;\n // Git dispatches mixed-case schemes to distinct remote helpers.\n if (!parsed.scpStyle && !remote.startsWith(prefix)) return undefined;\n const host = parsed.url.hostname.toLowerCase();\n const githubUrl =\n cloudRepositoryUrl ??\n (isGitHubCloudHost(host) ? `https://${host}` : undefined);\n const normalized = normalizeHostedGitRepositoryUrl(\n remote,\n githubUrl,\n githubUrl !== undefined,\n );\n if (!/^https?:\\/\\//iu.test(normalized)) return undefined;\n if (\n !isGitHubCloudHost(new URL(normalized).hostname) &&\n (!cloudRepositoryUrl || new URL(cloudRepositoryUrl).hostname !== host)\n )\n return undefined;\n return normalized;\n}\n\nexport function trivyRemoteKey(\n remote: string,\n cloudRepositoryUrl?: string,\n checkout = false,\n): string {\n const normalized = comparableGitHubRemote(remote, cloudRepositoryUrl);\n if (!normalized) return remote;\n // GitHub identifies an HTTPS repository by host and path. Other Git servers\n // may use the HTTP username to select the repository.\n const url = checkout\n ? normalized.replace(/^(https?:\\/\\/)[^/\\\\?#]*@/iu, \"$1\")\n : normalized;\n return hostedRepositoryUrlKey(\n url,\n true,\n false,\n cloudRepositoryUrl ? \"cloud\" : \"local\",\n );\n}\n\nconst sshScheme = /^(?:ssh|git\\+ssh|ssh\\+git):\\/\\//u;\n\nexport function trivyRemoteOmitsSshUser(url: string): boolean {\n return sshScheme.test(url) && !new URL(url).username;\n}\n\nexport const trivyHeaderFields = [\n \"SchemaVersion\",\n \"ArtifactType\",\n \"ArtifactID\",\n \"ReportID\",\n \"CreatedAt\",\n];\n\n// Go may rewrite escaped separators or unreserved bytes in mixed Unicode paths.\n// Only escape spaces and non-ASCII bytes when existing escapes are unambiguous.\nfunction escapedHttpTarget(target: string): string {\n return target.replace(\n /^(https?:\\/\\/[^/]+)(\\/(?:[^%]|%(?:2[05]|[89A-F][\\dA-F]))*)$/u,\n (_, authority: string, path: string) =>\n authority + path.replace(/[ \\P{ASCII}]+/gu, encodeURIComponent),\n );\n}\n\nexport function trivyReportRemotes(report: unknown) {\n if (!isRecord(report)) return { urls: [] };\n const metadata = report[\"Metadata\"];\n const repoUrl = text(isRecord(metadata) && metadata[\"RepoURL\"]);\n const name = text(report[\"ArtifactName\"]);\n if (\n hasHttpUserinfo(repoUrl, true) ||\n hasHttpUserinfo(name, report[\"ArtifactType\"] !== \"filesystem\")\n )\n throw new Error(unsafeRepositoryUrl);\n const repository = networkRepository(repoUrl);\n let artifact = name && urlScheme.test(name) ? networkRepository(name) : null;\n if (report[\"SchemaVersion\"] !== 2) return { urls: [] };\n // A filesystem display label is validated but never identifies the repository.\n if (report[\"ArtifactType\"] === \"filesystem\")\n return { urls: repository ? [repository] : [] };\n // Trivy accepts scheme-less HTTPS targets and relative checkout paths.\n // A scheme-less name identifies a remote only when Git metadata corroborates it.\n const target =\n artifact ??\n (name && /^[^./:\\\\][^/:\\\\]*\\//u.test(name) ? `https://${name}` : null);\n if (\n target &&\n repository &&\n report[\"ArtifactType\"] === \"repository\" &&\n (target === repository || escapedHttpTarget(target) === repository)\n )\n artifact = repository;\n // A checkout-supplied label cannot restore an omitted SSH user. Keep any\n // other difference visible when validating the report's repository claims.\n if (\n repository &&\n trivyRemoteOmitsSshUser(repository) &&\n artifact?.replace(/^([^:]+:\\/\\/)[^/@]+@/u, \"$1\") === repository\n )\n return { urls: [repository] };\n return {\n urls: [repository, artifact].filter((url) => url !== null),\n uncorroboratedTarget: repository ? null : artifact,\n };\n}\n\nfunction matchingTrivyRemotes(\n [repository, artifact]: readonly string[],\n githubUrl?: string,\n): boolean {\n return (\n !!repository &&\n !!artifact &&\n trivyRemoteKey(repository, githubUrl) ===\n trivyRemoteKey(artifact, githubUrl)\n );\n}\n\n/** Compare the report's claims using the authenticated host when available. */\nexport function trivyRepositoryUrl(\n report: unknown,\n cloudRepositoryUrl?: string,\n): string | null {\n const { urls } = trivyReportRemotes(report);\n if (urls.length > 1 && !matchingTrivyRemotes(urls, cloudRepositoryUrl))\n throw new Error(\"Trivy source URLs identify different repositories.\");\n const remote = urls[0];\n return remote && cloudRepositoryUrl\n ? (comparableGitHubRemote(remote, cloudRepositoryUrl) ?? remote)\n : (remote ?? null);\n}\n\nfunction repositoryPath(value: unknown, directory = false): string | null {\n const raw = text(value);\n if (!raw || !relativePath(raw)) return null;\n // Check the emitted spelling across platforms while retaining literal POSIX backslashes.\n const path = posix.normalize(raw);\n const portable = posix.normalize(path.replaceAll(\"\\\\\", \"/\"));\n const firstComponent = portable.split(\"/\", 1)[0]!;\n const at = firstComponent.indexOf(\"@\", 1);\n const scpStyle = at !== -1 && firstComponent.indexOf(\":\", at + 2) !== -1;\n return relativePath(portable) &&\n (directory || (portable !== \".\" && !portable.endsWith(\"/\"))) &&\n !scpStyle &&\n !/^[a-z][a-z\\d+.-]*:\\//iu.test(portable)\n ? path\n : null;\n}\n\nconst aggregateTargets = new Map([\n [\"python-pkg\", \"Python\"],\n [\"conda-pkg\", \"Conda\"],\n [\"gemspec\", \"Ruby\"],\n [\"node-pkg\", \"Node.js\"],\n [\"jar\", \"Java\"],\n [\"kubernetes\", \"Kubernetes\"],\n]);\nconst nonManifestTypes = new Set([\n \"gobinary\",\n \"rustbinary\",\n \"jar\",\n \"javascript\",\n]);\n\nfunction resolveScanRoot(\n scanRoot: string | undefined,\n remoteRepository: boolean,\n): string {\n if (scanRoot === undefined) {\n if (remoteRepository) return \".\";\n throw new Error(\n \"Specify --trivy-scan-root relative to the repository; use . for a whole-checkout scan.\",\n );\n }\n const root = repositoryPath(scanRoot.split(sep).join(\"/\"), true)?.replace(\n /\\/$/u,\n \"\",\n );\n if (!root)\n throw new Error(\n \"--trivy-scan-root must be a repository-relative directory without traversal.\",\n );\n if (remoteRepository && root !== \".\")\n throw new Error(\n \"A remote Trivy repository scan starts at the checkout root; --trivy-scan-root must be .\",\n );\n return root;\n}\n\nfunction scopedPath(root: string, value: unknown): string | null {\n const path = repositoryPath(value);\n return path === null ? null : posix.join(root, path);\n}\n\nfunction pick(source: NativeRecord, fields: string[]): NativeRecord {\n return Object.fromEntries(\n fields\n .filter((field) => Object.hasOwn(source, field))\n .map((field) => [field, source[field]]),\n );\n}\n\nfunction packageKeys(row: NativeRecord, inventory: boolean) {\n const path = row[inventory ? \"FilePath\" : \"PkgPath\"];\n const identifier = row[inventory ? \"Identifier\" : \"PkgIdentifier\"];\n const name = row[inventory ? \"Name\" : \"PkgName\"];\n const version = row[inventory ? \"Version\" : \"InstalledVersion\"];\n const file = repositoryPath(path) ?? text(path);\n const key = (kind: string, value: unknown) =>\n text(value) && JSON.stringify([kind, value, file]);\n const native = isRecord(identifier) ? identifier : {};\n return {\n id: key(\"id\", row[inventory ? \"ID\" : \"PkgID\"]),\n uid: key(\"uid\", native[\"UID\"]),\n purl: key(\"purl\", native[\"PURL\"]),\n bomRef: key(\"bomRef\", native[\"BOMRef\"]),\n nameVersion:\n text(name) &&\n text(version) &&\n JSON.stringify([\"name-version\", name, version, file]),\n };\n}\n\ntype PackageIndex = Map<\n string,\n { pkg: NativeRecord; keys: ReturnType<typeof packageKeys> } | null\n>;\n\nfunction indexPackages(packages: unknown): PackageIndex {\n const index: PackageIndex = new Map();\n for (const value of array(packages ?? [], \"Trivy Packages\")) {\n const pkg = record(value, \"Trivy package\");\n const keys = packageKeys(pkg, true);\n const match = { pkg, keys };\n for (const key of Object.values(keys))\n if (key) index.set(key, index.has(key) ? null : match);\n }\n return index;\n}\n\nfunction matchingPackage(vulnerability: NativeRecord, index: PackageIndex) {\n const keys = packageKeys(vulnerability, false);\n const supplied = ([\"uid\", \"id\", \"purl\", \"bomRef\"] as const).filter(\n (field) => keys[field],\n );\n for (const field of supplied.length ? supplied : ([\"nameVersion\"] as const)) {\n const key = keys[field];\n const match = key && index.get(key);\n if (\n match &&\n agreesWhenPresent(vulnerability[\"PkgName\"], match.pkg[\"Name\"]) &&\n agreesWhenPresent(\n vulnerability[\"InstalledVersion\"],\n match.pkg[\"Version\"],\n ) &&\n supplied.every((id) => !match.keys[id] || keys[id] === match.keys[id])\n )\n return match.pkg;\n }\n return null;\n}\n\nfunction agreesWhenPresent(detected: unknown, inventoried: unknown): boolean {\n return !text(detected) || !text(inventoried) || detected === inventoried;\n}\n\ninterface Entry {\n result: { Target?: string; Type: string; Class: string };\n packages: PackageIndex;\n value: unknown;\n}\n\nfunction occurrence(entry: Entry | string, root: string) {\n if (typeof entry === \"string\") throw new Error(entry);\n const vulnerability = record(entry.value, \"Trivy vulnerability\");\n const { Target, Type } = entry.result;\n return {\n ...entry,\n vulnerability,\n advisory: requiredText(\n vulnerability[\"VulnerabilityID\"],\n \"Trivy VulnerabilityID\",\n ),\n name: requiredText(vulnerability[\"PkgName\"], \"Trivy PkgName\"),\n pkgPath: text(vulnerability[\"PkgPath\"]),\n targetPath:\n aggregateTargets.get(Type) === Target ? null : scopedPath(root, Target),\n packagePath: scopedPath(root, vulnerability[\"PkgPath\"]),\n };\n}\n\n/** Import native Trivy dependency occurrences. Local scans require their checkout-relative\n * scan root. The package ecosystem is the PURL type when supplied, otherwise the analyzer. */\nexport function normalizeTrivyFindings(\n input: unknown,\n target: ExternalImportTarget = \"cloud\",\n scanRoot?: string,\n): ExternalFindings {\n const locationLimit = target === \"cloud\" ? cloudLocationLimit : Infinity;\n return normalizeReport(input, target, scanRoot, locationLimit);\n}\n\n/** @internal Only a finding at the Cloud location limit can have a different prior selection. */\nexport function needsPreviousTrivyProjection({ findings }: ExternalFindings) {\n return findings.some(\n ({ evidence }) => evidence.locations?.length === cloudLocationLimit,\n );\n}\n\n/** @internal Reconstruct the original selection for an interrupted Cloud request. */\nexport function normalizePreviousTrivyFindings(\n input: unknown,\n target: ExternalImportTarget = \"cloud\",\n scanRoot?: string,\n): ExternalFindings {\n return normalizeReport(input, target, scanRoot, Infinity);\n}\n\nfunction normalizeReport(\n input: unknown,\n target: ExternalImportTarget,\n scanRoot: string | undefined,\n locationLimit: number,\n): ExternalFindings {\n const document = record(input, \"Trivy report\");\n if (document[\"SchemaVersion\"] !== 2)\n throw new Error(\n \"Expected a native Trivy JSON report with SchemaVersion 2.\",\n );\n if (\n document[\"ArtifactType\"] !== \"repository\" &&\n document[\"ArtifactType\"] !== \"filesystem\"\n )\n throw new Error(\n \"Only Trivy repository and filesystem reports are supported.\",\n );\n const metadata = record(document[\"Metadata\"] ?? {}, \"Trivy Metadata\");\n const { urls } = trivyReportRemotes(document);\n const report = {\n ...pick(document, trivyHeaderFields),\n ...(isRecord(document[\"Trivy\"])\n ? { Trivy: pick(document[\"Trivy\"], [\"Version\"]) }\n : {}),\n ...(typeof document[\"ArtifactName\"] === \"string\"\n ? { ArtifactName: document[\"ArtifactName\"] }\n : {}),\n Metadata: pick(metadata, [\"RepoURL\", \"Branch\", \"Commit\"]),\n };\n // A scan root requires corroboration. Explicit-root readers can inspect a report\n // whose declarations still have to agree with the destination at import.\n const root = resolveScanRoot(scanRoot, matchingTrivyRemotes(urls));\n\n const entries: (Entry | string)[] = [];\n for (const group of array(document[\"Results\"] ?? [], \"Trivy Results\")) {\n const result = record(group, \"Trivy result\");\n if (result[\"Class\"] !== \"lang-pkgs\") {\n entries.push(\n `Unsupported Trivy result class: ${text(result[\"Class\"]) ?? \"(missing)\"}. Only lang-pkgs vulnerabilities are imported.`,\n );\n continue;\n }\n for (const field of [\n \"Misconfigurations\",\n \"Secrets\",\n \"Licenses\",\n \"CryptoAssets\",\n \"CustomResources\",\n \"ExperimentalModifiedFindings\",\n ])\n if (array(result[field] ?? [], `Trivy ${field}`).length)\n entries.push(`Unsupported Trivy ${field} in lang-pkgs result.`);\n\n const vulnerabilities = array(\n result[\"Vulnerabilities\"] ?? [],\n \"Trivy Vulnerabilities\",\n );\n if (!vulnerabilities.length) continue;\n const reportedTarget = result[\"Target\"];\n if (reportedTarget != null && typeof reportedTarget !== \"string\")\n throw new Error(\"Trivy result Target must be text.\");\n const context = {\n ...(reportedTarget == null ? {} : { Target: reportedTarget }),\n Type: requiredText(result[\"Type\"], \"Trivy result Type\"),\n Class: result[\"Class\"],\n };\n const packages = indexPackages(result[\"Packages\"]);\n for (const value of vulnerabilities)\n entries.push({ result: context, packages, value });\n }\n\n const findings = normalizeRecords(\n entries,\n (entry) => {\n const row = occurrence(entry, root);\n const { result, packages, vulnerability, advisory, name, targetPath } =\n row;\n const identifier = vulnerability[\"PkgIdentifier\"];\n const purl = isRecord(identifier) ? text(identifier[\"PURL\"]) : null;\n const ecosystem =\n purl?.match(/^pkg:([a-z][a-z\\d.+-]*)\\//iu)?.[1]?.toLowerCase() ??\n result.Type;\n const pkg = matchingPackage(vulnerability, packages);\n const manifest = nonManifestTypes.has(result.Type) ? null : targetPath;\n // Trivy uses the same spelling for archive members and files in exploded archives.\n let declaration = row.pkgPath ? row.packagePath : manifest;\n if (\n result.Type === \"jar\" &&\n row.pkgPath !== null &&\n javaArchiveAncestor.test(row.pkgPath) &&\n /\\.(?:jar|ear|war)$/u.test(row.pkgPath)\n )\n declaration = null;\n const locations: { path: string; line: number | null }[] = [];\n if (targetPath && targetPath !== declaration)\n locations.push({ path: targetPath, line: null });\n if (declaration) {\n // The scan target already consumes a slot when it differs from this declaration.\n const lineLimit = locationLimit - locations.length;\n const lines = new Set<number>();\n for (const range of array(\n pkg?.[\"Locations\"] ?? [],\n \"Trivy package Locations\",\n )) {\n const start = isRecord(range) && range[\"StartLine\"];\n if (\n typeof start === \"number\" &&\n Number.isSafeInteger(start) &&\n start > 0 &&\n lines.size < lineLimit\n )\n lines.add(start);\n }\n if (!lines.size) locations.push({ path: declaration, line: null });\n for (const line of lines) locations.push({ path: declaration, line });\n }\n return validateExternalEvidence(\n {\n title: text(vulnerability[\"Title\"]) ?? `${advisory} in ${name}`,\n severity: reportableScannerSeverity(vulnerability[\"Severity\"]),\n description: text(vulnerability[\"Description\"]),\n url: text(vulnerability[\"PrimaryURL\"]),\n advisory_ids: [\n ...new Set([advisory, ...strings(vulnerability[\"VendorIDs\"])]),\n ],\n packages: [\n {\n name,\n ecosystem,\n manifest_path: manifest,\n installed_version: text(vulnerability[\"InstalledVersion\"]),\n fixed_versions:\n text(vulnerability[\"FixedVersion\"])\n ?.split(\",\")\n .map((version) => version.trim())\n .filter(Boolean) ?? [],\n },\n ],\n locations,\n branch: text(metadata[\"Branch\"]),\n source_scan_id: text(document[\"ReportID\"]),\n source_data: structuredClone({\n scanRoot: root,\n report,\n result,\n vulnerability,\n ...(pkg\n ? {\n package: pick(pkg, [\n \"ID\",\n \"Name\",\n \"Version\",\n \"Identifier\",\n \"FilePath\",\n \"Relationship\",\n \"Locations\",\n ]),\n }\n : {}),\n }),\n },\n target,\n );\n },\n (entry) => {\n const { result, advisory, name, pkgPath, targetPath, packagePath } =\n occurrence(entry, root);\n const manifest = targetPath ?? text(result.Target);\n const concretePath = packagePath ?? pkgPath;\n return stableId(\"trivy\", [\n result.Type,\n manifest,\n advisory,\n name,\n concretePath === manifest ? null : concretePath,\n ...(!targetPath && !packagePath && root !== \".\" ? [root] : []),\n ]);\n },\n target,\n );\n if (!findings.findings.length) findings.report = report;\n return findings;\n}\n\nexport async function readTrivyFindings(\n path: string,\n target: ExternalImportTarget = \"cloud\",\n scanRoot?: string,\n): Promise<ExternalFindings> {\n return normalizeTrivyFindings(await readScannerJson(path), target, scanRoot);\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import type { ExternalFinding, ExternalFindings, ExternalSourceRepository } from "./external-findings.js";
2
+ import type { ExternalImportTarget } from "./external-import-contract.js";
3
+ import type { LocalFindingProvider } from "./external-findings-read.js";
4
+ export declare function validateTrivyRepositoryUrl(value: string): void;
5
+ /** A canonical occurrence ID can identify a projected native repository declaration. */
6
+ export declare function retainedTrivyReport({ source_finding_id: id, evidence, }: ExternalFinding): unknown;
7
+ /** Each selected finding must retain the repository asserted by a native batch header. */
8
+ export declare function trivyBatchSourceUrls(input: ExternalFindings, bind: boolean): string[];
9
+ /** A native header supplies provenance for the selected rows, not independent run metadata. */
10
+ export declare function isTrivyReportHeader(report: Record<string, unknown>): boolean;
11
+ /** Retained rows keep their scanner identity even if the report header is projected out. */
12
+ export declare function checkRetainedTrivyProvider(provider: LocalFindingProvider, finding: ExternalFinding, target?: ExternalImportTarget): void;
13
+ export declare function checkTrivyReportProvider(provider: LocalFindingProvider, report: unknown): void;
14
+ export declare function matchTrivyCheckout(repository: string, trivy: ExternalFindings, references: readonly ExternalSourceRepository[], { protectedRoot, environment, signal, }: {
15
+ protectedRoot: string[];
16
+ environment: NodeJS.ProcessEnv;
17
+ signal?: AbortSignal | undefined;
18
+ }): Promise<boolean>;
19
+ //# sourceMappingURL=trivy-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trivy-import.d.ts","sourceRoot":"","sources":["../src/trivy-import.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+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