@openai/codex-security 0.5.0 → 0.6.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 (299) hide show
  1. package/README.md +93 -2
  2. package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
  3. package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
  4. package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
  5. package/_bundled_plugin/mcp/permission-profile-preflight.mjs +60 -9
  6. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  7. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  8. package/_bundled_plugin/schemas/definitions/artifact-common.schema.json +1 -1
  9. package/_bundled_plugin/scripts/finalize_scan_contract.py +12 -1
  10. package/_bundled_plugin/scripts/generate_in_scope_files.py +6 -6
  11. package/_bundled_plugin/scripts/generate_rank_input.py +12 -6
  12. package/_bundled_plugin/scripts/report_projection.py +2 -1
  13. package/_bundled_plugin/scripts/threat_model_projection.py +1 -3
  14. package/_bundled_plugin/scripts/workbench/saved_coverage.py +234 -0
  15. package/_bundled_plugin/scripts/workbench_cli.py +5 -7
  16. package/_bundled_plugin/scripts/workbench_db.py +12 -6
  17. package/_bundled_plugin/scripts/workbench_finding_workflows.py +2 -0
  18. package/_bundled_plugin/scripts/workbench_native_indexes.py +10 -7
  19. package/_bundled_plugin/scripts/workbench_publication.py +4 -3
  20. package/_bundled_plugin/scripts/workbench_remediation.py +5 -1
  21. package/_bundled_plugin/scripts/workbench_saved_results.py +542 -148
  22. package/_bundled_plugin/scripts/workbench_scan_history.py +79 -78
  23. package/_bundled_plugin/scripts/workbench_scan_usage.py +61 -13
  24. package/_bundled_plugin/scripts/workbench_target.py +21 -7
  25. package/_bundled_plugin/scripts/workbench_validation.py +21 -18
  26. package/_bundled_plugin/shared/workbench-migrations.json +26 -0
  27. package/_bundled_plugin/skills/fix-finding/SKILL.md +16 -8
  28. package/_bundled_plugin/skills/publish-findings/SKILL.md +130 -0
  29. package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +6 -0
  30. package/_bundled_plugin/skills/verify-fix/SKILL.md +4 -2
  31. package/dist/api.d.ts +4 -1
  32. package/dist/api.d.ts.map +1 -1
  33. package/dist/api.js +233 -91
  34. package/dist/api.js.map +1 -1
  35. package/dist/classify-scan-severity.d.ts.map +1 -1
  36. package/dist/classify-scan-severity.js +16 -18
  37. package/dist/classify-scan-severity.js.map +1 -1
  38. package/dist/classify-severity-records.d.ts +5 -2
  39. package/dist/classify-severity-records.d.ts.map +1 -1
  40. package/dist/classify-severity-records.js +40 -34
  41. package/dist/classify-severity-records.js.map +1 -1
  42. package/dist/classify-severity.d.ts +5 -1
  43. package/dist/classify-severity.d.ts.map +1 -1
  44. package/dist/classify-severity.js +20 -30
  45. package/dist/classify-severity.js.map +1 -1
  46. package/dist/cli-daybreak.d.ts +5 -0
  47. package/dist/cli-daybreak.d.ts.map +1 -0
  48. package/dist/cli-daybreak.js +89 -0
  49. package/dist/cli-daybreak.js.map +1 -0
  50. package/dist/cli-help.d.ts.map +1 -1
  51. package/dist/cli-help.js +1 -0
  52. package/dist/cli-help.js.map +1 -1
  53. package/dist/cli.d.ts +12 -1
  54. package/dist/cli.d.ts.map +1 -1
  55. package/dist/cli.js +1224 -596
  56. package/dist/cli.js.map +1 -1
  57. package/dist/cloud-endpoint.d.ts +6 -0
  58. package/dist/cloud-endpoint.d.ts.map +1 -0
  59. package/dist/cloud-endpoint.js +51 -0
  60. package/dist/cloud-endpoint.js.map +1 -0
  61. package/dist/cloud-publish.d.ts.map +1 -1
  62. package/dist/cloud-publish.js +7 -5
  63. package/dist/cloud-publish.js.map +1 -1
  64. package/dist/codeowners.js +2 -2
  65. package/dist/codeowners.js.map +1 -1
  66. package/dist/component-plan.d.ts.map +1 -1
  67. package/dist/component-plan.js +3 -2
  68. package/dist/component-plan.js.map +1 -1
  69. package/dist/component-scan.js +2 -2
  70. package/dist/component-scan.js.map +1 -1
  71. package/dist/config.d.ts.map +1 -1
  72. package/dist/config.js +5 -1
  73. package/dist/config.js.map +1 -1
  74. package/dist/cost.d.ts +2 -1
  75. package/dist/cost.d.ts.map +1 -1
  76. package/dist/cost.js +17 -8
  77. package/dist/cost.js.map +1 -1
  78. package/dist/custom-validation.d.ts.map +1 -1
  79. package/dist/custom-validation.js +2 -5
  80. package/dist/custom-validation.js.map +1 -1
  81. package/dist/deduplication/codex-review.d.ts.map +1 -1
  82. package/dist/deduplication/codex-review.js +8 -6
  83. package/dist/deduplication/codex-review.js.map +1 -1
  84. package/dist/deduplication/local.d.ts.map +1 -1
  85. package/dist/deduplication/local.js +5 -2
  86. package/dist/deduplication/local.js.map +1 -1
  87. package/dist/deduplication/retry.d.ts.map +1 -1
  88. package/dist/deduplication/retry.js +5 -0
  89. package/dist/deduplication/retry.js.map +1 -1
  90. package/dist/deduplication/scan.js +5 -1
  91. package/dist/deduplication/scan.js.map +1 -1
  92. package/dist/deep-scan.d.ts +6 -0
  93. package/dist/deep-scan.d.ts.map +1 -1
  94. package/dist/deep-scan.js +8 -6
  95. package/dist/deep-scan.js.map +1 -1
  96. package/dist/default-severity-rubric.d.ts +3 -0
  97. package/dist/default-severity-rubric.d.ts.map +1 -0
  98. package/dist/default-severity-rubric.js +67 -0
  99. package/dist/default-severity-rubric.js.map +1 -0
  100. package/dist/endor-findings.d.ts +7 -0
  101. package/dist/endor-findings.d.ts.map +1 -0
  102. package/dist/endor-findings.js +233 -0
  103. package/dist/endor-findings.js.map +1 -0
  104. package/dist/external-findings-import.d.ts +5 -0
  105. package/dist/external-findings-import.d.ts.map +1 -0
  106. package/dist/external-findings-import.js +38 -0
  107. package/dist/external-findings-import.js.map +1 -0
  108. package/dist/external-findings-local.d.ts +63 -0
  109. package/dist/external-findings-local.d.ts.map +1 -0
  110. package/dist/external-findings-local.js +337 -0
  111. package/dist/external-findings-local.js.map +1 -0
  112. package/dist/external-findings-publish.d.ts +73 -0
  113. package/dist/external-findings-publish.d.ts.map +1 -0
  114. package/dist/external-findings-publish.js +713 -0
  115. package/dist/external-findings-publish.js.map +1 -0
  116. package/dist/external-findings-read.d.ts +6 -0
  117. package/dist/external-findings-read.d.ts.map +1 -0
  118. package/dist/external-findings-read.js +88 -0
  119. package/dist/external-findings-read.js.map +1 -0
  120. package/dist/external-findings.d.ts +21 -0
  121. package/dist/external-findings.d.ts.map +1 -0
  122. package/dist/external-findings.js +2 -0
  123. package/dist/external-findings.js.map +1 -0
  124. package/dist/external-import-contract.d.ts +13 -0
  125. package/dist/external-import-contract.d.ts.map +1 -0
  126. package/dist/external-import-contract.js +254 -0
  127. package/dist/external-import-contract.js.map +1 -0
  128. package/dist/external-import-models.d.ts +362 -0
  129. package/dist/external-import-models.d.ts.map +1 -0
  130. package/dist/external-import-models.js +3 -0
  131. package/dist/external-import-models.js.map +1 -0
  132. package/dist/finding-workflow.d.ts +1 -1
  133. package/dist/finding-workflow.d.ts.map +1 -1
  134. package/dist/finding-workflow.js +2 -1
  135. package/dist/finding-workflow.js.map +1 -1
  136. package/dist/findings-import.d.ts.map +1 -1
  137. package/dist/findings-import.js +23 -3
  138. package/dist/findings-import.js.map +1 -1
  139. package/dist/github-advisories.d.ts +386 -0
  140. package/dist/github-advisories.d.ts.map +1 -0
  141. package/dist/github-advisories.js +131 -0
  142. package/dist/github-advisories.js.map +1 -0
  143. package/dist/github-findings.d.ts +10 -0
  144. package/dist/github-findings.d.ts.map +1 -0
  145. package/dist/github-findings.js +256 -0
  146. package/dist/github-findings.js.map +1 -0
  147. package/dist/host-protocol.d.ts +1 -0
  148. package/dist/host-protocol.d.ts.map +1 -1
  149. package/dist/host-protocol.js +1 -1
  150. package/dist/host-protocol.js.map +1 -1
  151. package/dist/hosted-remediation-protocol.d.ts +6 -0
  152. package/dist/hosted-remediation-protocol.d.ts.map +1 -0
  153. package/dist/hosted-remediation-protocol.js +32 -0
  154. package/dist/hosted-remediation-protocol.js.map +1 -0
  155. package/dist/hosted-remediation.d.ts +93 -0
  156. package/dist/hosted-remediation.d.ts.map +1 -0
  157. package/dist/hosted-remediation.js +124 -0
  158. package/dist/hosted-remediation.js.map +1 -0
  159. package/dist/hosted-scan.d.ts +16 -0
  160. package/dist/hosted-scan.d.ts.map +1 -1
  161. package/dist/hosted-scan.js +14 -2
  162. package/dist/hosted-scan.js.map +1 -1
  163. package/dist/import-scan.d.ts +1 -0
  164. package/dist/import-scan.d.ts.map +1 -1
  165. package/dist/import-scan.js +5 -1
  166. package/dist/import-scan.js.map +1 -1
  167. package/dist/index.d.ts +18 -1
  168. package/dist/index.d.ts.map +1 -1
  169. package/dist/index.js +10 -0
  170. package/dist/index.js.map +1 -1
  171. package/dist/multiscan.d.ts.map +1 -1
  172. package/dist/multiscan.js +3 -1
  173. package/dist/multiscan.js.map +1 -1
  174. package/dist/project-config-schema.d.ts +2 -0
  175. package/dist/project-config-schema.d.ts.map +1 -1
  176. package/dist/project-config-schema.js +1 -0
  177. package/dist/project-config-schema.js.map +1 -1
  178. package/dist/project-config.d.ts +1 -0
  179. package/dist/project-config.d.ts.map +1 -1
  180. package/dist/project-config.js +15 -9
  181. package/dist/project-config.js.map +1 -1
  182. package/dist/publish.d.ts +2 -0
  183. package/dist/publish.d.ts.map +1 -1
  184. package/dist/publish.js +9 -0
  185. package/dist/publish.js.map +1 -1
  186. package/dist/remediation.d.ts +69 -0
  187. package/dist/remediation.d.ts.map +1 -0
  188. package/dist/remediation.js +121 -0
  189. package/dist/remediation.js.map +1 -0
  190. package/dist/request-metadata.d.ts +17 -7
  191. package/dist/request-metadata.d.ts.map +1 -1
  192. package/dist/request-metadata.js +43 -8
  193. package/dist/request-metadata.js.map +1 -1
  194. package/dist/result.d.ts +4 -0
  195. package/dist/result.d.ts.map +1 -1
  196. package/dist/result.js +10 -0
  197. package/dist/result.js.map +1 -1
  198. package/dist/runtime.d.ts +1 -0
  199. package/dist/runtime.d.ts.map +1 -1
  200. package/dist/runtime.js +24 -15
  201. package/dist/runtime.js.map +1 -1
  202. package/dist/saved-scan-bootstrap.d.ts +1 -0
  203. package/dist/saved-scan-bootstrap.d.ts.map +1 -1
  204. package/dist/saved-scan-bootstrap.js +16 -4
  205. package/dist/saved-scan-bootstrap.js.map +1 -1
  206. package/dist/scan-activity.js +8 -8
  207. package/dist/scan-activity.js.map +1 -1
  208. package/dist/scan-comparison.d.ts.map +1 -1
  209. package/dist/scan-comparison.js +15 -9
  210. package/dist/scan-comparison.js.map +1 -1
  211. package/dist/scan-dashboard.d.ts.map +1 -1
  212. package/dist/scan-dashboard.js +12 -6
  213. package/dist/scan-dashboard.js.map +1 -1
  214. package/dist/scan-executor.d.ts +5 -1
  215. package/dist/scan-executor.d.ts.map +1 -1
  216. package/dist/scan-executor.js +9 -8
  217. package/dist/scan-executor.js.map +1 -1
  218. package/dist/scan-owner-suggestions.d.ts +8 -0
  219. package/dist/scan-owner-suggestions.d.ts.map +1 -0
  220. package/dist/scan-owner-suggestions.js +33 -0
  221. package/dist/scan-owner-suggestions.js.map +1 -0
  222. package/dist/{deep-progress.d.ts → scan-progress.d.ts} +15 -7
  223. package/dist/scan-progress.d.ts.map +1 -0
  224. package/dist/scan-progress.js +138 -0
  225. package/dist/scan-progress.js.map +1 -0
  226. package/dist/scan-settings.d.ts +1 -0
  227. package/dist/scan-settings.d.ts.map +1 -1
  228. package/dist/scan-settings.js +4 -0
  229. package/dist/scan-settings.js.map +1 -1
  230. package/dist/scanner-import.d.ts +20 -0
  231. package/dist/scanner-import.d.ts.map +1 -0
  232. package/dist/scanner-import.js +204 -0
  233. package/dist/scanner-import.js.map +1 -0
  234. package/dist/security-policy-diff.d.ts +2 -0
  235. package/dist/security-policy-diff.d.ts.map +1 -0
  236. package/dist/security-policy-diff.js +197 -0
  237. package/dist/security-policy-diff.js.map +1 -0
  238. package/dist/security-policy.d.ts +7 -3
  239. package/dist/security-policy.d.ts.map +1 -1
  240. package/dist/security-policy.js +11 -57
  241. package/dist/security-policy.js.map +1 -1
  242. package/dist/semgrep-findings.d.ts +9 -0
  243. package/dist/semgrep-findings.d.ts.map +1 -0
  244. package/dist/semgrep-findings.js +293 -0
  245. package/dist/semgrep-findings.js.map +1 -0
  246. package/dist/server/embeddings.d.ts.map +1 -1
  247. package/dist/server/embeddings.js +4 -0
  248. package/dist/server/embeddings.js.map +1 -1
  249. package/dist/server/sqlite-store.d.ts.map +1 -1
  250. package/dist/server/sqlite-store.js +14 -2
  251. package/dist/server/sqlite-store.js.map +1 -1
  252. package/dist/severity-review.d.ts +3 -0
  253. package/dist/severity-review.d.ts.map +1 -1
  254. package/dist/severity-review.js +19 -0
  255. package/dist/severity-review.js.map +1 -1
  256. package/dist/severity-store.js +11 -3
  257. package/dist/severity-store.js.map +1 -1
  258. package/dist/snyk-findings.d.ts +9 -0
  259. package/dist/snyk-findings.d.ts.map +1 -0
  260. package/dist/snyk-findings.js +349 -0
  261. package/dist/snyk-findings.js.map +1 -0
  262. package/dist/targets.d.ts +2 -2
  263. package/dist/targets.d.ts.map +1 -1
  264. package/dist/targets.js +12 -2
  265. package/dist/targets.js.map +1 -1
  266. package/dist/timestamps.d.ts +3 -0
  267. package/dist/timestamps.d.ts.map +1 -0
  268. package/dist/timestamps.js +14 -0
  269. package/dist/timestamps.js.map +1 -0
  270. package/dist/version.d.ts +1 -1
  271. package/dist/version.d.ts.map +1 -1
  272. package/dist/version.js +13 -2
  273. package/dist/version.js.map +1 -1
  274. package/dist/wiz-csv.d.ts +8 -0
  275. package/dist/wiz-csv.d.ts.map +1 -0
  276. package/dist/wiz-csv.js +116 -0
  277. package/dist/wiz-csv.js.map +1 -0
  278. package/dist/wiz-findings.d.ts +4 -0
  279. package/dist/wiz-findings.d.ts.map +1 -0
  280. package/dist/wiz-findings.js +460 -0
  281. package/dist/wiz-findings.js.map +1 -0
  282. package/dist/workbench-arguments.d.ts.map +1 -1
  283. package/dist/workbench-arguments.js +9 -3
  284. package/dist/workbench-arguments.js.map +1 -1
  285. package/dist/worker-progress.d.ts +11 -1
  286. package/dist/worker-progress.d.ts.map +1 -1
  287. package/dist/worker-progress.js +11 -1
  288. package/dist/worker-progress.js.map +1 -1
  289. package/docs/classify-severity-records.md +28 -10
  290. package/docs/cli.md +788 -46
  291. package/docs/findings-service.md +7 -2
  292. package/docs/hosted-remediation.md +134 -0
  293. package/docs/hosted-scans.md +20 -3
  294. package/package.json +9 -6
  295. package/schemas/external-findings.schema.json +1421 -0
  296. package/schemas/project-config.schema.json +4 -0
  297. package/dist/deep-progress.d.ts.map +0 -1
  298. package/dist/deep-progress.js +0 -92
  299. package/dist/deep-progress.js.map +0 -1
package/README.md CHANGED
@@ -11,6 +11,9 @@ security plugin, and TypeScript declarations. It uses ES modules.
11
11
  - Review saved findings, identify duplicates, classify severity, and suggest owners.
12
12
  - Import GitHub code scanning alerts, export SARIF, JSON, or CSV, and publish
13
13
  findings to Linear or a findings service.
14
+ - Import [Snyk Open Source findings](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/snyk.md) from
15
+ official plugin JSON or native CLI JSON locally or into Cloud; Open Source
16
+ SARIF is also supported. License findings and other Snyk products are excluded.
14
17
  - Automate scans across repositories and project components.
15
18
 
16
19
  See the [CLI reference](docs/cli.md),
@@ -225,6 +228,7 @@ const result = await security.run("/path/to/repository", {
225
228
  | `scanPrompt` / `scanPromptFile` | Additional scan instructions. Inline text takes precedence. |
226
229
  | `validationPrompt` / `validationPromptFile` | Custom validation instructions for standard scans. |
227
230
  | `postScanPrompt` / `postScanPromptFile` | Follow-up instructions after the scan. |
231
+ | `ownerSuggestions` | Write optional owner suggestions after a committed scan (default: `false`). |
228
232
  | `outputDir` | Results directory; omit to use the state directory. |
229
233
  | `archiveExisting` | Move previous results aside before reusing `outputDir`. |
230
234
  | `maxCostUsd` | Stop at an estimated model cost; see [cost limits](#progress-and-cost). |
@@ -233,6 +237,16 @@ const result = await security.run("/path/to/repository", {
233
237
  The exported `ScanOptions` type describes all options and callbacks. For full
234
238
  CLI behavior, see [scan options and output](docs/cli.md#scan-options-and-output).
235
239
 
240
+ Set `ownerSuggestions: true` or run `codex-security scan --owner-suggestions`
241
+ to write `owner-suggestions.json` beside a completed committed Git scan. Project
242
+ files can set `scan.owner_suggestions: true`. The report uses the scan's finding
243
+ IDs and frozen revision; it does not change the sealed findings or assign users.
244
+ Owner failures leave the base scan completed and appear as
245
+ `result.ownerSuggestionsError`; successful reports set `result.ownerSuggestionsPath`.
246
+ Owner inference uses the scan's model and reasoning effort. Owner enrichment is
247
+ skipped with a warning when `maxCostUsd` is set, because its inference cannot yet
248
+ share the scan cost limit. Working-tree and directory snapshots are unsupported.
249
+
236
250
  ### Scan a diff
237
251
 
238
252
  ```ts
@@ -265,6 +279,13 @@ Constructor options are `codexOverrides`, `pythonPath`, and `pluginPath`.
265
279
  The bundled runtime and plugin are used by default. `pythonPath` overrides the
266
280
  `PYTHON` environment variable. To choose a model, set `codexOverrides.model`.
267
281
 
282
+ To enable Daybreak on Codex 0.163.0 or later, set `codexOverrides.daybreak: true`.
283
+ The toggle defaults off; an explicit `false` keeps it off. The setting reaches
284
+ Deep Scan discovery and reducer workers, including resumed workers. Scans use
285
+ isolated configuration, so a desktop toggle or personal Codex configuration does
286
+ not configure an SDK scan. See [Daybreak opt-in](docs/cli.md#daybreak-opt-in) for
287
+ CLI, project-file, and direct plugin configuration.
288
+
268
289
  New and resumed Deep Scans require a current plugin with
269
290
  `directDeepScanEngine: 1`, `workerProviderSnapshot: 4`, and isolated worker
270
291
  configuration support. Older custom plugins fail before scan execution; update
@@ -605,8 +626,11 @@ and [Azure Pipelines](https://github.com/openai/codex-security/blob/main/example
605
626
 
606
627
  ### Classify finding severity
607
628
 
608
- Use `classify-severity` with your own rubric to assess saved findings without
609
- changing their original severity or evidence. The SDK exposes `classifySeverity()`,
629
+ Use `classify-severity` to assess saved findings with the built-in severity rubric
630
+ or an explicit custom rubric, without changing their original severity or evidence.
631
+ Each finding receives three independent reviews by default; the most common severity wins,
632
+ with the highest severity breaking ties among the top vote counts.
633
+ Use `--runs N` to request 1–10 reviews (default: 3). The SDK exposes `classifySeverity()`,
610
634
  `classifyScanSeverity()`, and `classifyScanDirectorySeverity()`. See
611
635
  [severity classification](docs/cli.md#classify-finding-severity) for selection,
612
636
  checkpointing, and publication behavior.
@@ -629,6 +653,73 @@ grant Cloud access. See [Cloud publication](docs/cli.md#publish-findings-to-clou
629
653
  for setup and review steps, or [Linear publication](docs/cli.md#publish-completed-scans-to-linear)
630
654
  for issue creation.
631
655
 
656
+ The SDK also exposes `prepareExternalPublication(file, options)` for supported
657
+ vendor exports and `prepareNormalizedExternalPublication(findings, options)` for
658
+ normalized external evidence from any provider in the Cloud import contract.
659
+ The normalized API accepts `NormalizedExternalPublicationOptions`; file readers
660
+ use `ExternalPublicationOptions` for their supported formats. Both resolve the Cloud repository and return a
661
+ `preview` plus a separate `publish()` operation. Inspect the preview before
662
+ calling `publish()`. Imported evidence remains not assessed by Codex, and saved
663
+ requests and receipts support retries after interruption.
664
+
665
+ Prefer each provider's supported native JSON for local and Cloud imports. Keep
666
+ the same acquisition format for repeat imports: SARIF and CSV are compatibility
667
+ options where supported, and changing formats can change record identities or
668
+ replace richer evidence with less detail. See the
669
+ [import guide](docs/cli.md#import-vendor-findings-locally) for format selection.
670
+
671
+ For Wiz, prefer supported native JSON acquired through an authorized MCP or API
672
+ connection. The [CSV compatibility reader](docs/cli.md#import-wiz-findings) covers
673
+ repository package vulnerabilities (SCA) only; it does not add SAST, CSPM or
674
+ complete code-to-cloud coverage. Both formats support gzip. The acquisition path
675
+ still needs validation with an authorized Wiz tenant.
676
+
677
+ For GitHub, save complete JSON from `import github` or `import github-advisories`;
678
+ the configured GitHub plugin can help select alerts before collection. The
679
+ [separate readers and mappings](docs/cli.md#import-github-findings-locally-or-to-cloud)
680
+ retain code-scanning evidence or GHSA disclosures. **GHSA import does not
681
+ establish an installed dependency or applicability to the repository.** This
682
+ integration does not import Dependabot or secret-scanning alerts or write back
683
+ to GitHub.
684
+
685
+ Use `publish findings FILE --to local --repository PATH --provider wiz
686
+ --source-key KEY` to store the same vendor evidence in the local workbench SQLite
687
+ database. Preview with `--dry-run --format json`, then confirm interactively or
688
+ use `--yes`. Read it with `findings imported [REPOSITORY] --format json`; the
689
+ repository defaults to the current directory. No Cloud login or model call is
690
+ needed. Use `--provider snyk` for native CLI JSON, a Snyk plugin SCA bundle or
691
+ Open Source SARIF. Prefer JSON, and keep one format and stable source key per scan
692
+ target; switching formats creates separate source identities. See
693
+ [local imports](docs/cli.md#import-vendor-findings-locally).
694
+
695
+ Use `--provider endor` with native Endor Finding JSON; existing endorctl SARIF is
696
+ accepted as a lossy compatibility format. See
697
+ [Endor imports](docs/cli.md#import-endor-labs-findings).
698
+
699
+ For saved GitHub code-scanning alerts or GHSA advisories, use
700
+ `--provider github` with a separate stable source key for each finding family.
701
+ See [local imports](docs/cli.md#import-vendor-findings-locally).
702
+
703
+ The SDK's `prepareLocalExternalImport(file, options)` returns a `preview` and a
704
+ separate `import()` operation. `prepareNormalizedLocalImport(findings,
705
+ options)` accepts already normalized evidence, and
706
+ `listLocalExternalFindings({ repository })` reads the stored records. Imports
707
+ remain unassessed source evidence, separate from native scan findings. Repeated
708
+ imports update the same repository/provider/source-key/source-ID record; omitted
709
+ records remain stored, and unknown evidence fields are not inferred.
710
+
711
+ File imports forward repository references from the reader automatically. Direct
712
+ normalized callers should provide additional known references in the third
713
+ argument's `sourceRepositories` when they are absent from
714
+ `evidence.details.repository.url`. For a known GitHub custom host, include
715
+ `platform: "github"`, for example `{ sourceRepositories: [{ url:
716
+ "https://git.example.test/example/project", platform: "github" }] }`. Named Wiz
717
+ reports carry this platform in their repository inventory. If you export only the
718
+ normalized finding rows to JSONL, supply that metadata separately; the original
719
+ finding evidence does not include the surrounding inventory.
720
+
721
+ See [Semgrep Code imports](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md) for native CLI/CI JSON, SARIF compatibility, and local or Cloud imports. Platform API and Guardian/MCP responses need a separate mapping.
722
+
632
723
  ## Findings storage and deduplication
633
724
 
634
725
  Saved-scan deduplication uses local SQLite directly:
@@ -53,6 +53,50 @@ async function readDeepScanRuntimeConfig(options) {
53
53
  return config;
54
54
  });
55
55
  }
56
+ async function readDeepScanRuntimeConfigWithOrigins(options) {
57
+ return withPreflightClient(
58
+ options,
59
+ (client) => client.request("config/read", { cwd: options.cwd, includeLayers: true })
60
+ );
61
+ }
62
+ async function readDeepScanParentCyberAccessProgram(options) {
63
+ return withPreflightClient(options, async (client) => {
64
+ let response;
65
+ try {
66
+ response = await client.request("thread/read", {
67
+ threadId: options.parentTurn.threadId,
68
+ includeTurns: false
69
+ });
70
+ } catch (error) {
71
+ const nativeError = asRecord(
72
+ error instanceof Error ? error.cause : void 0
73
+ );
74
+ if (nativeError?.code === -32600 && nativeError.message === `thread not loaded: ${options.parentTurn.threadId}`)
75
+ return void 0;
76
+ throw error;
77
+ }
78
+ const thread = asRecord(response.thread);
79
+ if (thread?.id !== options.parentTurn.threadId || typeof thread.path !== "string")
80
+ return void 0;
81
+ const input = createReadStream(thread.path, { encoding: "utf8" });
82
+ const lines = createInterface({ input, crlfDelay: Infinity });
83
+ try {
84
+ for await (const line of lines) {
85
+ if (!line.trim()) continue;
86
+ const entry = asRecord(JSON.parse(line));
87
+ if (entry?.type !== "turn_context") continue;
88
+ const context = asRecord(entry.payload);
89
+ if (context?.turn_id !== options.parentTurn.turnId) continue;
90
+ const program = context.cyber_access_program;
91
+ return typeof program === "string" ? program : void 0;
92
+ }
93
+ return void 0;
94
+ } finally {
95
+ lines.close();
96
+ input.destroy();
97
+ }
98
+ });
99
+ }
56
100
  async function prepareCliDeepScanSession(options) {
57
101
  return withPreflightClient(options, async (client) => {
58
102
  const response = await client.request("thread/start", {
@@ -157,14 +201,18 @@ async function withPreflightClient(options, operation) {
157
201
  var AppServerPreflightClient = class {
158
202
  constructor(options) {
159
203
  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);
204
+ const args = [
205
+ ...options.appServerArgs ?? options.commandArgs ?? []
206
+ ];
207
+ if (options.appServerArgs === void 0) {
208
+ for (const override of options.configOverrides) {
209
+ args.push("--config", override);
210
+ }
211
+ for (const override of options.providerConfigOverrides ?? []) {
212
+ args.push("--config", override);
213
+ }
214
+ args.push("app-server", "--stdio");
166
215
  }
167
- args.push("app-server", "--stdio");
168
216
  this.child = spawn(executablePathForSpawn(options.codexPath), args, {
169
217
  cwd: options.cwd,
170
218
  ...options.env === void 0 ? {} : { env: options.env },
@@ -482,7 +530,8 @@ function jsonRpcPreflightError(codexPath, method, value, context) {
482
530
  return failure;
483
531
  }
484
532
  return new Error(
485
- 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 : "")
533
+ 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 : ""),
534
+ { cause: value }
486
535
  );
487
536
  }
488
537
  function codexExecutableStartError(codexPath, error, context) {
@@ -552,5 +601,7 @@ export {
552
601
  deepScanPermissionProfileFallbackError,
553
602
  preflightDeepScanWorkerPermissionProfile,
554
603
  prepareCliDeepScanSession,
555
- readDeepScanRuntimeConfig
604
+ readDeepScanParentCyberAccessProgram,
605
+ readDeepScanRuntimeConfig,
606
+ readDeepScanRuntimeConfigWithOrigins
556
607
  };
@@ -12,7 +12,7 @@
12
12
  "type": "string",
13
13
  "minLength": 1,
14
14
  "maxLength": 4096,
15
- "pattern": "^(?:\\./)?(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.\\.?(/|$))(?!.*//)(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$"
15
+ "pattern": "^(?:\\./)?(?!/)(?![A-Za-z]:)(?![\\s\\S]*\\\\)(?![\\s\\S]*(?:^|/)\\.\\.?(/|$))(?![\\s\\S]*//)(?![\\s\\S]*[\\u0000-\\u001f\\u007f])(?![\\s\\S]*\\/$)[\\s\\S]+$"
16
16
  },
17
17
  "candidateId": {
18
18
  "type": "string",
@@ -1256,6 +1256,7 @@ def _recover_unsealed_coverage(
1256
1256
  warnings.append("Recovered malformed Deep Scan inventory strategy.")
1257
1257
 
1258
1258
  surface_ids: set[str] = set()
1259
+ receipt_paths: dict[str, str] = {}
1259
1260
  for field, label in (
1260
1261
  ("surfaces", "coverage surface"),
1261
1262
  ("explicitExclusions", "coverage exclusion"),
@@ -1276,6 +1277,7 @@ def _recover_unsealed_coverage(
1276
1277
  if not isinstance(item, dict):
1277
1278
  raise ContractError(f"{context}: expected an object")
1278
1279
  if field == "surfaces":
1280
+ surface_receipt_paths = dict(receipt_paths)
1279
1281
  surface_id = _require_str(item, "id", context)
1280
1282
  if surface_id in surface_ids:
1281
1283
  raise ContractError(f"{context}.id: duplicate surface id")
@@ -1310,6 +1312,11 @@ def _recover_unsealed_coverage(
1310
1312
  f"{ref_context}: expected a file under artifacts/"
1311
1313
  )
1312
1314
  _require_scan_local_file(scan_dir, normalized_ref, ref_context)
1315
+ key = normalized_ref.lower()
1316
+ previous = surface_receipt_paths.get(key)
1317
+ if previous is not None and previous != normalized_ref:
1318
+ raise ContractError(f"{ref_context}: duplicate artifact path")
1319
+ surface_receipt_paths[key] = normalized_ref
1313
1320
  except ContractError as exc:
1314
1321
  warnings.append(
1315
1322
  f"Skipped malformed coverage receipt "
@@ -1332,6 +1339,7 @@ def _recover_unsealed_coverage(
1332
1339
 
1333
1340
  if field == "surfaces":
1334
1341
  surface_ids.add(surface_id)
1342
+ receipt_paths = surface_receipt_paths
1335
1343
  recovered.append(item)
1336
1344
 
1337
1345
  coverage[field] = recovered
@@ -2787,7 +2795,10 @@ def write_sarif_projection(
2787
2795
  scan_dir: Path, source_root: Path | None = None, schema_dir: Path | None = None
2788
2796
  ) -> None:
2789
2797
  sarif = build_sarif_projection(scan_dir, source_root, schema_dir)
2790
- _write_scan_local_json(scan_dir, "exports/results.sarif", sarif)
2798
+ relative_path = EXPORT_PATHS["sarif"]
2799
+ write_export_output(
2800
+ scan_dir, scan_dir / relative_path, "sarif", _contract_json_bytes(relative_path, sarif)
2801
+ )
2791
2802
 
2792
2803
 
2793
2804
  def csv_cell(value: Any) -> Any:
@@ -12,7 +12,7 @@ from pathlib import Path
12
12
 
13
13
  # Some plugin hosts launch Python with safe-path isolation enabled.
14
14
  sys.path.insert(0, str(Path(__file__).resolve().parent))
15
- from workbench_target import git_blob_samples, git_command
15
+ from workbench_target import SOURCE_METADATA_DIRECTORIES, git_blob_samples, git_command
16
16
 
17
17
 
18
18
  class InventoryError(ValueError):
@@ -94,11 +94,11 @@ def generate_in_scope_files(repository: Path, scope: str, output: Path) -> int:
94
94
  "--hidden",
95
95
  "--path-separator",
96
96
  "/",
97
- # Prune Git metadata and its contents even when the scope starts inside .git.
97
+ # Prune metadata and its contents even when the scope starts inside it.
98
98
  "--glob",
99
- "!**/.git",
99
+ "!**/{.git,.svn}",
100
100
  "--glob",
101
- "!**/.git/**",
101
+ "!**/{.git,.svn}/**",
102
102
  "--",
103
103
  scope,
104
104
  ]
@@ -121,7 +121,7 @@ def generate_in_scope_files(repository: Path, scope: str, output: Path) -> int:
121
121
  message = f"{message}: {detail}"
122
122
  raise InventoryError(message)
123
123
 
124
- if (repository / ".git").exists():
124
+ if any((parent / ".git").exists() for parent in (repository, *repository.parents)):
125
125
  try:
126
126
  tracked = git_command(
127
127
  repository,
@@ -146,7 +146,7 @@ def generate_in_scope_files(repository: Path, scope: str, output: Path) -> int:
146
146
  inventory.seek(0)
147
147
  rows: list[bytes] = []
148
148
  for path in inventory.read().split(b"\0"):
149
- if not path:
149
+ if not path or not SOURCE_METADATA_DIRECTORIES.isdisjoint(os.fsdecode(path).split("/")):
150
150
  continue
151
151
  if b"\n" in path or b"\r" in path:
152
152
  raise InventoryError(
@@ -31,7 +31,12 @@ from rank_preview import (
31
31
  preview_for,
32
32
  preview_for_bytes,
33
33
  )
34
- from workbench_target import git_blob_samples, git_command, git_directory_snapshot_paths
34
+ from workbench_target import (
35
+ SOURCE_METADATA_DIRECTORIES,
36
+ git_blob_samples,
37
+ git_command,
38
+ git_directory_snapshot_paths,
39
+ )
35
40
 
36
41
  JsonRow = dict[str, object]
37
42
 
@@ -155,11 +160,11 @@ def scope_candidates(repo: Path, scope_path: Path) -> Iterable[Path]:
155
160
  "--hidden",
156
161
  "--no-require-git",
157
162
  "--null",
158
- # Also exclude descendants when the scope starts inside .git.
163
+ # Also exclude descendants when the scope starts inside metadata.
159
164
  "--glob",
160
- "!**/.git",
165
+ "!**/{.git,.svn}",
161
166
  "--glob",
162
- "!**/.git/**",
167
+ "!**/{.git,.svn}/**",
163
168
  "--",
164
169
  str(scope_path.relative_to(repo)),
165
170
  ]
@@ -207,7 +212,7 @@ def make_repo_scope_input(args: argparse.Namespace) -> None:
207
212
  relative = path.resolve(strict=True).relative_to(repo)
208
213
  except (OSError, ValueError):
209
214
  continue
210
- if ".git" in relative.parts:
215
+ if not SOURCE_METADATA_DIRECTORIES.isdisjoint(relative.parts):
211
216
  continue
212
217
  rows_by_path.setdefault(relative.as_posix(), {"path": relative.as_posix()})
213
218
 
@@ -276,7 +281,8 @@ def git_changed_paths(repo: Path, base: str, head: str, mode: str) -> list[tuple
276
281
  return sorted(
277
282
  (path, status)
278
283
  for path, status in combined.items()
279
- if status == "D" or (not path.is_symlink() and path.is_file())
284
+ if SOURCE_METADATA_DIRECTORIES.isdisjoint(path.relative_to(repo).parts)
285
+ and (status == "D" or (not path.is_symlink() and path.is_file()))
280
286
  )
281
287
  raise SystemExit(f"Unknown diff mode: {mode}")
282
288
 
@@ -47,7 +47,8 @@ def _strings(value: Any) -> list[str]:
47
47
 
48
48
  def _path_label(value: str) -> str:
49
49
  if "," in value or value != " ".join(value.split()) or any(ord(c) < 32 for c in value):
50
- return json.dumps(value)
50
+ quoted = json.dumps(value, ensure_ascii=False)
51
+ return "".join(c if c.isprintable() else json.dumps(c)[1:-1] for c in quoted)
51
52
  return value
52
53
 
53
54
 
@@ -129,9 +129,7 @@ def render_threat_model(model: dict[str, Any], provenance: dict[str, Any] | None
129
129
  ):
130
130
  if provenance.get(key):
131
131
  footer.append(f"- {label}: {text(str(provenance[key]), 'not recorded')}")
132
- footer.append(
133
- f"- Model origin: {text(str(model.get('origin', 'not recorded')), 'not recorded')}"
134
- )
132
+ footer.append(f"- Model origin: {text(model.get('origin'), 'not recorded')}")
135
133
  footer.extend(_scope_lines(model.get("scope"), "Model scope", text))
136
134
  scan_scope = provenance.get("scanScope")
137
135
  if isinstance(scan_scope, dict):
@@ -0,0 +1,234 @@
1
+ """Project saved worker coverage and reconcile its published parent copies."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import copy
6
+ import hashlib
7
+ import json
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from finalize_scan_contract import (
12
+ ContractError,
13
+ _normalize_unsealed_open_questions,
14
+ _require_portable_relative_path,
15
+ )
16
+
17
+
18
+ def _saved_coverage_id(item: dict[str, Any]) -> str:
19
+ if candidate_id := item.get("candidateId"):
20
+ return candidate_id
21
+ payload = json.dumps(
22
+ item, ensure_ascii=True, allow_nan=False, sort_keys=True, separators=(",", ":")
23
+ ).encode()
24
+ return f"saved-{hashlib.sha256(payload).hexdigest()[:16]}"
25
+
26
+
27
+ def _project_worker_coverage_row(item: Any, worker_id: str | None, field: str) -> Any:
28
+ row = copy.deepcopy(item)
29
+ if worker_id is None or not isinstance(row, dict):
30
+ return row
31
+ row["workerId"] = worker_id
32
+ if field == "openQuestions":
33
+ return row
34
+ # Reconcile raw checkpoint identities first. Anonymous output rows use the
35
+ # existing content identity, never their position in an earlier snapshot.
36
+ row.setdefault("id", _saved_coverage_id(row))
37
+ if isinstance(row.get("id"), str):
38
+ row["id"] = f"{worker_id}/{row['id']}"
39
+ if field == "deferred" and isinstance(row.get("surfaceIds"), list):
40
+ row["surfaceIds"] = [
41
+ f"{worker_id}/{identity}" if isinstance(identity, str) else identity
42
+ for identity in row["surfaceIds"]
43
+ ]
44
+ return row
45
+
46
+
47
+ def _coverage_comparison_row(row: Any, field: str) -> Any:
48
+ if field == "surfaces" and isinstance(row, dict):
49
+ row = {"receiptRefs": [], **row}
50
+ if isinstance(row["receiptRefs"], list):
51
+ refs = []
52
+ for ref in row["receiptRefs"]:
53
+ if isinstance(ref, str):
54
+ try:
55
+ ref = _require_portable_relative_path(ref, "Saved coverage receipt")
56
+ except ContractError:
57
+ pass # Leave malformed refs to the existing per-record recovery.
58
+ refs.append(ref)
59
+ row["receiptRefs"] = refs
60
+ return row
61
+ if field == "openQuestions":
62
+ coverage = {"openQuestions": [copy.deepcopy(row)]}
63
+ _normalize_unsealed_open_questions(coverage)
64
+ return next(iter(coverage["openQuestions"]), row)
65
+ return row
66
+
67
+
68
+ def _aggregate_worker_coverage_rows(rows: list[Any], worker_id: str, field: str) -> list[Any]:
69
+ """Match accepted aggregate IDs without changing raw recovery identities."""
70
+ reserved = {
71
+ row["id"] for row in rows if isinstance(row, dict) and isinstance(row.get("id"), str)
72
+ }
73
+ emitted: set[str] = set()
74
+ projected = []
75
+ for index, original in enumerate(rows):
76
+ row = copy.deepcopy(original)
77
+ if isinstance(row, dict) and field != "openQuestions":
78
+ generated = not isinstance(row.get("id"), str)
79
+ identity = str(index) if generated else row["id"]
80
+ base = identity
81
+ if generated or identity in emitted:
82
+ suffix = 2
83
+ while identity in reserved:
84
+ identity = f"{base}-{suffix}"
85
+ suffix += 1
86
+ reserved.add(identity)
87
+ emitted.add(identity)
88
+ row["id"] = identity
89
+ projected.append(
90
+ _coverage_comparison_row(_project_worker_coverage_row(row, worker_id, field), field)
91
+ )
92
+ return projected
93
+
94
+
95
+ def _prepare_worker_coverage_recovery(
96
+ sources: list[tuple[str, dict[str, Any], str | None]],
97
+ parent: dict[str, Any] | None,
98
+ source_order: dict[str, tuple[int, int]],
99
+ *,
100
+ enabled: bool,
101
+ ) -> tuple[
102
+ bool, list[tuple[dict[str, Any], str, dict[str, Any], dict[str, Any], dict[str, Any] | None]]
103
+ ]:
104
+ """Put bound worker evidence in parent coordinates without changing source files."""
105
+ workers = {owner for _, _, owner in sources if owner is not None}
106
+ parents = [
107
+ draft
108
+ for _, draft, owner in sorted(
109
+ sources, key=lambda source: source_order[source[0]], reverse=True
110
+ )
111
+ if owner is None
112
+ ]
113
+ if parent is not None:
114
+ # Prefer the selected parent over historical copies of a task's surface.
115
+ parents.insert(0, parent)
116
+ fields = ("surfaces", "explicitExclusions", "deferred", "openQuestions")
117
+ if not enabled:
118
+ enabled = any(
119
+ isinstance(row, dict)
120
+ and isinstance(row.get("workerId"), str)
121
+ and row["workerId"] in workers
122
+ and (
123
+ field == "openQuestions"
124
+ or (isinstance(row.get("id"), str) and row["id"].startswith(f"{row['workerId']}/"))
125
+ )
126
+ for draft in parents
127
+ for field in fields
128
+ for row in (
129
+ draft["coverage"].get(field, [])
130
+ if isinstance(draft["coverage"].get(field, []), list)
131
+ else []
132
+ )
133
+ )
134
+ if not enabled:
135
+ return False, []
136
+ projected: dict[str, list[Any]] = {field: [] for field in fields}
137
+ surface_sources: list[tuple[dict[str, Any], dict[str, Any]]] = []
138
+ task_sources: list[tuple[dict[str, Any], dict[str, Any]]] = []
139
+ surface_links: list[
140
+ tuple[dict[str, Any], str, dict[str, Any], dict[str, Any], dict[str, Any] | None]
141
+ ] = []
142
+ for relative, draft, owner in sources:
143
+ if owner is None:
144
+ continue
145
+ directory = Path(relative).parent
146
+ if directory.name == "checkpoints":
147
+ directory = directory.parent
148
+ for field in fields:
149
+ rows = draft["coverage"].get(field, [])
150
+ if not isinstance(rows, list):
151
+ continue
152
+ for index, row in enumerate(rows):
153
+ if field == "openQuestions" and isinstance(row, str):
154
+ row = {"question": row}
155
+ rows[index] = row
156
+ if not isinstance(row, dict):
157
+ continue
158
+ row["workerId"] = owner
159
+ if field == "surfaces" and isinstance(row.get("receiptRefs"), list):
160
+ refs = []
161
+ for ref in row["receiptRefs"]:
162
+ if isinstance(ref, str):
163
+ try:
164
+ normalized = _require_portable_relative_path(
165
+ ref, "Worker coverage receipt"
166
+ )
167
+ except ContractError:
168
+ pass # Leave malformed refs to the existing per-record recovery.
169
+ else:
170
+ if normalized.startswith("artifacts/"):
171
+ ref = f"{directory.as_posix()}/{normalized}"
172
+ refs.append(ref)
173
+ row["receiptRefs"] = refs
174
+ if field == "surfaces":
175
+ row.setdefault("receiptRefs", [])
176
+ aggregate_rows = _aggregate_worker_coverage_rows(rows, owner, field)
177
+ projected[field].extend(aggregate_rows)
178
+ if field in {"surfaces", "deferred"}:
179
+ originals = surface_sources if field == "surfaces" else task_sources
180
+ originals.extend(
181
+ (aggregate, row)
182
+ for aggregate, row in zip(aggregate_rows, rows)
183
+ if isinstance(aggregate, dict) and isinstance(row, dict)
184
+ )
185
+ # A canonical aggregate contains copies of the same worker evidence. Let
186
+ # the existing per-worker chronology reconcile those originals exactly once.
187
+ # Keep parent-only evidence when its bound worker source is unavailable.
188
+ for draft in parents:
189
+ if not draft["coverage"]:
190
+ continue
191
+ for field in fields:
192
+ rows = draft["coverage"].get(field, [])
193
+ if isinstance(rows, list):
194
+ if field == "surfaces":
195
+ tasks = draft["coverage"].get("deferred", [])
196
+ for row in rows:
197
+ if not isinstance(row, dict) or not isinstance(row.get("id"), str):
198
+ continue
199
+ matching_sources = [
200
+ original
201
+ for aggregate, original in surface_sources
202
+ if aggregate == _coverage_comparison_row(row, field)
203
+ ]
204
+ if not matching_sources:
205
+ continue
206
+ for task in tasks if isinstance(tasks, list) else []:
207
+ if (
208
+ isinstance(task, dict)
209
+ and isinstance(task.get("surfaceIds"), list)
210
+ and row["id"] in task["surfaceIds"]
211
+ ):
212
+ surface_links.extend(
213
+ (
214
+ task,
215
+ row["id"],
216
+ source,
217
+ row,
218
+ next(
219
+ (
220
+ original
221
+ for aggregate, original in task_sources
222
+ if aggregate == task
223
+ ),
224
+ None,
225
+ ),
226
+ )
227
+ for source in matching_sources
228
+ )
229
+ draft["coverage"][field] = [
230
+ row
231
+ for row in rows
232
+ if _coverage_comparison_row(row, field) not in projected[field]
233
+ ]
234
+ return True, surface_links