@openai/codex-security 0.1.21 → 0.1.24

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 (183) hide show
  1. package/README.md +549 -1
  2. package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
  3. package/_bundled_plugin/.mcp.json +1 -0
  4. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  5. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  6. package/_bundled_plugin/references/config-preflight.md +2 -30
  7. package/_bundled_plugin/references/core-scan.md +1 -1
  8. package/_bundled_plugin/references/final-report.md +1 -1
  9. package/_bundled_plugin/references/finding-detail-fields.md +5 -10
  10. package/_bundled_plugin/references/sarif-adapter.md +1 -1
  11. package/_bundled_plugin/references/scan-contract.md +10 -0
  12. package/_bundled_plugin/scripts/config_preflight.py +2 -8
  13. package/_bundled_plugin/scripts/deep_scan_workbench.py +6 -1
  14. package/_bundled_plugin/scripts/finalize_scan_contract.py +115 -76
  15. package/_bundled_plugin/scripts/finding_preview.py +22 -4
  16. package/_bundled_plugin/scripts/generate_in_scope_files.py +29 -9
  17. package/_bundled_plugin/scripts/generate_rank_input.py +1 -5
  18. package/_bundled_plugin/scripts/rank_preview.py +1 -0
  19. package/_bundled_plugin/scripts/report_projection.py +8 -14
  20. package/_bundled_plugin/scripts/validate_scan_contract.py +1 -3
  21. package/_bundled_plugin/scripts/windows_scan_local_files.py +90 -6
  22. package/_bundled_plugin/scripts/workbench_cli.py +27 -1
  23. package/_bundled_plugin/scripts/workbench_dashboard.py +138 -0
  24. package/_bundled_plugin/scripts/workbench_db.py +110 -539
  25. package/_bundled_plugin/scripts/workbench_finding_index.py +42 -24
  26. package/_bundled_plugin/scripts/workbench_finding_workflows.py +208 -0
  27. package/_bundled_plugin/scripts/workbench_findings.py +221 -0
  28. package/_bundled_plugin/scripts/workbench_native_indexes.py +1 -2
  29. package/_bundled_plugin/scripts/workbench_publication.py +520 -0
  30. package/_bundled_plugin/scripts/workbench_remediation.py +37 -0
  31. package/_bundled_plugin/scripts/workbench_saved_results.py +322 -89
  32. package/_bundled_plugin/scripts/workbench_scan_history.py +1 -2
  33. package/_bundled_plugin/scripts/workbench_scan_usage.py +9 -33
  34. package/_bundled_plugin/scripts/workbench_schema.py +276 -58
  35. package/_bundled_plugin/scripts/workbench_target.py +30 -6
  36. package/_bundled_plugin/scripts/workbench_validation.py +1 -5
  37. package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +1 -5
  38. package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +6 -1
  39. package/_bundled_plugin/skills/track-findings/SKILL.md +2 -0
  40. package/dist/api.d.ts +5 -1
  41. package/dist/api.d.ts.map +1 -1
  42. package/dist/api.js +135 -27
  43. package/dist/api.js.map +1 -1
  44. package/dist/cli.d.ts +4 -0
  45. package/dist/cli.d.ts.map +1 -1
  46. package/dist/cli.js +158 -62
  47. package/dist/cli.js.map +1 -1
  48. package/dist/cloud-publish.js +5 -1
  49. package/dist/cloud-publish.js.map +1 -1
  50. package/dist/contract.d.ts +1 -0
  51. package/dist/contract.d.ts.map +1 -1
  52. package/dist/contract.js +9 -0
  53. package/dist/contract.js.map +1 -1
  54. package/dist/custom-publish.d.ts +22 -0
  55. package/dist/custom-publish.d.ts.map +1 -0
  56. package/dist/custom-publish.js +47 -0
  57. package/dist/custom-publish.js.map +1 -0
  58. package/dist/custom-validation-prompt.js +1 -1
  59. package/dist/custom-validation-prompt.js.map +1 -1
  60. package/dist/deduplication/checkpointed-review.d.ts +16 -0
  61. package/dist/deduplication/checkpointed-review.d.ts.map +1 -0
  62. package/dist/deduplication/checkpointed-review.js +76 -0
  63. package/dist/deduplication/checkpointed-review.js.map +1 -0
  64. package/dist/deduplication/codex-review.d.ts +21 -0
  65. package/dist/deduplication/codex-review.d.ts.map +1 -0
  66. package/dist/deduplication/codex-review.js +252 -0
  67. package/dist/deduplication/codex-review.js.map +1 -0
  68. package/dist/deduplication/deduplication-prompts.d.ts +8 -0
  69. package/dist/deduplication/deduplication-prompts.d.ts.map +1 -0
  70. package/dist/deduplication/deduplication-prompts.js +35 -0
  71. package/dist/deduplication/deduplication-prompts.js.map +1 -0
  72. package/dist/deduplication/deduplication-reviewer.d.ts +46 -0
  73. package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -0
  74. package/dist/deduplication/deduplication-reviewer.js +105 -0
  75. package/dist/deduplication/deduplication-reviewer.js.map +1 -0
  76. package/dist/deduplication/deduplication.d.ts +6 -0
  77. package/dist/deduplication/deduplication.d.ts.map +1 -0
  78. package/dist/deduplication/deduplication.js +85 -0
  79. package/dist/deduplication/deduplication.js.map +1 -0
  80. package/dist/deduplication/scan.d.ts +16 -0
  81. package/dist/deduplication/scan.d.ts.map +1 -0
  82. package/dist/deduplication/scan.js +101 -0
  83. package/dist/deduplication/scan.js.map +1 -0
  84. package/dist/deep-progress.d.ts +21 -0
  85. package/dist/deep-progress.d.ts.map +1 -0
  86. package/dist/deep-progress.js +108 -0
  87. package/dist/deep-progress.js.map +1 -0
  88. package/dist/finding-dedupe-groups.d.ts +7 -0
  89. package/dist/finding-dedupe-groups.d.ts.map +1 -0
  90. package/dist/finding-dedupe-groups.js +2 -0
  91. package/dist/finding-dedupe-groups.js.map +1 -0
  92. package/dist/finding-retrieval.d.ts +13 -0
  93. package/dist/finding-retrieval.d.ts.map +1 -0
  94. package/dist/finding-retrieval.js +2 -0
  95. package/dist/finding-retrieval.js.map +1 -0
  96. package/dist/finding-workflow.d.ts +53 -0
  97. package/dist/finding-workflow.d.ts.map +1 -0
  98. package/dist/finding-workflow.js +117 -0
  99. package/dist/finding-workflow.js.map +1 -0
  100. package/dist/findings-client.d.ts +15 -0
  101. package/dist/findings-client.d.ts.map +1 -0
  102. package/dist/findings-client.js +60 -0
  103. package/dist/findings-client.js.map +1 -0
  104. package/dist/index.d.ts +5 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +2 -0
  107. package/dist/index.js.map +1 -1
  108. package/dist/publication.js +28 -40
  109. package/dist/publication.js.map +1 -1
  110. package/dist/runtime.d.ts +5 -1
  111. package/dist/runtime.d.ts.map +1 -1
  112. package/dist/runtime.js +119 -13
  113. package/dist/runtime.js.map +1 -1
  114. package/dist/saved-scan.d.ts +15 -0
  115. package/dist/saved-scan.d.ts.map +1 -0
  116. package/dist/saved-scan.js +68 -0
  117. package/dist/saved-scan.js.map +1 -0
  118. package/dist/scan-activity.d.ts.map +1 -1
  119. package/dist/scan-activity.js +12 -2
  120. package/dist/scan-activity.js.map +1 -1
  121. package/dist/scan-comparison.d.ts +3 -2
  122. package/dist/scan-comparison.d.ts.map +1 -1
  123. package/dist/scan-comparison.js +1 -1
  124. package/dist/scan-comparison.js.map +1 -1
  125. package/dist/server/dashboard/THIRD_PARTY_NOTICES.txt +276 -0
  126. package/dist/server/dashboard/app.css +2 -0
  127. package/dist/server/dashboard/app.js +66 -0
  128. package/dist/server/dashboard/index.html +18 -0
  129. package/dist/server/dashboard-types.d.ts +45 -0
  130. package/dist/server/dashboard-types.d.ts.map +1 -0
  131. package/dist/server/dashboard-types.js +2 -0
  132. package/dist/server/dashboard-types.js.map +1 -0
  133. package/dist/server/dashboard.d.ts +6 -0
  134. package/dist/server/dashboard.d.ts.map +1 -0
  135. package/dist/server/dashboard.js +45 -0
  136. package/dist/server/dashboard.js.map +1 -0
  137. package/dist/server/embeddings.d.ts +16 -0
  138. package/dist/server/embeddings.d.ts.map +1 -0
  139. package/dist/server/embeddings.js +114 -0
  140. package/dist/server/embeddings.js.map +1 -0
  141. package/dist/server/errors.d.ts +5 -0
  142. package/dist/server/errors.d.ts.map +1 -0
  143. package/dist/server/errors.js +8 -0
  144. package/dist/server/errors.js.map +1 -0
  145. package/dist/server/findings-service.d.ts +20 -0
  146. package/dist/server/findings-service.d.ts.map +1 -0
  147. package/dist/server/findings-service.js +31 -0
  148. package/dist/server/findings-service.js.map +1 -0
  149. package/dist/server/index.d.ts +2 -0
  150. package/dist/server/index.d.ts.map +1 -0
  151. package/dist/server/index.js +6 -0
  152. package/dist/server/index.js.map +1 -0
  153. package/dist/server/routes.d.ts +6 -0
  154. package/dist/server/routes.d.ts.map +1 -0
  155. package/dist/server/routes.js +86 -0
  156. package/dist/server/routes.js.map +1 -0
  157. package/dist/server/serve.d.ts +2 -0
  158. package/dist/server/serve.d.ts.map +1 -0
  159. package/dist/server/serve.js +28 -0
  160. package/dist/server/serve.js.map +1 -0
  161. package/dist/server/server.d.ts +10 -0
  162. package/dist/server/server.d.ts.map +1 -0
  163. package/dist/server/server.js +17 -0
  164. package/dist/server/server.js.map +1 -0
  165. package/dist/server/sqlite-store.d.ts +22 -0
  166. package/dist/server/sqlite-store.d.ts.map +1 -0
  167. package/dist/server/sqlite-store.js +82 -0
  168. package/dist/server/sqlite-store.js.map +1 -0
  169. package/dist/server/storage.d.ts +32 -0
  170. package/dist/server/storage.d.ts.map +1 -0
  171. package/dist/server/storage.js +2 -0
  172. package/dist/server/storage.js.map +1 -0
  173. package/dist/server/validation.d.ts +17 -0
  174. package/dist/server/validation.d.ts.map +1 -0
  175. package/dist/server/validation.js +53 -0
  176. package/dist/server/validation.js.map +1 -0
  177. package/dist/trusted-executable.d.ts.map +1 -1
  178. package/dist/trusted-executable.js +2 -1
  179. package/dist/trusted-executable.js.map +1 -1
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/dist/version.js.map +1 -1
  183. package/package.json +17 -5
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { CodexSecurity } from "./api.js";
3
+ import { publishScanToCustom } from "./custom-publish.js";
4
+ import { deduplicateScanInternal } from "./deduplication/scan.js";
3
5
  import { publishFindingsCsvToCloud, publishScanToCloud } from "./cloud-publish.js";
4
6
  import { type BulkScanDiscoveryDependencies, type BulkScanPrompt } from "./bulk-scan-discovery.js";
5
7
  import { type CodexSecurityConfig, type ExternalModelProvider, type JsonObject } from "./config.js";
@@ -68,8 +70,10 @@ interface CliDependencies {
68
70
  publishPrompt?: Pick<BulkScanPrompt, "isInteractive" | "select"> & Partial<Pick<BulkScanPrompt, "checkbox">>;
69
71
  checkScanPublication?: typeof checkScanPublication;
70
72
  publishScan?: typeof publishScan;
73
+ deduplicateScan?: typeof deduplicateScanInternal;
71
74
  publishFindingsCsvToCloud?: typeof publishFindingsCsvToCloud;
72
75
  publishScanToCloud?: typeof publishScanToCloud;
76
+ publishScanToCustom?: typeof publishScanToCustom;
73
77
  confirmPatchReview?: (question: string) => Promise<boolean>;
74
78
  patchEditor?: (repository: string, findings: readonly Finding[]) => Promise<PatchSelection | null>;
75
79
  currentDirectory(): string;
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAiDA,OAAO,EAEL,aAAa,EAUd,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAcrB,OAAO,EAEL,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAuB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EACL,oBAAoB,EAEpB,WAAW,EAIZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAYL,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,6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;CACrB,CAAC,CA6OD;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,UAAU,GAAG,OAAO,GAAG,YAAY,EAC5C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAyBR;AAg1CD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,mBAAmB,EAC5B,QAAQ,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,qBAAqB,GAC7D,UAAU,CAiFZ;AAwBD,qBAAa,QAAQ;;gBAkBjB,MAAM,GAAE,QAAyB,EACjC,YAAY,GAAE,IAAI,CAChB,eAAe,EACf,KAAK,GAAG,aAAa,GAAG,eAAe,CACjB,EACxB,WAAW,UAAO;IAQpB,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,cAAc,IAAI,MAAM,CAKlC;IAEM,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAiBjC,SAAS,IAAI,IAAI;IAwCjB,eAAe,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI;CAoChD"}
package/dist/cli.js CHANGED
@@ -13,8 +13,11 @@ import { fileURLToPath, pathToFileURL } from "node:url";
13
13
  import { promisify, stripVTControlCharacters } from "node:util";
14
14
  import { Cli, z } from "incur";
15
15
  import { parse as parseToml } from "smol-toml";
16
- import { classifyConnectionFailure, createSecurityInternal, listRepositoryFindings, SCAN_AUTH_MODES, scanAuthentication, } from "./api.js";
16
+ import { classifyConnectionFailure, createSecurityInternal, environmentValue, listRepositoryFindings, SCAN_AUTH_MODES, scanAuthentication, } from "./api.js";
17
17
  import { accountStatus } from "./auth.js";
18
+ import { publishScanToCustom } from "./custom-publish.js";
19
+ import { deduplicateScanInternal } from "./deduplication/scan.js";
20
+ import { resolveCompletedScan, resolveWorkflowScan, } from "./saved-scan.js";
18
21
  import { publishFindingsCsvToCloud, publishScanToCloud, } from "./cloud-publish.js";
19
22
  import { createBulkScanDiscoveryDependencies, runBulkScanWizard, } from "./bulk-scan-discovery.js";
20
23
  import { DEFAULT_CODEX_CONFIG, EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanModelConfiguration, scanModelProvider, } from "./config.js";
@@ -76,6 +79,8 @@ const EXPORT_DEFAULT_OUTPUTS = {
76
79
  sarif: "results.sarif",
77
80
  };
78
81
  const VALUE_OPTIONS = new Set([
82
+ "--port",
83
+ "--workflow-id",
79
84
  "--auth",
80
85
  "--safety-identifier",
81
86
  "--path",
@@ -126,6 +131,7 @@ const VALUE_OPTIONS = new Set([
126
131
  "--scan-root",
127
132
  "--reason",
128
133
  "--to",
134
+ "--findings-url",
129
135
  "--linear-team",
130
136
  "--linear-api-key",
131
137
  "--project",
@@ -809,7 +815,9 @@ const DEFAULT_DEPENDENCIES = {
809
815
  matchFindings: (input, options) => matchScanFindingsInternal(input, options, { surface: "cli" }),
810
816
  };
811
817
  export async function runCodexSkillCommand(args, output, command = resolveCodexCommand(), processEnvironment = process.env, input) {
812
- const configuredHome = processEnvironment["CODEX_HOME"];
818
+ const configuredHome = process.platform === "win32"
819
+ ? environmentValue(processEnvironment, "CODEX_HOME")
820
+ : processEnvironment["CODEX_HOME"];
813
821
  const environment = { ...processEnvironment };
814
822
  for (const name of Object.keys(environment)) {
815
823
  if (name.toUpperCase() === "CODEX_HOME")
@@ -1422,21 +1430,28 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1422
1430
  .describe("Completed scan directory; omit to select a saved scan."),
1423
1431
  }),
1424
1432
  options: PUBLICATION_DESTINATION_OPTIONS.extend({
1433
+ workflowId: optionValue("--workflow-id")
1434
+ .optional()
1435
+ .describe("Resume the named local scan, custom publication, and dedupe workflow."),
1425
1436
  scan: z
1426
1437
  .array(optionValue("--scan"))
1427
1438
  .default([])
1428
- .describe("Saved scan ID, unique prefix, or latest; repeat for multiple scans (Linear accepts one)."),
1439
+ .describe("Saved scan ID, unique prefix, or latest; Linear and custom accept one scan."),
1429
1440
  scanDir: z
1430
1441
  .array(optionValue("--scan-dir"))
1431
1442
  .default([])
1432
- .describe("External completed scan directory; repeat for multiple scans (Linear accepts one)."),
1443
+ .describe("External completed scan directory; Linear and custom accept one scan."),
1433
1444
  // Cloud remains an internal destination, omitted from public discovery.
1434
1445
  to: z
1435
1446
  .string()
1436
- .refine((value) => value === "linear" || value === "cloud", {
1437
- message: "Unsupported publication destination. Use --to linear.",
1447
+ .refine((value) => value === "linear" || value === "cloud" || value === "custom", {
1448
+ message: "Unsupported publication destination. Use --to linear or --to custom.",
1438
1449
  })
1439
- .describe("Publication destination (linear)."),
1450
+ .describe("Publication destination (linear or custom)."),
1451
+ findingsUrl: optionValue("--findings-url")
1452
+ .url()
1453
+ .optional()
1454
+ .describe("Findings API base URL; required with --to custom (for example http://localhost:3000)."),
1440
1455
  dryRun: z
1441
1456
  .boolean()
1442
1457
  .default(false)
@@ -1529,7 +1544,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1529
1544
  if (new Set(options.scan).size > 1 && options.to !== "cloud") {
1530
1545
  throw new CodexSecurityError("Multiple scans are only supported with --to cloud.");
1531
1546
  }
1532
- if (options.to === "cloud" &&
1547
+ if (options.to !== "linear" &&
1533
1548
  (options.skipExisting ||
1534
1549
  [
1535
1550
  options.linearTeam,
@@ -1538,12 +1553,21 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1538
1553
  options.project,
1539
1554
  options.linearAssignee,
1540
1555
  ].some((value) => value !== undefined))) {
1541
- throw new CodexSecurityError("Cloud publication cannot be combined with Linear options.");
1556
+ throw new CodexSecurityError(`${options.to === "cloud" ? "Cloud" : "Custom"} publication cannot be combined with Linear options.`);
1557
+ }
1558
+ if (options.to === "custom" && options.findingsUrl === undefined) {
1559
+ throw new CodexSecurityError("Custom publication requires --findings-url, for example http://localhost:3000.");
1560
+ }
1561
+ if (options.to !== "custom" && options.findingsUrl !== undefined) {
1562
+ throw new CodexSecurityError("--findings-url is only supported with --to custom.");
1563
+ }
1564
+ if (options.workflowId !== undefined && options.to !== "custom") {
1565
+ throw new CodexSecurityError("--workflow-id is only supported with --to custom.");
1542
1566
  }
1543
1567
  const destination = options.to === "linear"
1544
1568
  ? publicationDestination({ ...options, to: "linear" }, dependencies.environment)
1545
1569
  : undefined;
1546
- if (options.to === "cloud") {
1570
+ if (options.to !== "linear") {
1547
1571
  dependencies.addSignalListener("SIGINT", onInterrupt);
1548
1572
  dependencies.addSignalListener("SIGTERM", onTerminate);
1549
1573
  observingSignals = true;
@@ -1559,11 +1583,14 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1559
1583
  const selectedScans = directories.map((scanDir) => ({ scanDir }));
1560
1584
  for (const requestedId of new Set(options.scan)) {
1561
1585
  controller.signal.throwIfAborted();
1562
- const scan = await resolvePublicationScan(requestedId, dependencies);
1586
+ const scan = await resolveCompletedScan(requestedId, dependencies);
1563
1587
  if (!selectedScans.some(({ scanId }) => scanId === scan.scanId)) {
1564
1588
  selectedScans.push(scan);
1565
1589
  }
1566
1590
  }
1591
+ if (options.workflowId !== undefined && selectedScans.length === 0) {
1592
+ selectedScans.push(await resolveWorkflowScan(options.workflowId, dependencies));
1593
+ }
1567
1594
  let scanDir = selectedScans[0]?.scanDir;
1568
1595
  let publicationRepository = scanDir === undefined ? "scan" : basename(scanDir);
1569
1596
  if (scanDir === undefined) {
@@ -1772,6 +1799,21 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1772
1799
  });
1773
1800
  return { ...result };
1774
1801
  }
1802
+ if (options.to === "custom") {
1803
+ const result = await (dependencies.publishScanToCustom ?? publishScanToCustom)(resolveCliPath(currentDirectory, scanDir), {
1804
+ findingsUrl: options.findingsUrl,
1805
+ ...(options.workflowId === undefined
1806
+ ? {}
1807
+ : { workflowId: options.workflowId }),
1808
+ dryRun: options.dryRun,
1809
+ signal: controller.signal,
1810
+ ...(selectedScans[0]?.scanId === undefined
1811
+ ? {}
1812
+ : { expectedScanId: selectedScans[0].scanId }),
1813
+ });
1814
+ controller.signal.throwIfAborted();
1815
+ return { ...result };
1816
+ }
1775
1817
  const progress = new PublicationProgressPresenter(errorOutput, dependencies, publicationRepository);
1776
1818
  presentation = progress;
1777
1819
  dependencies.addSignalListener("SIGINT", onInterrupt);
@@ -1954,6 +1996,9 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
1954
1996
  }),
1955
1997
  options: z
1956
1998
  .object({
1999
+ workflowId: optionValue("--workflow-id")
2000
+ .optional()
2001
+ .describe("Reuse completed work in the named local findings workflow."),
1957
2002
  auth: z
1958
2003
  .enum(SCAN_AUTH_MODES)
1959
2004
  .default("auto")
@@ -2102,6 +2147,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
2102
2147
  }
2103
2148
  const outcome = await runScan({
2104
2149
  auth: options.auth,
2150
+ workflowId: options.workflowId,
2105
2151
  safetyIdentifier: options.safetyIdentifier,
2106
2152
  verbose: options.verbose,
2107
2153
  repository: args.repository,
@@ -2220,6 +2266,75 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
2220
2266
  .command(scanHistory)
2221
2267
  .command(findingFeedback)
2222
2268
  .command(publication)
2269
+ .command("dedupe", {
2270
+ description: "Review a saved scan with local Codex and save duplicate groups to the findings API.",
2271
+ destructive: true,
2272
+ mcp: false,
2273
+ options: z.object({
2274
+ workflowId: optionValue("--workflow-id")
2275
+ .optional()
2276
+ .describe("Resume the named local findings workflow; reuses its saved scan."),
2277
+ scan: optionValue("--scan")
2278
+ .optional()
2279
+ .describe("Saved scan ID, unique prefix, or latest."),
2280
+ allRepositories: z
2281
+ .boolean()
2282
+ .default(false)
2283
+ .describe("Search all repositories instead of only the saved scan's repository."),
2284
+ findingsUrl: z
2285
+ .string()
2286
+ .url()
2287
+ .describe("Findings API base URL; the scan's findings must already be indexed."),
2288
+ }),
2289
+ output: z
2290
+ .object({
2291
+ scanId: z.string(),
2292
+ uniqueFindingIds: z.array(z.string()),
2293
+ duplicateGroups: z.array(z.array(z.string())),
2294
+ deduplicationStatus: z.literal("completed"),
2295
+ })
2296
+ .optional(),
2297
+ async run({ options }) {
2298
+ const controller = new AbortController();
2299
+ const onInterrupt = () => controller.abort("SIGINT");
2300
+ const onTerminate = () => controller.abort("SIGTERM");
2301
+ dependencies.addSignalListener("SIGINT", onInterrupt);
2302
+ dependencies.addSignalListener("SIGTERM", onTerminate);
2303
+ try {
2304
+ const scanId = options.scan ??
2305
+ (options.workflowId === undefined
2306
+ ? undefined
2307
+ : (await resolveWorkflowScan(options.workflowId, dependencies))
2308
+ .scanId);
2309
+ if (scanId === undefined)
2310
+ throw new CodexSecurityError("Deduplication requires --scan or --workflow-id.");
2311
+ return await (dependencies.deduplicateScan ?? deduplicateScanInternal)(scanId, {
2312
+ findingsUrl: options.findingsUrl,
2313
+ ...(options.workflowId === undefined
2314
+ ? {}
2315
+ : { workflowId: options.workflowId }),
2316
+ allRepositories: options.allRepositories,
2317
+ signal: controller.signal,
2318
+ }, {
2319
+ environment: dependencies.environment,
2320
+ currentDirectory: dependencies.currentDirectory,
2321
+ runWorkbench: dependencies.runWorkbench,
2322
+ });
2323
+ }
2324
+ catch (error) {
2325
+ const signal = controller.signal.reason;
2326
+ errorOutput.write(`codex-security: ${signal === "SIGINT" || signal === "SIGTERM"
2327
+ ? "Deduplication canceled. Findings are unchanged."
2328
+ : safeErrorMessage(error)}\n`);
2329
+ exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 2;
2330
+ return undefined;
2331
+ }
2332
+ finally {
2333
+ dependencies.removeSignalListener("SIGINT", onInterrupt);
2334
+ dependencies.removeSignalListener("SIGTERM", onTerminate);
2335
+ }
2336
+ },
2337
+ })
2223
2338
  .command(imports)
2224
2339
  .command("scan-components", {
2225
2340
  description: "Run standard scans for project components and combine the results.",
@@ -3078,6 +3193,32 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
3078
3193
  await setCodexSecurityCredentialLogout(credentialHome, true);
3079
3194
  }
3080
3195
  },
3196
+ })
3197
+ .command("serve", {
3198
+ description: "Start the findings HTTP service (HOST=127.0.0.1, PORT=3000).",
3199
+ destructive: true,
3200
+ mcp: false,
3201
+ options: z.object({
3202
+ port: z
3203
+ .number()
3204
+ .int()
3205
+ .min(0)
3206
+ .max(65535)
3207
+ .optional()
3208
+ .describe("Listen port (default: PORT or 3000; 0 picks a free port)."),
3209
+ }),
3210
+ async run({ options }) {
3211
+ try {
3212
+ const { serveFindings } = await import("./server/serve.js");
3213
+ await serveFindings(options.port === undefined
3214
+ ? dependencies.environment
3215
+ : { ...dependencies.environment, PORT: String(options.port) }, output);
3216
+ }
3217
+ catch (error) {
3218
+ errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
3219
+ exitCode = 1;
3220
+ }
3221
+ },
3081
3222
  })
3082
3223
  .command("info", {
3083
3224
  description: "Show read-only SDK and bundled-plugin metadata.",
@@ -3292,6 +3433,7 @@ function validateCliArguments(argv, positionals) {
3292
3433
  "patch",
3293
3434
  "login",
3294
3435
  "logout",
3436
+ "serve",
3295
3437
  "info",
3296
3438
  ].includes(value));
3297
3439
  if (commandIndex < 0)
@@ -3306,7 +3448,7 @@ function validateCliArguments(argv, positionals) {
3306
3448
  argv[index + 1] === "json" ||
3307
3449
  argv[index + 1] === "jsonl")));
3308
3450
  if (structuredOutput &&
3309
- ["validate", "login", "logout"].includes(command) &&
3451
+ ["validate", "login", "logout", "serve"].includes(command) &&
3310
3452
  !argv.includes("--schema")) {
3311
3453
  return `${command} does not support noninteractive JSON output; run it without --json, --format json, or --format jsonl.`;
3312
3454
  }
@@ -3389,7 +3531,7 @@ function validateCliArguments(argv, positionals) {
3389
3531
  command !== "verify-fix" &&
3390
3532
  command !== "patch" &&
3391
3533
  positionals.length >
3392
- (command === "logout" || command === "info"
3534
+ (command === "logout" || command === "info" || command === "serve"
3393
3535
  ? 0
3394
3536
  : subcommand === "compare" || subcommand === "match"
3395
3537
  ? 2
@@ -3486,55 +3628,6 @@ async function* workbenchFindings(arguments_, dependencies) {
3486
3628
  offset = typeof page.nextOffset === "number" ? page.nextOffset : undefined;
3487
3629
  } while (offset !== undefined);
3488
3630
  }
3489
- async function resolvePublicationScan(requestedId, dependencies) {
3490
- let scanId = requestedId;
3491
- if (scanId === "latest") {
3492
- const history = await dependencies.runWorkbench([
3493
- "list-scans",
3494
- "--repository",
3495
- resolve(dependencies.currentDirectory()),
3496
- "--status",
3497
- "complete",
3498
- ]);
3499
- const scans = history["scans"];
3500
- const latest = Array.isArray(scans) ? scans[0] : undefined;
3501
- if (latest === undefined ||
3502
- !isJsonObject(latest) ||
3503
- typeof latest["scanId"] !== "string") {
3504
- throw new CodexSecurityError("No completed saved scan was found for this repository.");
3505
- }
3506
- scanId = latest["scanId"];
3507
- }
3508
- const context = await dependencies.runWorkbench([
3509
- "get-scan",
3510
- "--scan-id",
3511
- scanId,
3512
- ]);
3513
- const scan = context["scan"];
3514
- if (scan === undefined ||
3515
- !isJsonObject(scan) ||
3516
- typeof scan["scanId"] !== "string") {
3517
- throw new CodexSecurityError(`Could not read saved scan ${scanId}.`);
3518
- }
3519
- scanId = scan["scanId"];
3520
- const progress = scan["progress"];
3521
- if (progress === undefined ||
3522
- !isJsonObject(progress) ||
3523
- progress["status"] !== "complete") {
3524
- throw new CodexSecurityError(`Scan ${scanId} is not complete.`);
3525
- }
3526
- const storedDirectory = scan["scanDir"];
3527
- const scanDir = typeof storedDirectory === "string" && storedDirectory.length > 0
3528
- ? resolveCliPath(dependencies.currentDirectory(), storedDirectory)
3529
- : undefined;
3530
- const metadata = scanDir === undefined
3531
- ? undefined
3532
- : await lstat(scanDir).catch(() => undefined);
3533
- if (scanDir === undefined || metadata?.isDirectory() !== true) {
3534
- throw new CodexSecurityError(`Artifacts for scan ${scanId} are unavailable. Restore the completed scan artifacts or run a new scan.`);
3535
- }
3536
- return { ...scan, scanId, scanDir };
3537
- }
3538
3631
  async function selectSavedFindings(identifiers, requestedScanId, severity, dependencies) {
3539
3632
  if (identifiers.some((identifier) => !isFindingIdentifier(identifier))) {
3540
3633
  throw new CodexSecurityError("Saved scan patching accepts only finding identifiers.");
@@ -4709,6 +4802,9 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
4709
4802
  }
4710
4803
  security = dependencies.createSecurity(config);
4711
4804
  const options = {
4805
+ ...(arguments_.workflowId === undefined
4806
+ ? {}
4807
+ : { workflowId: arguments_.workflowId }),
4712
4808
  auth,
4713
4809
  safetyIdentifier: arguments_.safetyIdentifier,
4714
4810
  target,