@openai/codex-security 0.1.31 → 0.3.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 (514) hide show
  1. package/README.md +442 -2434
  2. package/_bundled_plugin/.app.json +5 -1
  3. package/_bundled_plugin/.codex-plugin/plugin.json +9 -5
  4. package/_bundled_plugin/.mcp.json +3 -0
  5. package/_bundled_plugin/examples/completed-scan/coverage.json +0 -1
  6. package/_bundled_plugin/examples/completed-scan/report.md +28 -26
  7. package/_bundled_plugin/examples/completed-scan/scan-manifest.json +1 -1
  8. package/_bundled_plugin/mcp/helpers.mjs +1 -0
  9. package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
  10. package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +7 -214
  11. package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
  12. package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
  13. package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
  14. package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
  15. package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
  16. package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
  17. package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
  18. package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
  19. package/_bundled_plugin/mcp/permission-profile-preflight.mjs +563 -0
  20. package/_bundled_plugin/mcp/server.mjs +1 -0
  21. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  22. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  23. package/_bundled_plugin/preflight/capability-profiles.toml +0 -13
  24. package/_bundled_plugin/references/artifact-storage.md +5 -5
  25. package/_bundled_plugin/references/config-preflight.md +1 -5
  26. package/_bundled_plugin/references/core-scan.md +34 -10
  27. package/_bundled_plugin/references/final-report.md +13 -13
  28. package/_bundled_plugin/references/finding-detail-fields.md +90 -80
  29. package/_bundled_plugin/references/sarif-adapter.md +1 -1
  30. package/_bundled_plugin/references/scan-artifacts.md +3 -4
  31. package/_bundled_plugin/references/scan-contract.md +11 -6
  32. package/_bundled_plugin/references/scan-prologue.md +12 -0
  33. package/_bundled_plugin/references/security-guidance.md +2 -2
  34. package/_bundled_plugin/references/standalone-validation.md +11 -0
  35. package/_bundled_plugin/references/threat-model.md +2 -2
  36. package/_bundled_plugin/schemas/coverage.schema.json +23 -47
  37. package/_bundled_plugin/schemas/definitions/artifact-common.schema.json +2 -24
  38. package/_bundled_plugin/schemas/definitions/discovery-candidate.schema.json +49 -25
  39. package/_bundled_plugin/schemas/findings.schema.json +71 -192
  40. package/_bundled_plugin/schemas/scan-manifest.schema.json +83 -95
  41. package/_bundled_plugin/schemas/tools/candidate-attack-paths.schema.json +91 -83
  42. package/_bundled_plugin/schemas/tools/candidate-validations.schema.json +35 -64
  43. package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +5 -2
  44. package/_bundled_plugin/schemas/tools/discovery-candidates.schema.json +6 -55
  45. package/_bundled_plugin/schemas/tools/review-items.schema.json +2 -38
  46. package/_bundled_plugin/schemas/tools/scan-draft.schema.json +245 -356
  47. package/_bundled_plugin/scripts/codex_profile.mjs +239 -0
  48. package/_bundled_plugin/scripts/codex_session.mjs +53 -0
  49. package/_bundled_plugin/scripts/config_preflight.py +29 -69
  50. package/_bundled_plugin/scripts/deep_scan_config.py +9 -11
  51. package/_bundled_plugin/scripts/deep_scan_workbench.py +208 -363
  52. package/_bundled_plugin/scripts/filesystem_identity.py +1 -5
  53. package/_bundled_plugin/scripts/finalize_scan_contract.py +733 -375
  54. package/_bundled_plugin/scripts/finding_preview.py +81 -91
  55. package/_bundled_plugin/scripts/generate_in_scope_files.py +48 -102
  56. package/_bundled_plugin/scripts/generate_rank_input.py +117 -888
  57. package/_bundled_plugin/scripts/launch_codex_security_mcp +35 -6
  58. package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +5 -5
  59. package/_bundled_plugin/scripts/rank_preview.py +43 -902
  60. package/_bundled_plugin/scripts/report_projection.py +143 -219
  61. package/_bundled_plugin/scripts/snapshot_sqlite.py +6 -1
  62. package/_bundled_plugin/scripts/threat_model_projection.py +161 -0
  63. package/_bundled_plugin/scripts/validate_scan_contract.py +4 -34
  64. package/_bundled_plugin/scripts/validate_tracking_source.py +3 -13
  65. package/_bundled_plugin/scripts/windows_scan_local_files.py +59 -9
  66. package/_bundled_plugin/scripts/workbench/handoff.py +25 -50
  67. package/_bundled_plugin/scripts/workbench/runtime_toml.py +22 -0
  68. package/_bundled_plugin/scripts/workbench/storage.py +21 -6
  69. package/_bundled_plugin/scripts/workbench_cli.py +99 -190
  70. package/_bundled_plugin/scripts/workbench_constants.py +6 -14
  71. package/_bundled_plugin/scripts/workbench_db.py +524 -672
  72. package/_bundled_plugin/scripts/workbench_feedback.py +6 -3
  73. package/_bundled_plugin/scripts/workbench_finding_index.py +20 -7
  74. package/_bundled_plugin/scripts/workbench_finding_workflows.py +18 -4
  75. package/_bundled_plugin/scripts/workbench_local_dedupe.py +136 -0
  76. package/_bundled_plugin/scripts/workbench_native_indexes.py +28 -18
  77. package/_bundled_plugin/scripts/workbench_progress.py +26 -92
  78. package/_bundled_plugin/scripts/workbench_publication.py +77 -116
  79. package/_bundled_plugin/scripts/workbench_remediation.py +14 -20
  80. package/_bundled_plugin/scripts/workbench_saved_results.py +1402 -263
  81. package/_bundled_plugin/scripts/workbench_scan_history.py +57 -57
  82. package/_bundled_plugin/scripts/workbench_scan_start.py +109 -52
  83. package/_bundled_plugin/scripts/workbench_scan_usage.py +30 -49
  84. package/_bundled_plugin/scripts/workbench_schema.py +71 -1370
  85. package/_bundled_plugin/scripts/workbench_source_excerpt.py +16 -7
  86. package/_bundled_plugin/scripts/workbench_target.py +526 -150
  87. package/_bundled_plugin/scripts/workbench_target_state.py +1 -5
  88. package/_bundled_plugin/scripts/workbench_validation.py +19 -44
  89. package/_bundled_plugin/shared/workbench-history-repairs.json +218 -0
  90. package/_bundled_plugin/shared/workbench-migrations.json +397 -0
  91. package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +15 -4
  92. package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -0
  93. package/_bundled_plugin/skills/cloud-findings/SKILL.md +54 -0
  94. package/_bundled_plugin/skills/cloud-findings/agents/openai.yaml +4 -0
  95. package/_bundled_plugin/skills/deep-security-scan/SKILL.md +6 -6
  96. package/_bundled_plugin/skills/deep-security-scan/agents/openai.yaml +1 -1
  97. package/_bundled_plugin/skills/finding-discovery/SKILL.md +3 -3
  98. package/_bundled_plugin/skills/propose-security-hardening/references/proposal-format.md +50 -20
  99. package/_bundled_plugin/skills/security-diff-scan/SKILL.md +8 -14
  100. package/_bundled_plugin/skills/security-diff-scan/agents/openai.yaml +1 -1
  101. package/_bundled_plugin/skills/security-scan/SKILL.md +22 -7
  102. package/_bundled_plugin/skills/security-scan/agents/openai.yaml +1 -1
  103. package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +2 -2
  104. package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +13 -1
  105. package/_bundled_plugin/skills/threat-model/SKILL.md +2 -2
  106. package/_bundled_plugin/skills/track-findings/SKILL.md +46 -178
  107. package/_bundled_plugin/skills/track-findings/agents/openai.yaml +1 -1
  108. package/_bundled_plugin/skills/track-findings/references/github-security-advisories.md +16 -24
  109. package/_bundled_plugin/skills/track-findings/references/jira.md +15 -61
  110. package/_bundled_plugin/skills/triage-finding/SKILL.md +50 -289
  111. package/_bundled_plugin/skills/triage-finding/agents/openai.yaml +2 -2
  112. package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +23 -43
  113. package/_bundled_plugin/skills/triage-finding/references/triage-result-contract.md +7 -1
  114. package/bin/codex-security.mjs +9 -2
  115. package/dist/api.d.ts +63 -15
  116. package/dist/api.d.ts.map +1 -1
  117. package/dist/api.js +970 -553
  118. package/dist/api.js.map +1 -1
  119. package/dist/artifact-export.d.ts +70 -0
  120. package/dist/artifact-export.d.ts.map +1 -0
  121. package/dist/artifact-export.js +292 -0
  122. package/dist/artifact-export.js.map +1 -0
  123. package/dist/auth.d.ts +2 -6
  124. package/dist/auth.d.ts.map +1 -1
  125. package/dist/auth.js +27 -12
  126. package/dist/auth.js.map +1 -1
  127. package/dist/bulk-scan-discovery.d.ts +1 -0
  128. package/dist/bulk-scan-discovery.d.ts.map +1 -1
  129. package/dist/bulk-scan-discovery.js +9 -9
  130. package/dist/bulk-scan-discovery.js.map +1 -1
  131. package/dist/classify-scan-severity.d.ts.map +1 -1
  132. package/dist/classify-scan-severity.js +2 -5
  133. package/dist/classify-scan-severity.js.map +1 -1
  134. package/dist/classify-severity.d.ts +28 -17
  135. package/dist/classify-severity.d.ts.map +1 -1
  136. package/dist/classify-severity.js +16 -35
  137. package/dist/classify-severity.js.map +1 -1
  138. package/dist/cli-help.d.ts +3 -0
  139. package/dist/cli-help.d.ts.map +1 -0
  140. package/dist/cli-help.js +285 -0
  141. package/dist/cli-help.js.map +1 -0
  142. package/dist/cli-signals.d.ts +8 -0
  143. package/dist/cli-signals.d.ts.map +1 -0
  144. package/dist/cli-signals.js +28 -0
  145. package/dist/cli-signals.js.map +1 -0
  146. package/dist/cli.d.ts +22 -24
  147. package/dist/cli.d.ts.map +1 -1
  148. package/dist/cli.js +1660 -1556
  149. package/dist/cli.js.map +1 -1
  150. package/dist/cloud-publish.d.ts.map +1 -1
  151. package/dist/cloud-publish.js +11 -17
  152. package/dist/cloud-publish.js.map +1 -1
  153. package/dist/codeowners.d.ts +19 -0
  154. package/dist/codeowners.d.ts.map +1 -0
  155. package/dist/codeowners.js +138 -0
  156. package/dist/codeowners.js.map +1 -0
  157. package/dist/codex-prompt.d.ts.map +1 -1
  158. package/dist/codex-prompt.js +1 -2
  159. package/dist/codex-prompt.js.map +1 -1
  160. package/dist/codex-sdk-environment.d.ts +3 -0
  161. package/dist/codex-sdk-environment.d.ts.map +1 -0
  162. package/dist/codex-sdk-environment.js +68 -0
  163. package/dist/codex-sdk-environment.js.map +1 -0
  164. package/dist/component-plan.d.ts +2 -5
  165. package/dist/component-plan.d.ts.map +1 -1
  166. package/dist/component-plan.js +38 -34
  167. package/dist/component-plan.js.map +1 -1
  168. package/dist/component-scan.d.ts +7 -5
  169. package/dist/component-scan.d.ts.map +1 -1
  170. package/dist/component-scan.js +54 -44
  171. package/dist/component-scan.js.map +1 -1
  172. package/dist/config.d.ts.map +1 -1
  173. package/dist/config.js +93 -104
  174. package/dist/config.js.map +1 -1
  175. package/dist/contract.d.ts +15 -2
  176. package/dist/contract.d.ts.map +1 -1
  177. package/dist/contract.js +124 -348
  178. package/dist/contract.js.map +1 -1
  179. package/dist/cost-model.d.ts +13 -6
  180. package/dist/cost-model.d.ts.map +1 -1
  181. package/dist/cost-model.js +75 -34
  182. package/dist/cost-model.js.map +1 -1
  183. package/dist/cost.d.ts +10 -2
  184. package/dist/cost.d.ts.map +1 -1
  185. package/dist/cost.js +116 -134
  186. package/dist/cost.js.map +1 -1
  187. package/dist/custom-validation-prompt.d.ts.map +1 -1
  188. package/dist/custom-validation-prompt.js +7 -6
  189. package/dist/custom-validation-prompt.js.map +1 -1
  190. package/dist/custom-validation.d.ts +1 -2
  191. package/dist/custom-validation.d.ts.map +1 -1
  192. package/dist/custom-validation.js +23 -16
  193. package/dist/custom-validation.js.map +1 -1
  194. package/dist/deduplication/checkpointed-review.d.ts +4 -2
  195. package/dist/deduplication/checkpointed-review.d.ts.map +1 -1
  196. package/dist/deduplication/checkpointed-review.js +33 -20
  197. package/dist/deduplication/checkpointed-review.js.map +1 -1
  198. package/dist/deduplication/codex-review.d.ts +9 -1
  199. package/dist/deduplication/codex-review.d.ts.map +1 -1
  200. package/dist/deduplication/codex-review.js +129 -20
  201. package/dist/deduplication/codex-review.js.map +1 -1
  202. package/dist/deduplication/deduplication-prompts.d.ts +5 -2
  203. package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
  204. package/dist/deduplication/deduplication-prompts.js +18 -4
  205. package/dist/deduplication/deduplication-prompts.js.map +1 -1
  206. package/dist/deduplication/deduplication-reviewer.d.ts +26 -4
  207. package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
  208. package/dist/deduplication/deduplication-reviewer.js +59 -47
  209. package/dist/deduplication/deduplication-reviewer.js.map +1 -1
  210. package/dist/deduplication/deduplication.d.ts.map +1 -1
  211. package/dist/deduplication/deduplication.js +59 -113
  212. package/dist/deduplication/deduplication.js.map +1 -1
  213. package/dist/deduplication/diagnostics.d.ts +17 -0
  214. package/dist/deduplication/diagnostics.d.ts.map +1 -0
  215. package/dist/deduplication/diagnostics.js +5 -0
  216. package/dist/deduplication/diagnostics.js.map +1 -0
  217. package/dist/deduplication/finding-schema.d.ts.map +1 -1
  218. package/dist/deduplication/finding-schema.js +7 -1
  219. package/dist/deduplication/finding-schema.js.map +1 -1
  220. package/dist/deduplication/local.d.ts +31 -0
  221. package/dist/deduplication/local.d.ts.map +1 -0
  222. package/dist/deduplication/local.js +166 -0
  223. package/dist/deduplication/local.js.map +1 -0
  224. package/dist/deduplication/records-protocol.d.ts.map +1 -1
  225. package/dist/deduplication/records-protocol.js +12 -28
  226. package/dist/deduplication/records-protocol.js.map +1 -1
  227. package/dist/deduplication/records.d.ts +188 -12
  228. package/dist/deduplication/records.d.ts.map +1 -1
  229. package/dist/deduplication/records.js +34 -24
  230. package/dist/deduplication/records.js.map +1 -1
  231. package/dist/deduplication/review.d.ts +7 -0
  232. package/dist/deduplication/review.d.ts.map +1 -1
  233. package/dist/deduplication/review.js.map +1 -1
  234. package/dist/deduplication/scan.d.ts +9 -3
  235. package/dist/deduplication/scan.d.ts.map +1 -1
  236. package/dist/deduplication/scan.js +159 -44
  237. package/dist/deduplication/scan.js.map +1 -1
  238. package/dist/deep-config.d.ts +2 -1
  239. package/dist/deep-config.d.ts.map +1 -1
  240. package/dist/deep-config.js +7 -23
  241. package/dist/deep-config.js.map +1 -1
  242. package/dist/deep-progress.d.ts +2 -1
  243. package/dist/deep-progress.d.ts.map +1 -1
  244. package/dist/deep-progress.js +32 -47
  245. package/dist/deep-progress.js.map +1 -1
  246. package/dist/deep-scan.d.ts +20 -0
  247. package/dist/deep-scan.d.ts.map +1 -0
  248. package/dist/deep-scan.js +113 -0
  249. package/dist/deep-scan.js.map +1 -0
  250. package/dist/errors.d.ts +5 -2
  251. package/dist/errors.d.ts.map +1 -1
  252. package/dist/errors.js +7 -7
  253. package/dist/errors.js.map +1 -1
  254. package/dist/feedback.d.ts.map +1 -1
  255. package/dist/feedback.js +53 -21
  256. package/dist/feedback.js.map +1 -1
  257. package/dist/finding-catalogue.d.ts.map +1 -1
  258. package/dist/finding-catalogue.js +26 -30
  259. package/dist/finding-catalogue.js.map +1 -1
  260. package/dist/finding-normalization.d.ts +5 -0
  261. package/dist/finding-normalization.d.ts.map +1 -0
  262. package/dist/finding-normalization.js +120 -0
  263. package/dist/finding-normalization.js.map +1 -0
  264. package/dist/finding-retrieval.d.ts +9 -0
  265. package/dist/finding-retrieval.d.ts.map +1 -1
  266. package/dist/finding-retrieval.js.map +1 -1
  267. package/dist/finding-workflow.d.ts +13 -8
  268. package/dist/finding-workflow.d.ts.map +1 -1
  269. package/dist/finding-workflow.js +18 -13
  270. package/dist/finding-workflow.js.map +1 -1
  271. package/dist/findings-client.d.ts +2 -1
  272. package/dist/findings-client.d.ts.map +1 -1
  273. package/dist/findings-client.js +36 -9
  274. package/dist/findings-client.js.map +1 -1
  275. package/dist/findings-errors.d.ts +16 -0
  276. package/dist/findings-errors.d.ts.map +1 -0
  277. package/dist/findings-errors.js +24 -0
  278. package/dist/findings-errors.js.map +1 -0
  279. package/dist/findings-import.d.ts +1 -1
  280. package/dist/findings-import.d.ts.map +1 -1
  281. package/dist/findings-import.js +16 -44
  282. package/dist/findings-import.js.map +1 -1
  283. package/dist/github.d.ts.map +1 -1
  284. package/dist/github.js +9 -4
  285. package/dist/github.js.map +1 -1
  286. package/dist/import-scan.d.ts.map +1 -1
  287. package/dist/import-scan.js +49 -39
  288. package/dist/import-scan.js.map +1 -1
  289. package/dist/index.d.ts +11 -5
  290. package/dist/index.d.ts.map +1 -1
  291. package/dist/index.js +2 -1
  292. package/dist/index.js.map +1 -1
  293. package/dist/knowledge-base.d.ts +7 -1
  294. package/dist/knowledge-base.d.ts.map +1 -1
  295. package/dist/knowledge-base.js +115 -47
  296. package/dist/knowledge-base.js.map +1 -1
  297. package/dist/linear.d.ts.map +1 -1
  298. package/dist/linear.js +4 -10
  299. package/dist/linear.js.map +1 -1
  300. package/dist/mock-scan.d.ts.map +1 -1
  301. package/dist/mock-scan.js +0 -1
  302. package/dist/mock-scan.js.map +1 -1
  303. package/dist/models.d.ts +24 -2
  304. package/dist/models.d.ts.map +1 -1
  305. package/dist/models.js.map +1 -1
  306. package/dist/multiscan.d.ts +9 -3
  307. package/dist/multiscan.d.ts.map +1 -1
  308. package/dist/multiscan.js +225 -153
  309. package/dist/multiscan.js.map +1 -1
  310. package/dist/owner-evidence.d.ts +10 -2
  311. package/dist/owner-evidence.d.ts.map +1 -1
  312. package/dist/owner-evidence.js +69 -14
  313. package/dist/owner-evidence.js.map +1 -1
  314. package/dist/patch-tui.d.ts.map +1 -1
  315. package/dist/patch-tui.js +5 -6
  316. package/dist/patch-tui.js.map +1 -1
  317. package/dist/project-config-schema.d.ts +10 -0
  318. package/dist/project-config-schema.d.ts.map +1 -1
  319. package/dist/project-config-schema.js +1 -0
  320. package/dist/project-config-schema.js.map +1 -1
  321. package/dist/project-config.d.ts +1 -0
  322. package/dist/project-config.d.ts.map +1 -1
  323. package/dist/project-config.js +5 -3
  324. package/dist/project-config.js.map +1 -1
  325. package/dist/prompt-files.d.ts +0 -1
  326. package/dist/prompt-files.d.ts.map +1 -1
  327. package/dist/prompt-files.js +2 -4
  328. package/dist/prompt-files.js.map +1 -1
  329. package/dist/provider-profile.d.ts +21 -0
  330. package/dist/provider-profile.d.ts.map +1 -0
  331. package/dist/provider-profile.js +133 -0
  332. package/dist/provider-profile.js.map +1 -0
  333. package/dist/publication-events.d.ts +6 -8
  334. package/dist/publication-events.d.ts.map +1 -1
  335. package/dist/publication-events.js +40 -79
  336. package/dist/publication-events.js.map +1 -1
  337. package/dist/publication-store.d.ts.map +1 -1
  338. package/dist/publication-store.js +48 -76
  339. package/dist/publication-store.js.map +1 -1
  340. package/dist/publication.d.ts +1 -2
  341. package/dist/publication.d.ts.map +1 -1
  342. package/dist/publication.js +7 -16
  343. package/dist/publication.js.map +1 -1
  344. package/dist/publish.d.ts +1 -5
  345. package/dist/publish.d.ts.map +1 -1
  346. package/dist/publish.js +138 -199
  347. package/dist/publish.js.map +1 -1
  348. package/dist/record.d.ts +2 -0
  349. package/dist/record.d.ts.map +1 -0
  350. package/dist/record.js +4 -0
  351. package/dist/record.js.map +1 -0
  352. package/dist/request-metadata.d.ts +9 -0
  353. package/dist/request-metadata.d.ts.map +1 -0
  354. package/dist/request-metadata.js +13 -0
  355. package/dist/request-metadata.js.map +1 -0
  356. package/dist/result.d.ts +4 -1
  357. package/dist/result.d.ts.map +1 -1
  358. package/dist/result.js +7 -0
  359. package/dist/result.js.map +1 -1
  360. package/dist/runtime.d.ts +25 -17
  361. package/dist/runtime.d.ts.map +1 -1
  362. package/dist/runtime.js +619 -255
  363. package/dist/runtime.js.map +1 -1
  364. package/dist/saved-scan-bootstrap.d.ts +14 -0
  365. package/dist/saved-scan-bootstrap.d.ts.map +1 -0
  366. package/dist/saved-scan-bootstrap.js +261 -0
  367. package/dist/saved-scan-bootstrap.js.map +1 -0
  368. package/dist/saved-scan.d.ts +1 -1
  369. package/dist/saved-scan.d.ts.map +1 -1
  370. package/dist/saved-scan.js +16 -32
  371. package/dist/saved-scan.js.map +1 -1
  372. package/dist/scan-activity.d.ts.map +1 -1
  373. package/dist/scan-activity.js +19 -30
  374. package/dist/scan-activity.js.map +1 -1
  375. package/dist/scan-comparison.d.ts +31 -18
  376. package/dist/scan-comparison.d.ts.map +1 -1
  377. package/dist/scan-comparison.js +307 -347
  378. package/dist/scan-comparison.js.map +1 -1
  379. package/dist/scan-dashboard.d.ts +3 -1
  380. package/dist/scan-dashboard.d.ts.map +1 -1
  381. package/dist/scan-dashboard.js +351 -92
  382. package/dist/scan-dashboard.js.map +1 -1
  383. package/dist/scan-history-renderer.d.ts.map +1 -1
  384. package/dist/scan-history-renderer.js +55 -15
  385. package/dist/scan-history-renderer.js.map +1 -1
  386. package/dist/scan-inputs.d.ts +6 -0
  387. package/dist/scan-inputs.d.ts.map +1 -0
  388. package/dist/scan-inputs.js +71 -0
  389. package/dist/scan-inputs.js.map +1 -0
  390. package/dist/scan-logs.d.ts +2 -3
  391. package/dist/scan-logs.d.ts.map +1 -1
  392. package/dist/scan-logs.js +14 -12
  393. package/dist/scan-logs.js.map +1 -1
  394. package/dist/scan-sessions.d.ts +4 -0
  395. package/dist/scan-sessions.d.ts.map +1 -1
  396. package/dist/scan-sessions.js +18 -3
  397. package/dist/scan-sessions.js.map +1 -1
  398. package/dist/scan-settings.d.ts +5 -0
  399. package/dist/scan-settings.d.ts.map +1 -1
  400. package/dist/scan-settings.js +4 -0
  401. package/dist/scan-settings.js.map +1 -1
  402. package/dist/scan-skill-paths.d.ts +8 -0
  403. package/dist/scan-skill-paths.d.ts.map +1 -0
  404. package/dist/scan-skill-paths.js +47 -0
  405. package/dist/scan-skill-paths.js.map +1 -0
  406. package/dist/security-policy-cli.d.ts.map +1 -1
  407. package/dist/security-policy-cli.js +15 -33
  408. package/dist/security-policy-cli.js.map +1 -1
  409. package/dist/security-policy.d.ts +17 -9
  410. package/dist/security-policy.d.ts.map +1 -1
  411. package/dist/security-policy.js +131 -98
  412. package/dist/security-policy.js.map +1 -1
  413. package/dist/server/api.d.ts +0 -1
  414. package/dist/server/api.d.ts.map +1 -1
  415. package/dist/server/api.js +0 -1
  416. package/dist/server/api.js.map +1 -1
  417. package/dist/server/embeddings.d.ts +3 -1
  418. package/dist/server/embeddings.d.ts.map +1 -1
  419. package/dist/server/embeddings.js +11 -3
  420. package/dist/server/embeddings.js.map +1 -1
  421. package/dist/server/errors.d.ts +5 -2
  422. package/dist/server/errors.d.ts.map +1 -1
  423. package/dist/server/errors.js +7 -0
  424. package/dist/server/errors.js.map +1 -1
  425. package/dist/server/sqlite-store.d.ts +0 -2
  426. package/dist/server/sqlite-store.d.ts.map +1 -1
  427. package/dist/server/sqlite-store.js +55 -55
  428. package/dist/server/sqlite-store.js.map +1 -1
  429. package/dist/server/storage.d.ts +0 -2
  430. package/dist/server/storage.d.ts.map +1 -1
  431. package/dist/server/storage.js.map +1 -1
  432. package/dist/severity-store.js +20 -32
  433. package/dist/severity-store.js.map +1 -1
  434. package/dist/standalone-validation-prompt.d.ts +2 -0
  435. package/dist/standalone-validation-prompt.d.ts.map +1 -0
  436. package/dist/standalone-validation-prompt.js +10 -0
  437. package/dist/standalone-validation-prompt.js.map +1 -0
  438. package/dist/suggest-owners.d.ts +6 -5
  439. package/dist/suggest-owners.d.ts.map +1 -1
  440. package/dist/suggest-owners.js +15 -10
  441. package/dist/suggest-owners.js.map +1 -1
  442. package/dist/targets.d.ts +12 -0
  443. package/dist/targets.d.ts.map +1 -1
  444. package/dist/targets.js +124 -62
  445. package/dist/targets.js.map +1 -1
  446. package/dist/trusted-executable.d.ts +6 -1
  447. package/dist/trusted-executable.d.ts.map +1 -1
  448. package/dist/trusted-executable.js +28 -9
  449. package/dist/trusted-executable.js.map +1 -1
  450. package/dist/value.d.ts +2 -0
  451. package/dist/value.d.ts.map +1 -0
  452. package/dist/value.js +27 -0
  453. package/dist/value.js.map +1 -0
  454. package/dist/version.d.ts.map +1 -1
  455. package/dist/version.js +3 -6
  456. package/dist/version.js.map +1 -1
  457. package/dist/windows-path.d.ts.map +1 -1
  458. package/dist/windows-path.js +1 -2
  459. package/dist/windows-path.js.map +1 -1
  460. package/dist/workbench-arguments.d.ts +3 -0
  461. package/dist/workbench-arguments.d.ts.map +1 -0
  462. package/dist/workbench-arguments.js +15 -0
  463. package/dist/workbench-arguments.js.map +1 -0
  464. package/dist/worker-progress.d.ts +2 -0
  465. package/dist/worker-progress.d.ts.map +1 -1
  466. package/dist/worker-progress.js +40 -46
  467. package/dist/worker-progress.js.map +1 -1
  468. package/docs/cli.md +1778 -0
  469. package/docs/dedupe-records.md +24 -0
  470. package/docs/findings-service.md +402 -0
  471. package/package.json +23 -23
  472. package/schemas/project-config.schema.json +5 -0
  473. package/_bundled_plugin/schemas/tools/worker-threat-model.schema.json +0 -18
  474. package/_bundled_plugin/scripts/normalize_candidates.py +0 -338
  475. package/_bundled_plugin/scripts/workbench_dashboard.py +0 -159
  476. package/_bundled_plugin/scripts/workbench_findings.py +0 -221
  477. package/_bundled_plugin/scripts/workbench_severity.py +0 -119
  478. package/_bundled_plugin/skills/assess-patch-risk/scripts/validate_patch_risk_assessment.py +0 -163
  479. package/dist/server/dashboard/THIRD_PARTY_NOTICES.txt +0 -276
  480. package/dist/server/dashboard/app.css +0 -2
  481. package/dist/server/dashboard/app.js +0 -66
  482. package/dist/server/dashboard/index.html +0 -18
  483. package/dist/server/dashboard-types.d.ts +0 -48
  484. package/dist/server/dashboard-types.d.ts.map +0 -1
  485. package/dist/server/dashboard-types.js +0 -2
  486. package/dist/server/dashboard-types.js.map +0 -1
  487. package/dist/server/dashboard.d.ts +0 -6
  488. package/dist/server/dashboard.d.ts.map +0 -1
  489. package/dist/server/dashboard.js +0 -59
  490. package/dist/server/dashboard.js.map +0 -1
  491. package/dist/server/findings-service.d.ts +0 -20
  492. package/dist/server/findings-service.d.ts.map +0 -1
  493. package/dist/server/findings-service.js +0 -31
  494. package/dist/server/findings-service.js.map +0 -1
  495. package/dist/server/index.d.ts +0 -2
  496. package/dist/server/index.d.ts.map +0 -1
  497. package/dist/server/index.js +0 -6
  498. package/dist/server/index.js.map +0 -1
  499. package/dist/server/routes.d.ts +0 -6
  500. package/dist/server/routes.d.ts.map +0 -1
  501. package/dist/server/routes.js +0 -86
  502. package/dist/server/routes.js.map +0 -1
  503. package/dist/server/serve.d.ts +0 -2
  504. package/dist/server/serve.d.ts.map +0 -1
  505. package/dist/server/serve.js +0 -28
  506. package/dist/server/serve.js.map +0 -1
  507. package/dist/server/server.d.ts +0 -10
  508. package/dist/server/server.d.ts.map +0 -1
  509. package/dist/server/server.js +0 -17
  510. package/dist/server/server.js.map +0 -1
  511. package/dist/server/validation.d.ts +0 -17
  512. package/dist/server/validation.d.ts.map +0 -1
  513. package/dist/server/validation.js +0 -53
  514. package/dist/server/validation.js.map +0 -1
@@ -0,0 +1,563 @@
1
+ // src/record.ts
2
+ function isRecord(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4
+ }
5
+ function asRecord(value) {
6
+ return isRecord(value) ? value : void 0;
7
+ }
8
+
9
+ // src/deep-scan/permission-profile-preflight.ts
10
+ import { spawn } from "node:child_process";
11
+ import { createInterface } from "node:readline";
12
+ import { createReadStream } from "node:fs";
13
+ import { isDeepStrictEqual } from "node:util";
14
+
15
+ // package.json
16
+ var version = "0.1.161";
17
+
18
+ // src/deep-scan/errors.ts
19
+ var DeepScanNonRetryableError = class extends Error {
20
+ constructor(message, options) {
21
+ super(message, options);
22
+ this.name = "DeepScanNonRetryableError";
23
+ }
24
+ };
25
+
26
+ // src/deep-scan/executable-path.ts
27
+ import { win32 } from "node:path";
28
+ function executablePathForSpawn(command) {
29
+ if (process.platform !== "win32" || !win32.isAbsolute(command))
30
+ return command;
31
+ const root = win32.parse(command).root;
32
+ return root === "\\" || root === "/" ? command : win32.toNamespacedPath(command);
33
+ }
34
+
35
+ // ../scripts/codex_profile.mjs
36
+ function isPermissionProfileFallbackWarning(message, profileId) {
37
+ if (typeof message !== "string") return false;
38
+ const prefix = `Configured value for \`permission_profile\` is disallowed by requirements; falling back from \`${profileId}\` to required value \``;
39
+ const warning = message.trim();
40
+ return warning.startsWith(prefix) && warning.endsWith("`.");
41
+ }
42
+
43
+ // src/deep-scan/permission-profile-preflight.ts
44
+ var DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID = "codex_security_deep_scan_worker";
45
+ async function readDeepScanRuntimeConfig(options) {
46
+ return withPreflightClient(options, async (client) => {
47
+ const response = await client.request("config/read", {
48
+ cwd: options.cwd,
49
+ includeLayers: false
50
+ });
51
+ const config = asRecord(response.config);
52
+ if (!config) throw malformedPreflightError(options.context);
53
+ return config;
54
+ });
55
+ }
56
+ async function prepareCliDeepScanSession(options) {
57
+ return withPreflightClient(options, async (client) => {
58
+ const response = await client.request("thread/start", {
59
+ cwd: options.cwd,
60
+ threadSource: "security_scan",
61
+ ephemeral: false
62
+ });
63
+ const thread = asRecord(response.thread);
64
+ if (typeof thread?.id !== "string" || typeof thread.path !== "string" || typeof response.model !== "string") {
65
+ throw new Error("Codex did not return the owning Deep Scan session.");
66
+ }
67
+ await client.request("thread/inject_items", {
68
+ threadId: thread.id,
69
+ items: [
70
+ {
71
+ type: "message",
72
+ role: "user",
73
+ content: [{ type: "input_text", text: options.prompt }]
74
+ }
75
+ ]
76
+ });
77
+ let permissionProfile;
78
+ const input = createReadStream(thread.path, { encoding: "utf8" });
79
+ const lines = createInterface({ input, crlfDelay: Infinity });
80
+ try {
81
+ for await (const line of lines) {
82
+ if (!line.trim()) continue;
83
+ const entry = asRecord(JSON.parse(line));
84
+ if (entry?.type === "turn_context") {
85
+ permissionProfile = asRecord(entry.payload)?.permission_profile;
86
+ }
87
+ }
88
+ } finally {
89
+ lines.close();
90
+ input.destroy();
91
+ }
92
+ if (permissionProfile === void 0) {
93
+ throw new Error(
94
+ "Codex did not persist the Deep Scan session's effective permissions."
95
+ );
96
+ }
97
+ return {
98
+ threadId: thread.id,
99
+ model: response.model,
100
+ ...typeof response.reasoningEffort === "string" ? { reasoningEffort: response.reasoningEffort } : {},
101
+ permissionProfile
102
+ };
103
+ });
104
+ }
105
+ async function preflightDeepScanWorkerPermissionProfile(options) {
106
+ return withPreflightClient(options, async (client) => {
107
+ const configResponse = await client.request("config/read", {
108
+ cwd: options.cwd,
109
+ includeLayers: false
110
+ });
111
+ const catalog = await client.readPermissionProfileCatalog(options.cwd);
112
+ const matchingEntries = catalog.filter(
113
+ (entry) => entry.id === DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID
114
+ );
115
+ if (matchingEntries.length !== 1)
116
+ throw malformedPreflightError(options.context);
117
+ const catalogEntry = matchingEntries[0];
118
+ const requirementsResponse = catalogEntry.allowed === true ? void 0 : await client.readConfigRequirementsForClassification();
119
+ verifyPreflightResult(
120
+ options,
121
+ configResponse,
122
+ catalogEntry,
123
+ requirementsResponse
124
+ );
125
+ if (!options.allowOpenAiApiKeyFallback || asRecord(configResponse.config)?.forced_login_method === "chatgpt") {
126
+ return { useOpenAiApiKey: false };
127
+ }
128
+ const account = await client.request("account/read", {
129
+ refreshToken: false
130
+ });
131
+ return {
132
+ useOpenAiApiKey: account.requiresOpenaiAuth === true && account.account === null
133
+ };
134
+ });
135
+ }
136
+ async function withPreflightClient(options, operation) {
137
+ if (options.signal.aborted) throw abortError(options.signal.reason);
138
+ const client = new AppServerPreflightClient(options);
139
+ try {
140
+ await client.initialize();
141
+ return await operation(client);
142
+ } catch (error) {
143
+ await client.close();
144
+ const stderr = client.stderrText;
145
+ if (error instanceof Error && stderr)
146
+ Object.defineProperty(error, "message", {
147
+ value: error.message + "\n" + stderr,
148
+ writable: true,
149
+ configurable: true,
150
+ enumerable: false
151
+ });
152
+ throw error;
153
+ } finally {
154
+ await client.close();
155
+ }
156
+ }
157
+ var AppServerPreflightClient = class {
158
+ constructor(options) {
159
+ this.options = options;
160
+ const args = [...options.commandArgs ?? []];
161
+ for (const override of options.configOverrides) {
162
+ args.push("--config", override);
163
+ }
164
+ for (const override of options.providerConfigOverrides ?? []) {
165
+ args.push("--config", override);
166
+ }
167
+ args.push("app-server", "--stdio");
168
+ this.child = spawn(executablePathForSpawn(options.codexPath), args, {
169
+ cwd: options.cwd,
170
+ ...options.env === void 0 ? {} : { env: options.env },
171
+ stdio: ["pipe", "pipe", "pipe"],
172
+ windowsHide: true
173
+ });
174
+ this.childClose = new Promise((resolve) => {
175
+ this.child.once("close", () => {
176
+ this.childClosed = true;
177
+ resolve();
178
+ });
179
+ });
180
+ this.child.stderr.on("data", (chunk) => this.stderr.push(chunk));
181
+ this.stdoutLines = createInterface({
182
+ input: this.child.stdout,
183
+ crlfDelay: Infinity
184
+ });
185
+ this.stdoutLines.on("line", (line) => this.consumeStdoutLine(line));
186
+ const onStdioError = (error) => {
187
+ const failure = codexExecutableStdioError(
188
+ options.codexPath,
189
+ options.context
190
+ );
191
+ failure.message += "\n" + error.message;
192
+ this.fail(failure);
193
+ };
194
+ this.stdoutLines.on("error", onStdioError);
195
+ this.child.stdin.on("error", onStdioError);
196
+ this.child.on("error", (error) => {
197
+ this.fail(
198
+ codexExecutableStartError(options.codexPath, error, options.context)
199
+ );
200
+ });
201
+ this.child.on("close", (code, signal) => {
202
+ if (!this.closed) {
203
+ this.fail(
204
+ codexExecutableExitError(
205
+ options.codexPath,
206
+ code,
207
+ signal,
208
+ options.context
209
+ )
210
+ );
211
+ }
212
+ });
213
+ const onAbort = () => {
214
+ this.fail(abortError(options.signal.reason));
215
+ this.stopChild();
216
+ };
217
+ options.signal.addEventListener("abort", onAbort, { once: true });
218
+ this.removeAbortListener = () => options.signal.removeEventListener("abort", onAbort);
219
+ }
220
+ options;
221
+ child;
222
+ childClose;
223
+ stdoutLines;
224
+ pending;
225
+ nextId = 1;
226
+ stderr = [];
227
+ terminalError;
228
+ closed = false;
229
+ childClosed = false;
230
+ removeAbortListener;
231
+ get stderrText() {
232
+ return Buffer.concat(this.stderr).toString("utf8");
233
+ }
234
+ async initialize() {
235
+ await this.request("initialize", {
236
+ clientInfo: {
237
+ name: "codex_security_deep_scan",
238
+ title: "Codex Security Local Deep Scan",
239
+ version
240
+ },
241
+ capabilities: { experimentalApi: true }
242
+ });
243
+ if (this.terminalError) throw this.terminalError;
244
+ this.write({ jsonrpc: "2.0", method: "initialized", params: {} });
245
+ }
246
+ async readPermissionProfileCatalog(cwd) {
247
+ const entries = [];
248
+ const seenCursors = /* @__PURE__ */ new Set();
249
+ let cursor;
250
+ while (true) {
251
+ const result = await this.request("permissionProfile/list", {
252
+ cwd,
253
+ ...cursor === void 0 ? {} : { cursor }
254
+ });
255
+ const data = result.data;
256
+ if (!Array.isArray(data))
257
+ throw malformedPreflightError(this.options.context);
258
+ for (const value of data) {
259
+ const entry = asRecord(value);
260
+ if (!entry || typeof entry.id !== "string") {
261
+ throw malformedPreflightError(this.options.context);
262
+ }
263
+ if (typeof entry.allowed !== "boolean")
264
+ throw malformedPreflightError(this.options.context);
265
+ entries.push(entry);
266
+ }
267
+ const nextCursor = result.nextCursor;
268
+ if (nextCursor === null) return entries;
269
+ if (typeof nextCursor !== "string" || nextCursor.length === 0 || seenCursors.has(nextCursor)) {
270
+ throw malformedPreflightError(this.options.context);
271
+ }
272
+ seenCursors.add(nextCursor);
273
+ cursor = nextCursor;
274
+ }
275
+ }
276
+ /**
277
+ * Classification is best effort after the catalog already rejected the
278
+ * profile. An older runtime may not expose this API; that is still a safe
279
+ * generic managed-policy rejection, not a reason to guess at remediation.
280
+ */
281
+ async readConfigRequirementsForClassification() {
282
+ try {
283
+ return await this.request("configRequirements/read");
284
+ } catch (error) {
285
+ if (this.options.signal.aborted || isAbortError(error)) throw error;
286
+ return void 0;
287
+ }
288
+ }
289
+ request(method, params) {
290
+ if (this.terminalError) return Promise.reject(this.terminalError);
291
+ const id = this.nextId++;
292
+ return new Promise((resolve, reject) => {
293
+ this.pending = { id, method, resolve, reject };
294
+ this.write({
295
+ jsonrpc: "2.0",
296
+ id,
297
+ method,
298
+ ...params === void 0 ? {} : { params }
299
+ });
300
+ });
301
+ }
302
+ async close() {
303
+ this.closed = true;
304
+ this.removeAbortListener();
305
+ this.stopChild();
306
+ if (this.childClosed) return;
307
+ const forcedTermination = setTimeout(() => {
308
+ if (this.child.exitCode === null && this.child.signalCode === null) {
309
+ this.child.kill("SIGKILL");
310
+ }
311
+ this.child.stdin.destroy();
312
+ this.child.stdout.destroy();
313
+ this.child.stderr.destroy();
314
+ }, 1e3);
315
+ try {
316
+ await this.childClose;
317
+ } finally {
318
+ clearTimeout(forcedTermination);
319
+ }
320
+ }
321
+ write(message) {
322
+ if (!this.child.stdin.writable) {
323
+ this.fail(
324
+ codexExecutableStdioError(this.options.codexPath, this.options.context)
325
+ );
326
+ return;
327
+ }
328
+ this.child.stdin.write(`${JSON.stringify(message)}
329
+ `, (error) => {
330
+ if (error) {
331
+ const failure = codexExecutableStdioError(
332
+ this.options.codexPath,
333
+ this.options.context
334
+ );
335
+ failure.message += "\n" + error.message;
336
+ this.fail(failure);
337
+ }
338
+ });
339
+ }
340
+ consumeStdoutLine(line) {
341
+ if (this.terminalError || line.trim().length === 0) return;
342
+ let value;
343
+ try {
344
+ value = JSON.parse(line);
345
+ } catch {
346
+ this.fail(malformedPreflightError(this.options.context));
347
+ return;
348
+ }
349
+ const message = asRecord(value);
350
+ if (!message) {
351
+ this.fail(malformedPreflightError(this.options.context));
352
+ return;
353
+ }
354
+ const id = message.id;
355
+ if (typeof id !== "number") {
356
+ return;
357
+ }
358
+ const pending = this.pending;
359
+ if (!pending || pending.id !== id) {
360
+ this.fail(malformedPreflightError(this.options.context));
361
+ return;
362
+ }
363
+ this.pending = void 0;
364
+ if (message.error !== void 0) {
365
+ pending.reject(
366
+ jsonRpcPreflightError(
367
+ this.options.codexPath,
368
+ pending.method,
369
+ message.error,
370
+ this.options.context
371
+ )
372
+ );
373
+ return;
374
+ }
375
+ const result = asRecord(message.result);
376
+ if (!result) {
377
+ pending.reject(malformedPreflightError(this.options.context));
378
+ return;
379
+ }
380
+ pending.resolve(result);
381
+ }
382
+ fail(error) {
383
+ if (this.terminalError) return;
384
+ this.terminalError = error;
385
+ this.pending?.reject(error);
386
+ this.pending = void 0;
387
+ }
388
+ stopChild() {
389
+ this.stdoutLines.close();
390
+ if (!this.child.stdin.destroyed) this.child.stdin.end();
391
+ if (this.child.exitCode === null && this.child.signalCode === null) {
392
+ this.child.kill("SIGTERM");
393
+ }
394
+ }
395
+ };
396
+ function verifyPreflightResult(options, configResponse, catalogEntry, requirementsResponse) {
397
+ if (catalogEntry.allowed !== true) {
398
+ throw existingAllowlistExcludesProfile(requirementsResponse) ? disallowedProfileAllowlistError(options.context) : managedPolicyRejectedError(options.context);
399
+ }
400
+ const config = asRecord(configResponse.config);
401
+ const permissions = asRecord(config?.permissions);
402
+ const actualProfile = permissions ? asRecord(permissions[DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID]) : void 0;
403
+ if (!config || !permissions || !actualProfile || typeof config.default_permissions !== "string")
404
+ throw malformedPreflightError(options.context);
405
+ if (config.default_permissions !== DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID) {
406
+ throw profileNotSelectedError(options.context);
407
+ }
408
+ const expectedProfile = comparableProfile(options.expectedProfile);
409
+ const actualWithoutDescription = comparableProfile(actualProfile);
410
+ if (!isDeepStrictEqual(actualWithoutDescription, expectedProfile)) {
411
+ throw profileCollisionError(options.context);
412
+ }
413
+ }
414
+ function existingAllowlistExcludesProfile(response) {
415
+ if (!response || !Object.hasOwn(response, "requirements")) return false;
416
+ if (response.requirements === null) return false;
417
+ const requirements = asRecord(response.requirements);
418
+ if (!requirements || !Object.hasOwn(requirements, "allowedPermissionProfiles"))
419
+ return false;
420
+ if (requirements.allowedPermissionProfiles === null) return false;
421
+ const allowlist = asRecord(requirements.allowedPermissionProfiles);
422
+ if (!allowlist) return false;
423
+ if (Object.values(allowlist).some((value) => typeof value !== "boolean"))
424
+ return false;
425
+ return allowlist[DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID] !== true;
426
+ }
427
+ function comparableProfile(value) {
428
+ const { description: _description, ...rest } = stripNullObjectFields(
429
+ value
430
+ );
431
+ return rest;
432
+ }
433
+ function stripNullObjectFields(value) {
434
+ if (Array.isArray(value))
435
+ return value.map((entry) => stripNullObjectFields(entry));
436
+ const object = asRecord(value);
437
+ if (!object) return value;
438
+ return Object.fromEntries(
439
+ Object.entries(object).filter(([, entry]) => entry !== null).map(([key, entry]) => [key, stripNullObjectFields(entry)])
440
+ );
441
+ }
442
+ function disallowedProfileAllowlistError(context) {
443
+ return new DeepScanNonRetryableError(
444
+ `${subject(context)} cannot safely start a read-only worker because organization policy does not allow the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to define this read-only stub in a normal config layer:
445
+
446
+ [permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]
447
+ extends = ":read-only"
448
+
449
+ and add this entry to your existing allowlist in requirements.toml:
450
+
451
+ [allowed_permission_profiles]
452
+ ${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID} = true
453
+
454
+ ${subject(context)} did not run.`
455
+ );
456
+ }
457
+ function managedPolicyRejectedError(context) {
458
+ return new DeepScanNonRetryableError(
459
+ `${subject(context)} cannot safely start a read-only worker because managed Codex policy rejected the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to review the managed permission, sandbox, and filesystem requirements. ${subject(context)} did not run.`
460
+ );
461
+ }
462
+ function profileNotSelectedError(context) {
463
+ return new DeepScanNonRetryableError(
464
+ `${subject(context)} cannot safely start a read-only worker because Codex did not select the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to allow that profile for ${subject(context)}. ${subject(context)} did not run.`
465
+ );
466
+ }
467
+ function profileCollisionError(context) {
468
+ return new DeepScanNonRetryableError(
469
+ `${subject(context)} cannot safely start a read-only worker because existing Codex configuration changes the reserved \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to keep the normal-config \`[permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]\` stub limited to \`extends = ":read-only"\`; ${subject(context)} supplies its deny rules at runtime. ${subject(context)} did not run.`
470
+ );
471
+ }
472
+ function malformedPreflightError(context) {
473
+ return new Error(
474
+ `${subject(context)} cannot safely verify its read-only worker permission profile with this Codex configuration. ${subject(context)} did not run.`
475
+ );
476
+ }
477
+ function unsupportedCodexApiError(codexPath, api, context) {
478
+ return new DeepScanNonRetryableError(
479
+ subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " does not support the required " + JSON.stringify(api) + " API. Update the Codex installation at that path (the desktop app if it is bundled, otherwise the selected CLI) and retry. " + subject(context) + " did not run."
480
+ );
481
+ }
482
+ function jsonRpcPreflightError(codexPath, method, value, context) {
483
+ const error = asRecord(value);
484
+ const code = typeof error?.code === "number" && Number.isFinite(error.code) ? error.code : void 0;
485
+ if (code === -32601) {
486
+ const failure = unsupportedCodexApiError(codexPath, method, context);
487
+ if (typeof error?.message === "string")
488
+ failure.message += "\n" + error.message;
489
+ return failure;
490
+ }
491
+ return new Error(
492
+ subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " returned an error for " + JSON.stringify(method) + (code === void 0 ? "" : " (JSON-RPC code " + code + ")") + ". Check the Codex configuration and retry. " + subject(context) + " did not run." + (typeof error?.message === "string" ? "\n" + error.message : "")
493
+ );
494
+ }
495
+ function codexExecutableStartError(codexPath, error, context) {
496
+ const value = "code" in error ? error.code : void 0;
497
+ const code = typeof value === "string" && /^[A-Z0-9_]+$/u.test(value) ? value : void 0;
498
+ const codeDetail = code === void 0 ? "" : " (" + code + ")";
499
+ return new Error(
500
+ codexExecutableFailureMessage(
501
+ codexPath,
502
+ "could not start" + codeDetail,
503
+ context
504
+ ) + "\n" + error.message,
505
+ { cause: error }
506
+ );
507
+ }
508
+ function codexExecutableExitError(codexPath, code, signal, context) {
509
+ const detail = code !== null ? "exited before permission-profile verification completed with code " + code : signal !== null ? "was terminated before permission-profile verification completed by signal " + signal : "exited before permission-profile verification completed";
510
+ return new Error(codexExecutableFailureMessage(codexPath, detail, context));
511
+ }
512
+ function codexExecutableStdioError(codexPath, context) {
513
+ return new Error(
514
+ codexExecutableFailureMessage(
515
+ codexPath,
516
+ "could not exchange app-server JSON-RPC over stdio",
517
+ context
518
+ )
519
+ );
520
+ }
521
+ function codexExecutableFailureMessage(codexPath, detail, context) {
522
+ return subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " " + detail + ". Check that the named executable runs with --version, and check CODEX_CLI_PATH/PATH, then retry. " + subject(context) + " did not run.";
523
+ }
524
+ function deepScanPermissionProfileFallbackError(message) {
525
+ if (typeof message !== "string") return void 0;
526
+ if (!isPermissionProfileFallbackWarning(
527
+ message,
528
+ DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID
529
+ ))
530
+ return void 0;
531
+ return new DeepScanNonRetryableError(
532
+ `Deep Scan stopped a worker because organization policy rejected the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile after the turn started. The worker was stopped and its results were discarded. Ask your Codex administrator to define this read-only stub in a normal config layer:
533
+
534
+ [permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]
535
+ extends = ":read-only"
536
+
537
+ and add this entry to your existing allowlist in requirements.toml:
538
+
539
+ [allowed_permission_profiles]
540
+ ${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID} = true
541
+ ${message}`
542
+ );
543
+ }
544
+ function subject(context) {
545
+ return context === "helper" ? "Read-only Codex helper" : "Deep Scan";
546
+ }
547
+ function isAbortError(error) {
548
+ return error instanceof Error && error.name === "AbortError";
549
+ }
550
+ function abortError(reason) {
551
+ if (reason instanceof Error) return reason;
552
+ return new DOMException(
553
+ "Deep Scan worker permission profile preflight aborted.",
554
+ "AbortError"
555
+ );
556
+ }
557
+ export {
558
+ DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID,
559
+ deepScanPermissionProfileFallbackError,
560
+ preflightDeepScanWorkerPermissionProfile,
561
+ prepareCliDeepScanSession,
562
+ readDeepScanRuntimeConfig
563
+ };
@@ -22,3 +22,4 @@ const runtimeModule = new Module(loaderPath);
22
22
  runtimeModule.filename = loaderPath;
23
23
  runtimeModule.paths = Module._nodeModulePaths(dirname(loaderPath));
24
24
  runtimeModule._compile(runtimeSource, loaderPath);
25
+ export default runtimeModule.exports;
@@ -14,19 +14,6 @@ op = ">="
14
14
  value = 6
15
15
  v1_default = 6
16
16
 
17
- [capabilities.usable_worker_slots_8]
18
- kind = "multi_agent_capacity"
19
- op = ">="
20
- value = 8
21
- v1_default = 6
22
-
23
- [capabilities.agent_depth_2]
24
- kind = "config"
25
- path = "agents.max_depth"
26
- op = ">="
27
- value = 2
28
- default = 1
29
-
30
17
  [capabilities.goals_enabled]
31
18
  kind = "config"
32
19
  path = "features.goals"
@@ -10,7 +10,7 @@ Keep structured outputs on their existing tools: inventories, candidate discover
10
10
 
11
11
  ## Supplemental files
12
12
 
13
- Use the existing plugin MCP's `save_codex_security_artifact` and `read_codex_security_artifact` for Markdown, optional finding write-ups, hardening documents/diagrams, validation evidence and retained helper output. Do not write these retained files with shell redirection, `apply_patch`, Python or other ordinary file-writing tools.
13
+ Use the existing plugin MCP's `save_codex_security_artifact` and `read_codex_security_artifact` for standalone Markdown, optional finding write-ups, hardening documents/diagrams, validation evidence and retained helper output. The host derives a scan's root-level `threatmodel.md` from its canonical `threatModel`; submit that model through the existing semantic draft tool instead of authoring a second document. Do not write retained supplemental files with shell redirection, `apply_patch`, Python or other ordinary file-writing tools.
14
14
 
15
15
  Identify the owner with exactly one of:
16
16
 
@@ -19,7 +19,7 @@ Identify the owner with exactly one of:
19
19
 
20
20
  Select `storage` explicitly:
21
21
 
22
- - `persistent`: retained documents/evidence under the authoritative scan directory or standalone collection. The default root is `$CODEX_SECURITY_STATE_DIR/scans`, or `$CODEX_HOME/state/plugins/codex-security/scans` when no state override is set; `CODEX_HOME` defaults to `~/.codex`. The existing `CODEX_SECURITY_SCAN_ROOT` override still takes precedence for plugin-created output. If the default workbench state is unwritable, retained artifacts follow its temporary fallback state's `scans` directory and can be removed by OS temporary-directory cleanup. Preserve an existing scan's saved path, including older temporary paths.
22
+ - `persistent`: retained documents/evidence under the authoritative scan directory or standalone collection. The default root is `$CODEX_SECURITY_STATE_DIR/scans`, or `$CODEX_HOME/state/plugins/codex-security/scans` when no state override is set; `CODEX_HOME` defaults to `~/.codex`. The existing `CODEX_SECURITY_SCAN_ROOT` override still takes precedence for plugin-created output. The workbench state directory must be writable; set `CODEX_SECURITY_STATE_DIR` explicitly on hosts with an unwritable default. Preserve an existing scan's saved path, including older temporary paths.
23
23
  - `temporary`: disposable staging and execution output in a context-specific OS temporary directory. Standalone temporary saves and reads do not create or require the persistent collection. It is not part of the completed result and must not be referenced from canonical findings or coverage. It can disappear independently of retained files.
24
24
 
25
25
  Relative storage overrides resolve from the plugin directory, matching the workbench, regardless of the MCP launch directory.
@@ -29,12 +29,12 @@ Omit `path`, `content` and `sourcePath` to prepare the selected directory. Use t
29
29
  Example for a running scan:
30
30
 
31
31
  ```text
32
- save_codex_security_artifact({ scanId, handoffClaimToken?, storage: "persistent", path: "artifacts/01_context/threat_model.md", content: "<exact Markdown>" })
32
+ read_codex_security_artifact({ scanId, handoffClaimToken?, storage: "persistent", path: "threatmodel.md" })
33
33
  save_codex_security_artifact({ scanId, handoffClaimToken?, storage: "temporary" })
34
34
  save_codex_security_artifact({ scanId, handoffClaimToken?, storage: "persistent", path: "artifacts/02_discovery/validation_artifacts/<candidate_id>/poc.bin", sourcePath: "<returned temporary directory>/poc.bin" })
35
35
  ```
36
36
 
37
- `path` is a portable relative filename under `artifacts/`, `findings/` or `hardening/`; `report_validation.md` is also supported. Standalone collections additionally support `threat_model.md`. Use the existing relative artifact layouts for each phase. The tool returns the physical `path`, canonical `relativePath` and content digest. Use the persistent relative path in scan evidence references. Read with the same identity, `storage` and relative `path`; request `encoding: "base64"` only for binary content.
37
+ `path` is a portable relative filename under `artifacts/`, `findings/` or `hardening/`; `report_validation.md` is also supported. Standalone collections additionally support saving `threatmodel.md`; the former `threat_model.md` remains readable. Running scans can read the host-generated `threatmodel.md`, but cannot replace it through the supplemental save tool. Use the existing relative artifact layouts for each phase. The tool returns the physical `path`, canonical `relativePath` and content digest. Use persistent evidence paths in scan evidence references; the derived threat-model document is not a coverage receipt. Read with the same identity, `storage` and relative `path`; request `encoding: "base64"` only for binary content.
38
38
 
39
39
  Source/configuration edits and external-publication request bodies are separate from scan artifacts and retain their existing tools and authorization. Explicit user instructions still take precedence. If a required output destination cannot be represented by managed storage, explain that limitation instead of silently substituting a different destination or claiming it was written.
40
40
 
@@ -46,7 +46,7 @@ For standalone/legacy mutable ledgers, use the save tool to replace their comple
46
46
 
47
47
  ## Threat-model cache and completed results
48
48
 
49
- For the shared repository threat model, use `targetPath: <repo_root>`, `storage: "persistent"`, `path: "threat_model.md"`. Read that collection's cached file only when the threat-model workflow allows cache reuse and its exact repository/version footer matches. Save the exact selected text into `artifacts/01_context/threat_model.md` with the running scan's `scanId`. Preserve the workflow's conditions that forbid reading or replacing the shared cache; the storage tool does not authorize a cache update.
49
+ For a standalone repository threat model, use `targetPath: <repo_root>`, `storage: "persistent"`, `path: "threatmodel.md"`. Read a shared cached file only when the threat-model workflow allows cache reuse and its exact repository/version footer matches; if the new filename is absent, the legacy `threat_model.md` may be read under the same rules. For a running scan, retain the selected text as `{ "format": "markdown", "content": "<exact Markdown>" }` in its canonical `threatModel`, using an early `complete: false` semantic checkpoint with the reviewed surfaces and pending work. The host writes `<scan_dir>/threatmodel.md` from that content. Preserve the workflow's conditions that forbid reading or replacing the shared cache; saving or exporting a scan's model does not authorize a cache update.
50
50
 
51
51
  End each shared threat model with these two lines:
52
52
 
@@ -62,10 +62,6 @@ When the profile includes remediation patches, present the concrete config delta
62
62
 
63
63
  Some remediation patches have `kind = "host_setting"`. Present those as host-level setup guidance, not as edits to persistent Codex config.
64
64
 
65
- Deep Security Scan uses MCP-owned SDK sessions rather than the parent thread's worker pool. Its preflight does not require a particular parent delegation runtime, ownership, capacity, or depth. Discovery workers inherit the scan's model and use the reserved `codex_security_deep_scan_worker` permission profile with the parent's supported filesystem denials. The selected Codex executable must support permission-profile configuration and allowance checks. If that command fails to start or exits early, report its path and the tool's diagnostic; do not infer that its version is unsupported. If the tool identifies a missing API, ask the user to update the Codex installation at the reported path: the desktop app for an app-bundled executable, or the selected CLI otherwise. If Codex policy rejects the profile, report the tool's administrator guidance. Do not remove deny rules or select a broader sandbox to work around the error.
66
-
67
- Deep Scan workers use the selected Codex home's credentials and provider configuration. An existing `CODEX_API_KEY` remains selected. When the worker has no Codex account and its provider requires OpenAI authentication, it can use `OPENAI_API_KEY` through the SDK's API-key option. This does not replace a stored account, custom-provider authentication, or a forced ChatGPT login. The key must be present in the process that launched the plugin; setting it later in a separate shell does not update a running plugin.
68
-
69
65
  Do not warn merely because a user's value differs from the profile's suggested patch. Warn or block only when the evaluated capability requirement is unmet.
70
66
 
71
67
  If a blocking runtime capability is `unknown`, establish it from the current tool surface and rerun the helper with an explicit `--runtime-check`. An unknown `warn` or `suggest` capability does not block a `ready` scan; continue on the documented degraded path without claiming that capability is available.
@@ -90,7 +86,7 @@ Codex CLI and other hosts use the same prompt-based preflight before substantive
90
86
 
91
87
  ## Daybreak Access Advisory
92
88
 
93
- After capability preflight is `ready` and immediately before the workflow's first substantive scan action, call the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. ChatGPT-authenticated desktop and CLI sessions support this advisory; skip it silently in known API-key-only sessions, which cannot verify account access. For Deep Security Scan, make the call immediately before `start_codex_security_deep_scan`. Reuse an existing result when continuing the same scan.
89
+ After capability preflight is `ready` and immediately before the workflow's first substantive scan action, call the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. This advisory checks the connected ChatGPT account or workspace; it does not check Amazon Bedrock model access or access to local CLI scan results. ChatGPT-authenticated desktop and CLI sessions support it. Skip it silently for Amazon Bedrock scans and known API-key-only sessions; neither requires an OpenAI account advisory. Use the selected runtime provider to identify Bedrock, not merely the presence of AWS environment variables. For Deep Security Scan, make the call immediately before `start_codex_security_deep_scan`. Reuse an existing result when continuing the same scan.
94
90
 
95
91
  If the call fails, returns `status: "unknown"`, or returns `stale: true`, continue silently. Do not expose the unavailable check, unknown status, empty program list, or a speculative protected-output warning in progress messages or the final response. For a fresh `granted` result, report the exact status and available Daybreak programs. For a fresh `not_granted` result, before any other scan-start progress, present a separate, prominent warning that Daybreak access is not granted for this account and protected scan outputs may not be displayable. Include the returned `enrollmentUrl` as a clickable application link, falling back to `https://chatgpt.com/cyber` when absent.
96
92