@openai/codex-security 0.1.20 → 0.1.23

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 (187) hide show
  1. package/README.md +1101 -865
  2. package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
  3. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  4. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  5. package/_bundled_plugin/references/config-preflight.md +2 -30
  6. package/_bundled_plugin/references/core-scan.md +1 -1
  7. package/_bundled_plugin/references/final-report.md +1 -1
  8. package/_bundled_plugin/references/finding-detail-fields.md +5 -10
  9. package/_bundled_plugin/references/sarif-adapter.md +1 -1
  10. package/_bundled_plugin/schemas/patch-risk-assessment.schema.json +243 -0
  11. package/_bundled_plugin/scripts/config_preflight.py +2 -8
  12. package/_bundled_plugin/scripts/finalize_scan_contract.py +206 -35
  13. package/_bundled_plugin/scripts/finding_preview.py +22 -4
  14. package/_bundled_plugin/scripts/generate_in_scope_files.py +27 -1
  15. package/_bundled_plugin/scripts/launch_codex_security_mcp +0 -0
  16. package/_bundled_plugin/scripts/windows_scan_local_files.py +101 -7
  17. package/_bundled_plugin/scripts/workbench_cli.py +21 -1
  18. package/_bundled_plugin/scripts/workbench_dashboard.py +115 -0
  19. package/_bundled_plugin/scripts/workbench_db.py +29 -2
  20. package/_bundled_plugin/scripts/workbench_finding_index.py +42 -24
  21. package/_bundled_plugin/scripts/workbench_finding_workflows.py +190 -0
  22. package/_bundled_plugin/scripts/workbench_findings.py +216 -0
  23. package/_bundled_plugin/scripts/workbench_saved_results.py +30 -5
  24. package/_bundled_plugin/scripts/workbench_schema.py +263 -58
  25. package/_bundled_plugin/scripts/workbench_target.py +22 -3
  26. package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +88 -0
  27. package/_bundled_plugin/skills/assess-patch-risk/agents/openai.yaml +4 -0
  28. package/_bundled_plugin/skills/assess-patch-risk/references/risk-rubric.md +76 -0
  29. package/_bundled_plugin/skills/assess-patch-risk/scripts/validate_patch_risk_assessment.py +163 -0
  30. package/_bundled_plugin/skills/fix-finding/SKILL.md +16 -48
  31. package/_bundled_plugin/skills/track-findings/SKILL.md +2 -0
  32. package/dist/api.d.ts +3 -1
  33. package/dist/api.d.ts.map +1 -1
  34. package/dist/api.js +129 -45
  35. package/dist/api.js.map +1 -1
  36. package/dist/bulk-scan-discovery.d.ts.map +1 -1
  37. package/dist/bulk-scan-discovery.js +6 -24
  38. package/dist/bulk-scan-discovery.js.map +1 -1
  39. package/dist/cli.d.ts +28 -2
  40. package/dist/cli.d.ts.map +1 -1
  41. package/dist/cli.js +525 -96
  42. package/dist/cli.js.map +1 -1
  43. package/dist/cloud-publish.d.ts +5 -1
  44. package/dist/cloud-publish.d.ts.map +1 -1
  45. package/dist/cloud-publish.js +312 -10
  46. package/dist/cloud-publish.js.map +1 -1
  47. package/dist/component-plan.d.ts.map +1 -1
  48. package/dist/component-plan.js +5 -1
  49. package/dist/component-plan.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/finding-dedupe-groups.d.ts +7 -0
  85. package/dist/finding-dedupe-groups.d.ts.map +1 -0
  86. package/dist/finding-dedupe-groups.js +2 -0
  87. package/dist/finding-dedupe-groups.js.map +1 -0
  88. package/dist/finding-retrieval.d.ts +13 -0
  89. package/dist/finding-retrieval.d.ts.map +1 -0
  90. package/dist/finding-retrieval.js +2 -0
  91. package/dist/finding-retrieval.js.map +1 -0
  92. package/dist/finding-workflow.d.ts +53 -0
  93. package/dist/finding-workflow.d.ts.map +1 -0
  94. package/dist/finding-workflow.js +117 -0
  95. package/dist/finding-workflow.js.map +1 -0
  96. package/dist/findings-client.d.ts +15 -0
  97. package/dist/findings-client.d.ts.map +1 -0
  98. package/dist/findings-client.js +60 -0
  99. package/dist/findings-client.js.map +1 -0
  100. package/dist/github.d.ts +161 -0
  101. package/dist/github.d.ts.map +1 -0
  102. package/dist/github.js +158 -0
  103. package/dist/github.js.map +1 -0
  104. package/dist/index.d.ts +6 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +3 -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/publish.d.ts +10 -0
  111. package/dist/publish.d.ts.map +1 -1
  112. package/dist/publish.js +29 -5
  113. package/dist/publish.js.map +1 -1
  114. package/dist/runtime.d.ts +5 -4
  115. package/dist/runtime.d.ts.map +1 -1
  116. package/dist/runtime.js +371 -197
  117. package/dist/runtime.js.map +1 -1
  118. package/dist/saved-scan.d.ts +15 -0
  119. package/dist/saved-scan.d.ts.map +1 -0
  120. package/dist/saved-scan.js +68 -0
  121. package/dist/saved-scan.js.map +1 -0
  122. package/dist/scan-comparison.d.ts +6 -2
  123. package/dist/scan-comparison.d.ts.map +1 -1
  124. package/dist/scan-comparison.js +7 -2
  125. package/dist/scan-comparison.js.map +1 -1
  126. package/dist/server/dashboard/THIRD_PARTY_NOTICES.txt +276 -0
  127. package/dist/server/dashboard/app.css +2 -0
  128. package/dist/server/dashboard/app.js +66 -0
  129. package/dist/server/dashboard/index.html +18 -0
  130. package/dist/server/dashboard-types.d.ts +45 -0
  131. package/dist/server/dashboard-types.d.ts.map +1 -0
  132. package/dist/server/dashboard-types.js +2 -0
  133. package/dist/server/dashboard-types.js.map +1 -0
  134. package/dist/server/dashboard.d.ts +6 -0
  135. package/dist/server/dashboard.d.ts.map +1 -0
  136. package/dist/server/dashboard.js +45 -0
  137. package/dist/server/dashboard.js.map +1 -0
  138. package/dist/server/embeddings.d.ts +16 -0
  139. package/dist/server/embeddings.d.ts.map +1 -0
  140. package/dist/server/embeddings.js +114 -0
  141. package/dist/server/embeddings.js.map +1 -0
  142. package/dist/server/errors.d.ts +5 -0
  143. package/dist/server/errors.d.ts.map +1 -0
  144. package/dist/server/errors.js +8 -0
  145. package/dist/server/errors.js.map +1 -0
  146. package/dist/server/findings-service.d.ts +20 -0
  147. package/dist/server/findings-service.d.ts.map +1 -0
  148. package/dist/server/findings-service.js +31 -0
  149. package/dist/server/findings-service.js.map +1 -0
  150. package/dist/server/index.d.ts +2 -0
  151. package/dist/server/index.d.ts.map +1 -0
  152. package/dist/server/index.js +32 -0
  153. package/dist/server/index.js.map +1 -0
  154. package/dist/server/routes.d.ts +6 -0
  155. package/dist/server/routes.d.ts.map +1 -0
  156. package/dist/server/routes.js +86 -0
  157. package/dist/server/routes.js.map +1 -0
  158. package/dist/server/server.d.ts +10 -0
  159. package/dist/server/server.d.ts.map +1 -0
  160. package/dist/server/server.js +17 -0
  161. package/dist/server/server.js.map +1 -0
  162. package/dist/server/sqlite-store.d.ts +22 -0
  163. package/dist/server/sqlite-store.d.ts.map +1 -0
  164. package/dist/server/sqlite-store.js +82 -0
  165. package/dist/server/sqlite-store.js.map +1 -0
  166. package/dist/server/storage.d.ts +32 -0
  167. package/dist/server/storage.d.ts.map +1 -0
  168. package/dist/server/storage.js +2 -0
  169. package/dist/server/storage.js.map +1 -0
  170. package/dist/server/validation.d.ts +17 -0
  171. package/dist/server/validation.d.ts.map +1 -0
  172. package/dist/server/validation.js +53 -0
  173. package/dist/server/validation.js.map +1 -0
  174. package/dist/targets.d.ts.map +1 -1
  175. package/dist/targets.js +1 -0
  176. package/dist/targets.js.map +1 -1
  177. package/dist/thread-source.d.ts +8 -0
  178. package/dist/thread-source.d.ts.map +1 -0
  179. package/dist/thread-source.js +7 -0
  180. package/dist/thread-source.js.map +1 -0
  181. package/dist/trusted-executable.d.ts.map +1 -1
  182. package/dist/trusted-executable.js +2 -1
  183. package/dist/trusted-executable.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/dist/version.js.map +1 -1
  187. package/package.json +23 -8
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import importlib.util
6
+ import json
7
+ import sys
8
+ from pathlib import Path
9
+ from types import ModuleType
10
+ from typing import Any
11
+
12
+ PLUGIN_ROOT = Path(__file__).resolve().parents[3]
13
+ SCHEMA_PATH = PLUGIN_ROOT / "schemas" / "patch-risk-assessment.schema.json"
14
+ NON_APPLICABLE = {"no_live_effect", "wrong_owner", "duplicate", "superseded"}
15
+
16
+
17
+ def load_scan_contract_validator() -> ModuleType:
18
+ script = PLUGIN_ROOT / "scripts" / "finalize_scan_contract.py"
19
+ spec = importlib.util.spec_from_file_location("codex_security_scan_contract", script)
20
+ if spec is None or spec.loader is None:
21
+ raise RuntimeError(f"could not load scan contract validator: {script}")
22
+ module = importlib.util.module_from_spec(spec)
23
+ spec.loader.exec_module(module)
24
+ return module
25
+
26
+
27
+ SCAN_CONTRACT = load_scan_contract_validator()
28
+
29
+
30
+ def parse_args() -> argparse.Namespace:
31
+ parser = argparse.ArgumentParser(description="Validate a patch-risk assessment.")
32
+ parser.add_argument("assessment", help="Assessment JSON path, or - for stdin.")
33
+ return parser.parse_args()
34
+
35
+
36
+ def reject_duplicate_keys(pairs: list[tuple[str, Any]]) -> dict[str, Any]:
37
+ value: dict[str, Any] = {}
38
+ for key, item in pairs:
39
+ if key in value:
40
+ raise ValueError(f"duplicate JSON object key: {key}")
41
+ value[key] = item
42
+ return value
43
+
44
+
45
+ def read_object(path: str) -> dict[str, Any]:
46
+ try:
47
+ text = sys.stdin.read() if path == "-" else Path(path).read_text(encoding="utf-8")
48
+ value = json.loads(text, object_pairs_hook=reject_duplicate_keys)
49
+ except (OSError, json.JSONDecodeError) as error:
50
+ raise ValueError(f"cannot read assessment: {error}") from error
51
+ if not isinstance(value, dict):
52
+ raise ValueError("assessment must be a JSON object")
53
+ return value
54
+
55
+
56
+ def schema_errors(value: dict[str, Any]) -> list[str]:
57
+ try:
58
+ SCAN_CONTRACT.validate_against_schema(value, SCHEMA_PATH)
59
+ except (OSError, ValueError, RecursionError) as error:
60
+ return [str(error)]
61
+ return []
62
+
63
+
64
+ def semantic_errors(value: dict[str, Any]) -> list[str]:
65
+ recommendation = value["recommendation"]
66
+ workflow_label = value["workflowLabel"]
67
+ unknowns = value["unknowns"]
68
+ evidence_plan = value["evidencePlan"]
69
+ boundaries = value["materialBoundaries"]
70
+ applicability_status = value["applicability"]["status"]
71
+ affirmative_failure = (
72
+ value["regressionLikelihood"]["rating"] == "critical"
73
+ or any(item["result"] == "contradicted" for item in boundaries)
74
+ or any(item["status"] == "failed" for item in value["validation"])
75
+ )
76
+ errors: list[str] = []
77
+
78
+ if recommendation == "merge":
79
+ if workflow_label not in {"auto_merge_candidate", "human_review_required"}:
80
+ errors.append("merge requires an auto-merge or human-review workflow label")
81
+ if value["applicability"]["status"] != "confirmed":
82
+ errors.append("merge requires confirmed applicability")
83
+ if any(item["decisionCritical"] for item in unknowns):
84
+ errors.append("merge cannot retain a decision-critical unknown")
85
+ if any(item["result"] != "supported" for item in boundaries):
86
+ errors.append("merge requires every material boundary to be supported")
87
+ if any(item["status"] == "failed" for item in value["validation"]):
88
+ errors.append("merge cannot retain a failed validation")
89
+ if evidence_plan:
90
+ errors.append("merge cannot retain an evidence plan")
91
+ elif workflow_label != recommendation:
92
+ errors.append("non-merge workflow label must match the recommendation")
93
+
94
+ if recommendation == "hold_for_evidence":
95
+ if not any(item["decisionCritical"] for item in unknowns):
96
+ errors.append("hold_for_evidence requires a decision-critical unknown")
97
+ if not evidence_plan:
98
+ errors.append("hold_for_evidence requires a bounded evidence plan")
99
+ if affirmative_failure:
100
+ errors.append("hold_for_evidence cannot defer an established defect")
101
+ elif evidence_plan:
102
+ errors.append("only hold_for_evidence may include an evidence plan")
103
+
104
+ if recommendation == "no_op":
105
+ if applicability_status not in NON_APPLICABLE:
106
+ errors.append("no_op requires an established non-applicable disposition")
107
+ if any(item["decisionCritical"] for item in unknowns):
108
+ errors.append("no_op cannot retain a decision-critical unknown")
109
+ elif applicability_status in NON_APPLICABLE:
110
+ errors.append("an established non-applicable disposition requires no_op")
111
+
112
+ if recommendation in {"revise", "block"}:
113
+ if not affirmative_failure:
114
+ errors.append(f"{recommendation} requires affirmative failure evidence")
115
+
116
+ if workflow_label == "auto_merge_candidate":
117
+ auto_merge_requirements = {
118
+ "impact.rating": value["impact"]["rating"] == "low",
119
+ "regressionLikelihood.rating": value["regressionLikelihood"]["rating"] == "low",
120
+ "regressionProtection.rating": value["regressionProtection"]["rating"] == "strong",
121
+ "regressionProtection.exactHeadChecksPassed": value["regressionProtection"][
122
+ "exactHeadChecksPassed"
123
+ ],
124
+ "recoverability.rating": value["recoverability"]["rating"] == "easy",
125
+ "confidence.rating": value["confidence"]["rating"] == "high",
126
+ "applicability.status": value["applicability"]["status"] == "confirmed",
127
+ "affectedRuntimeRoots": bool(value["affectedRuntimeRoots"]),
128
+ "statusQuoRisk.rating": value["statusQuoRisk"]["rating"] != "unknown",
129
+ "autoMergeExclusions": not value["autoMergeExclusions"],
130
+ "unknowns": not unknowns,
131
+ "validation": all(item["status"] == "passed" for item in value["validation"]),
132
+ }
133
+ for field, passed in auto_merge_requirements.items():
134
+ if not passed:
135
+ errors.append(f"auto_merge_candidate gate failed: {field}")
136
+
137
+ return errors
138
+
139
+
140
+ def validate(value: dict[str, Any]) -> list[str]:
141
+ errors = schema_errors(value)
142
+ if errors:
143
+ return errors
144
+ return semantic_errors(value)
145
+
146
+
147
+ def main() -> int:
148
+ args = parse_args()
149
+ try:
150
+ value = read_object(args.assessment)
151
+ errors = validate(value)
152
+ except ValueError as error:
153
+ print(error, file=sys.stderr)
154
+ return 1
155
+ if errors:
156
+ for error in errors:
157
+ print(error, file=sys.stderr)
158
+ return 1
159
+ return 0
160
+
161
+
162
+ if __name__ == "__main__":
163
+ raise SystemExit(main())
@@ -22,25 +22,14 @@ Never trade an earlier property for a later one. Minimal means the smallest repo
22
22
 
23
23
  ## Patch Contract
24
24
 
25
- Before editing, establish from repository evidence:
25
+ Before editing, inspect the affected implementation, its direct callers, nearby helpers, and relevant existing tests. Establish from repository evidence:
26
26
 
27
- - affected component and current source-to-sink path or broken control
28
- - attacker-controlled input and required preconditions
29
- - security invariant and narrowest plausible enforcement boundary
30
- - legitimate behavior, APIs, error semantics, and compatibility constraints to preserve or intentionally change with supporting product evidence
31
- - available PoC, reproducer, tests, evidence, and affected locations
32
- - nearest relevant helpers and implementation, error-handling, and test precedents
27
+ - the attacker-controlled input and concrete source-to-sink path or broken control
28
+ - the security invariant and narrowest shared enforcement boundary
29
+ - legitimate behavior, APIs, error semantics, and compatibility constraints that must remain
30
+ - the closest existing implementation, validation, and error-handling precedents
33
31
 
34
- Inspect the repository to fill gaps. Ask the user only when a material product, security, or compatibility decision remains.
35
-
36
- ## Runtime Validation
37
-
38
- Use this guidance whenever reproducing the finding, running tests, or validating the fix:
39
-
40
- - Complete the patch contract before broad setup; start with the smallest high-signal check through the real vulnerable boundary.
41
- - Use repository-supported setup commands. Keep repair effort bounded so it does not displace path analysis, patching, or focused verification.
42
- - Do not stop a progressing command merely because it is slow. Inspect process state, logs, artifacts, or resource use first.
43
- - If runtime validation remains unavailable, use the strongest targeted static or harness-based artifact that preserves the real integration boundary. Do not substitute a simplified harness that removes the behavior being protected. Record every unrun check as unknown.
32
+ Treat the finding as a data-flow and boundary problem, not merely the named input example. Check equivalent encodings, parser forms, aliases, callers, sinks, and every representation or copy of security-sensitive state that could bypass the proposed change. Handle unsafe state explicitly; do not silently accept, truncate, or reinterpret it into another reachable form.
44
33
 
45
34
  ## Pre-Patch Investigation
46
35
 
@@ -52,37 +41,16 @@ The investigation requires repository-relative evidence and a clear separation b
52
41
 
53
42
  ## Implementation Workflow
54
43
 
55
- 1. Revalidate and scope the finding.
56
- - Inspect repository instructions, affected code, direct callers, and only the context needed to prove the vulnerable path.
57
- - Establish concrete reachability in the current checkout; generic weakness labels, file anchors, and suspicious-looking code are not proof.
58
- - If the same broken security boundary cannot be shown after a bounded investigation, do not patch an adjacent weakness or add speculative defense in depth. Return `no_change` when evidence shows the path is already safe; otherwise return `blocked` with the missing proof.
59
- - Complete the patch contract and inspect relevant helpers, controls, and implementation and test precedents.
60
- 2. Reproduce or encode the issue before fixing when feasible.
61
- - Prefer a failing regression test, unit test, integration test, property test, or realistic-interface reproduction.
62
- - Capture the malicious condition and at least one legitimate control through the same boundary before implementation.
63
- - Keep an unsafe-behavior test only when it is safe, deterministic, and appropriate for the repository. Otherwise use the strongest repeatable validation artifact available and record the gap.
64
- - If the issue no longer reproduces before any code changes, investigate whether it was already fixed and preserve the validation evidence.
65
- 3. Choose the patch strategy.
66
- - Determine whether a narrow tactical change can close the boundary while preserving the patch contract.
67
- - Consider broader remediation only when the narrow option cannot close the boundary without breaking supported behavior. Remove or disable functionality only when repository or product evidence supports that mitigation.
68
- - If the only complete fix requires an unresolved decision about product policy, public-API compatibility, or cross-subsystem ownership, return `blocked` with the options, security tradeoff, and likely owner or codeowner when available.
69
- - Use nearby variants to test the chosen boundary. Report unrelated sibling findings or longer-term architectural work separately instead of expanding this patch.
70
- 4. Implement the fix and its proof.
71
- - Make the smallest repository-native change that fully enforces the invariant.
72
- - Prefer existing helpers and abstractions. Preserve APIs, legitimate inputs, and error semantics unless changing them is required by the security contract.
73
- - Handle unsafe state explicitly; do not silently accept, truncate, or reinterpret it.
74
- - Avoid unrelated refactors and preserve user changes outside the candidate patch.
75
- - Add focused regression coverage that fails on the vulnerable behavior and passes after the fix.
76
- - Include positive coverage for the legitimate control. Test at the lowest level that proves the invariant and through the realistic interface when feasible.
77
- 5. Verify in order.
78
- - **Applicability and buildability**: inspect the final diff for unrelated changes, then run the narrowest relevant syntax, import, build, type, or focused test check.
79
- - **Security closure**: rerun the original PoC, trigger, or strongest exploit check. Re-trace the source-to-sink or broken-control path in the patched code.
80
- - **Change-aware bypass review**: reread the finding and final diff without relying on the original rationale. Trace changed branches from direct callers, check equivalent sinks, and exercise an alternate malicious input class when practical.
81
- - **Preserved behavior**: rerun the legitimate control and confirm the recorded APIs, error semantics, and compatibility constraints remain intact.
82
- - **Repository checks**: run the focused regression tests, the owning package's relevant tests, and applicable formatter, linter, type checker, dependency, and integration checks.
83
- - Confirm the regression check would fail if the security change were removed, when practical.
84
- - Treat a failed earlier gate as disqualifying. Revise only the candidate changes or return `blocked`; never compensate for failed security closure or behavior preservation with style, smaller scope, or additional reporting.
85
- 6. Report the outcome with exact commands, results, changed files, and remaining risk.
44
+ 1. Trace the reported path and inspect only the context needed to identify the real shared boundary. Return `no_change` when repository evidence shows that the reported path is already safe; do not make a speculative change.
45
+ 2. When feasible, run the smallest high-signal reproduction through that boundary and one legitimate control through the same path.
46
+ 3. Implement the smallest repository-native fix at the shared boundary. Prefer nearby helpers and established APIs. Do not broaden into unrelated redesign, cleanup, or sibling findings.
47
+ 4. Before verification, challenge the patch rather than defending it: inspect every direct caller of each changed helper and both outcomes of each changed condition. Look for one sibling path, representation, or copy that still reaches the vulnerable sink and one ordinary or default input that the patch newly rejects or reinterprets; revise the implementation if either exists.
48
+ 5. Verify in order:
49
+ - inspect the final diff and run the narrowest syntax, import, build, or type check relevant to it
50
+ - rerun the security trigger or strongest focused substitute and review one alternate malicious input class
51
+ - rerun the legitimate control, nearest existing tests, and the owning package's applicable required checks
52
+
53
+ Return `blocked` if the vulnerability may be real, but essential evidence, tooling, access, or a product or compatibility decision is missing, so a safe fix cannot be responsibly completed or verified.
86
54
 
87
55
  ## Patch Candidate Review
88
56
 
@@ -132,6 +132,8 @@ Treat failed requests, incomplete exact-identifier searches, unread plausible ma
132
132
 
133
133
  ### 4. Preview The Exact Writes
134
134
 
135
+ Follow the Writing Rules in `../../references/finding-detail-fields.md`. Explain the problem, how to reproduce it, the cause, the proposed fix, and validation. Put source locations and scan identifiers last.
136
+
135
137
  Present a compact review before any mutation. For every finding show:
136
138
 
137
139
  - finding id and fingerprint
package/dist/api.d.ts CHANGED
@@ -16,6 +16,8 @@ export interface DeepScanOptions {
16
16
  maxTimeHours?: number;
17
17
  }
18
18
  export interface ScanOptions extends DeepScanOptions {
19
+ /** Opt into a durable scan -> custom publication -> dedupe workflow. */
20
+ workflowId?: string;
19
21
  auth?: ScanAuthMode;
20
22
  /** Stable, privacy-preserving end-user ID for this scan's model requests. */
21
23
  safetyIdentifier?: string;
@@ -127,7 +129,7 @@ export declare function createSecurityInternal(config: CodexSecurityConfig | und
127
129
  export declare function initialCredentialsAvailable(environment: ProcessEnvironment, ambientHome: string, isolatedHome: string, importer?: typeof importAmbientAuth): Promise<boolean>;
128
130
  export declare function scanAuthentication(environment: ProcessEnvironment, auth?: ScanAuthMode, modelProvider?: unknown): ScanAuthentication;
129
131
  export declare function classifyConnectionFailure(error: unknown): "rate_limited" | "unauthorized" | "forbidden" | "network_error" | "timeout" | "unknown";
130
- export declare function scanRuntimeCodexConfig(config: JsonObject, stateDirectory: string, protectedCredentialHome?: string): JsonObject;
132
+ export declare function scanRuntimeCodexConfig(config: JsonObject, protectedCredentialHome?: string): JsonObject;
131
133
  export declare function scanPreflightCodexConfig(config: JsonObject): JsonObject;
132
134
  export declare function environmentValue(environment: ProcessEnvironment, requested: string): string | undefined;
133
135
  export {};
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AA2BA,OAAO,EAEL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AA6BnB,OAAO,EACL,UAAU,EAGX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMhF,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAUL,iBAAiB,EAgBjB,KAAK,kBAAkB,EAGxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,UAAU,EAIhB,MAAM,cAAc,CAAC;AAqDtB,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM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AM,EAAE,UAAU,EAClB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,UAAU,CAsCZ;AA8BD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAyHvE;AAsDD,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,EAC/B,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAcpB"}
package/dist/api.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /// <reference lib="esnext.disposable" preserve="true" />
2
- import { chmod, lstat, mkdir, readFile, realpath, rename, rm, writeFile, } from "node:fs/promises";
2
+ import { chmod, lstat, mkdir, readFile, realpath, rm, writeFile, } from "node:fs/promises";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { homedir, tmpdir } from "node:os";
5
- import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
5
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep, } from "node:path";
6
6
  import { Codex, } from "@openai/codex-sdk";
7
7
  import { parse as parseToml, stringify as stringifyToml, } from "smol-toml";
8
8
  import { z } from "incur";
@@ -10,17 +10,19 @@ import { accountStatus, CodexLoginHandle, loginApiKey as persistApiKey, logout a
10
10
  import { jsonForPrompt, pluginPythonCommand, shellEnvironmentReference, } from "./codex-prompt.js";
11
11
  import { EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanApprovalPolicy, scanModelConfiguration, scanModelProvider, writeCodexConfig, } from "./config.js";
12
12
  import { estimateScanCost, ScanCostTracker, sumTokenUsage, } from "./cost.js";
13
- import { loadContract, requireScanFile, } from "./contract.js";
13
+ import { loadContract, readScanFile, requireScanFile, } from "./contract.js";
14
14
  import { runCustomValidation, writeCustomValidationStatus, } from "./custom-validation.js";
15
15
  import { customDiscoveryPrompt, customValidationConfig, } from "./custom-validation-prompt.js";
16
16
  import { AuthenticationRequiredError, CodexSecurityError, ConfigurationError, IncompleteScanError, OutputDirectoryError, errorMessage, safeErrorMessage, ScanCostLimitExceededError, ScanInterruptedError, } from "./errors.js";
17
17
  import { prepareKnowledgeBase, } from "./knowledge-base.js";
18
+ import { FindingWorkflow, workflowDigest } from "./finding-workflow.js";
18
19
  import { ScanResult, } from "./result.js";
19
20
  import { scanActivitiesFromEvent } from "./scan-activity.js";
20
21
  import { matchCompletedScan, matchScanFindingsInternal, } from "./scan-comparison.js";
21
22
  import { scanProgressUpdatesFromEvent, workerStatusFromEvent, } from "./worker-progress.js";
23
+ import { CODEX_SECURITY_THREAD_SOURCES } from "./thread-source.js";
22
24
  import { CODEX_EXECUTABLE_VERSION, CODEX_SDK_VERSION } from "./version.js";
23
- import { acquireCodexSecurityCredentialHomeLock, bootstrapPlugin, cleanupSdkDirectory, codexSecurityCredentialAllowsAmbientImport, codexSecurityCredentialHome, codexSecurityHasStoredFileCredentials, codexSecurityStateDirectory, createIsolatedHome, expandHome, importAmbientAuth, prepareCodexSecurityCredentialHome, preserveCodexSecurityPluginRegistration, pluginExecutionEnvironment, planOutputArchive, prepareOutputDir, preparePersistentOutputRoot, requireModelSafeOutputDir, requireOutputOutsideRepository, resolveCodexCommand, resolvePluginPath, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, validateOutputDir, } from "./runtime.js";
25
+ import { acquireCodexSecurityCredentialHomeLock, bootstrapPlugin, bundledPluginRoot, cleanupSdkDirectory, codexSecurityCredentialAllowsAmbientImport, codexSecurityCredentialHome, codexSecurityHasStoredFileCredentials, codexSecurityStateDirectory, createIsolatedHome, expandHome, importAmbientAuth, prepareCodexSecurityCredentialHome, preserveCodexSecurityPluginRegistration, pluginExecutionEnvironment, planOutputArchive, prepareScanArtifactRestorer, prepareOutputDir, preparePersistentOutputRoot, requireModelSafeOutputDir, requireOutputOutsideRepository, resolveCodexCommand, resolvePluginPath, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, validateOutputDir, } from "./runtime.js";
24
26
  import { enclosingGitWorktreeRoot, normalizeRepository, normalizeTarget, repositoryRevision, resolveRepositoryPath, validatedGitEnvironment, validateCommittedDiffCheckout, validateMode, } from "./targets.js";
25
27
  const DEEP_SCAN_CONFIG_PATH_ENVIRONMENT = "CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH";
26
28
  const VALIDATION_DISPOSITIONS = [
@@ -75,7 +77,94 @@ export class CodexSecurity {
75
77
  this.#surface = runtimeOptions.surface;
76
78
  }
77
79
  async run(repository, options = {}) {
78
- return await this.#trackOperation(() => this.#run(repository, { ...options }));
80
+ return await this.#trackOperation(() => options.workflowId === undefined
81
+ ? this.#run(repository, { ...options })
82
+ : this.#runWorkflow(repository, { ...options }, options.workflowId));
83
+ }
84
+ async #runWorkflow(repository, options, workflowId) {
85
+ this.#requireOpen();
86
+ const signal = AbortSignal.any([
87
+ this.#abortController.signal,
88
+ ...(options.signal ? [options.signal] : []),
89
+ ]);
90
+ const local = await this.#validateLocalInputs(repository, { ...options, outputDir: undefined, archiveExisting: false }, signal);
91
+ const workflow = new FindingWorkflow(workflowId, this.#dependencies.environment, this.#dependencies.runWorkbench, this.config.pythonPath);
92
+ if (options.outputDir !== undefined)
93
+ await workflow.protectArtifacts(options.outputDir);
94
+ const state = await workflow.bind({
95
+ repositoryPath: local.repository,
96
+ scanRequestDigest: workflowDigest({
97
+ config: this.config,
98
+ options: {
99
+ ...options,
100
+ target: options.target ?? "repository",
101
+ mode: options.mode ?? "standard",
102
+ outputDir: options.outputDir === undefined
103
+ ? undefined
104
+ : resolve(expandHome(options.outputDir)),
105
+ workflowId: undefined,
106
+ signal: undefined,
107
+ auth: undefined,
108
+ archiveExisting: undefined,
109
+ },
110
+ }),
111
+ });
112
+ if (state.scanId && state.scanDir) {
113
+ await workflow.protectArtifacts(state.scanDir);
114
+ let metadata = state.stages.scan.result;
115
+ let completed = state.stages.scan.status === "completed";
116
+ if (!completed) {
117
+ const scan = await workflow.registeredScan(state.scanId);
118
+ completed =
119
+ scan["progress"]?.["status"] ===
120
+ "complete";
121
+ if (completed)
122
+ metadata = {
123
+ threadId: scan["continuationThreadId"] ?? "",
124
+ turnResult: { status: "completed" },
125
+ };
126
+ }
127
+ if (completed) {
128
+ const contract = await loadContract(state.scanDir, {
129
+ pluginRoot: await bundledPluginRoot(),
130
+ expectedScanId: state.scanId,
131
+ signal,
132
+ });
133
+ await workflow.bind({ artifactDigest: workflowDigest(contract) });
134
+ metadata ??= { threadId: "", turnResult: { status: "completed" } };
135
+ await workflow.complete("scan", metadata);
136
+ return new ScanResult({
137
+ ...contract,
138
+ scanDir: state.scanDir,
139
+ ...metadata,
140
+ });
141
+ }
142
+ }
143
+ await workflow.begin("scan");
144
+ try {
145
+ const result = await this.#run(repository, options);
146
+ await workflow.protectArtifacts(result.scanDir);
147
+ await workflow.bind({
148
+ scanId: result.manifest.scan.id,
149
+ scanDir: result.scanDir,
150
+ artifactDigest: workflowDigest({
151
+ manifest: result.manifest,
152
+ findings: result.findings,
153
+ coverage: result.coverage,
154
+ }),
155
+ });
156
+ await workflow.complete("scan", {
157
+ threadId: result.threadId,
158
+ turnResult: result.turnResult,
159
+ sarifPath: result.sarifPath,
160
+ repositoryFindings: result.repositoryFindings,
161
+ });
162
+ return result;
163
+ }
164
+ catch (error) {
165
+ await workflow.fail("scan", error);
166
+ throw error;
167
+ }
79
168
  }
80
169
  async validate(options) {
81
170
  return await this.#trackOperation(() => this.#validate(options));
@@ -115,6 +204,7 @@ export class CodexSecurity {
115
204
  CODEX_SECURITY_SURFACE: this.#surface,
116
205
  }, options.auth);
117
206
  const thread = codex.startThread({
207
+ threadSource: CODEX_SECURITY_THREAD_SOURCES.validation,
118
208
  workingDirectory: outputDir,
119
209
  skipGitRepoCheck: true,
120
210
  approvalPolicy,
@@ -216,6 +306,8 @@ export class CodexSecurity {
216
306
  let preparedTargetWarnings = [];
217
307
  let runPostScan = null;
218
308
  let activeScan = null;
309
+ const prepareArtifactRestorer = this.#dependencies.prepareScanArtifactRestorer ??
310
+ prepareScanArtifactRestorer;
219
311
  const workbench = this.#dependencies.runWorkbench ?? runWorkbench;
220
312
  try {
221
313
  const checkOpen = () => {
@@ -236,7 +328,7 @@ export class CodexSecurity {
236
328
  knowledgeBase = await prepareKnowledgeBase(options.knowledgeBasePaths, signal);
237
329
  }
238
330
  checkOpen();
239
- const session = await this.#prepareSession({ protectedRoot, stateDirectory }, options, signal, temporaryRoot, mode === "deep");
331
+ const session = await this.#prepareSession({ protectedRoot }, options, signal, temporaryRoot, mode === "deep");
240
332
  const { runtime, runtimeHome, effectiveConfig, preflightConfig, modelProvider, authentication, approvalPolicy, python, } = session;
241
333
  releaseCredentialHome = session.releaseCredentialHome;
242
334
  const deepScanConfigPath = mode === "deep"
@@ -372,7 +464,13 @@ export class CodexSecurity {
372
464
  ...(options.parentScanId === undefined
373
465
  ? []
374
466
  : ["--parent-scan-id", options.parentScanId]),
375
- ], JSON.stringify({ recipe, userContext: options.scanPrompt }));
467
+ ], JSON.stringify({
468
+ recipe,
469
+ userContext: options.scanPrompt,
470
+ ...(options.workflowId === undefined
471
+ ? {}
472
+ : { workflowId: options.workflowId }),
473
+ }));
376
474
  const scanId = registration["scanId"];
377
475
  const targetId = registration["targetId"];
378
476
  const contract = registration["contract"];
@@ -502,6 +600,7 @@ export class CodexSecurity {
502
600
  };
503
601
  const { codex, environment } = this.#createSessionCodex(session, runtimePaths, options.auth);
504
602
  const thread = codex.startThread({
603
+ threadSource: CODEX_SECURITY_THREAD_SOURCES.scan,
505
604
  workingDirectory: scanDir,
506
605
  skipGitRepoCheck: true,
507
606
  approvalPolicy,
@@ -571,6 +670,7 @@ export class CodexSecurity {
571
670
  filesTotal: scopeFileCount,
572
671
  });
573
672
  const validationThread = codex.startThread({
673
+ threadSource: CODEX_SECURITY_THREAD_SOURCES.scan,
574
674
  workingDirectory: join(scanDir, "artifacts"),
575
675
  skipGitRepoCheck: true,
576
676
  approvalPolicy,
@@ -695,9 +795,11 @@ export class CodexSecurity {
695
795
  ]),
696
796
  ].map(async (name) => ({
697
797
  name,
698
- contents: await readFile(await requireScanFile(scanDir, name, name, signal), { signal }),
798
+ contents: await readScanFile(scanDir, name, name, signal),
699
799
  })));
800
+ let artifactRestorer = null;
700
801
  try {
802
+ artifactRestorer = await prepareArtifactRestorer(workbenchOptions, scanDir);
701
803
  await runScanEvents({
702
804
  thread,
703
805
  events: (await followUp()).events,
@@ -715,26 +817,16 @@ export class CodexSecurity {
715
817
  catch (error) {
716
818
  if (signal.aborted || this.#closed)
717
819
  throw error;
718
- for (const artifact of completedArtifacts) {
719
- const path = join(scanDir, artifact.name);
720
- const current = await readFile(path, { signal }).catch((readError) => {
721
- if (readError.code !== "ENOENT")
722
- throw readError;
723
- return null;
724
- });
725
- if (current?.equals(artifact.contents))
726
- continue;
727
- const temporary = join(dirname(path), `.${randomUUID()}.${basename(path)}.restore`);
728
- try {
729
- await writeFile(temporary, artifact.contents, {
730
- flag: "wx",
731
- mode: 0o600,
732
- signal,
733
- });
734
- await rename(temporary, path);
735
- }
736
- finally {
737
- await rm(temporary, { force: true });
820
+ if (artifactRestorer !== null) {
821
+ for (const artifact of completedArtifacts) {
822
+ try {
823
+ await artifactRestorer.restore(artifact.name, artifact.contents);
824
+ }
825
+ catch (cause) {
826
+ if (signal.aborted || this.#closed)
827
+ throw cause;
828
+ throw new OutputDirectoryError("Cannot restore an artifact outside the scan directory.", { cause });
829
+ }
738
830
  }
739
831
  }
740
832
  await collectResult(result.turnResult, result.threadId, scanDir, runtime.plugin.installedRoot, expectation, signal, true);
@@ -888,15 +980,8 @@ export class CodexSecurity {
888
980
  warnCleanupFailed(options, error);
889
981
  }
890
982
  finally {
891
- // The startup lock is normally released before workbench registration and Codex
892
- // execution. This fallback covers failures during runtime preparation or
893
- // authentication. The release only marks itself done once the lock directory is
894
- // gone, so a failure leaves an owner.json naming this still-running process;
895
- // recoverStaleCredentialHomeLock then refuses to reclaim it because that pid is
896
- // alive, and later scans in this process wait on a lock nothing frees. Reporting
897
- // success while leaving the client in that state is worse than failing, so the
898
- // failure is only downgraded to a warning when the scan already failed and that
899
- // error is the one worth keeping.
983
+ // Release any remaining startup lock, but preserve the scan's error if both
984
+ // the scan and lock cleanup fail.
900
985
  try {
901
986
  await releaseCredentialHome?.();
902
987
  }
@@ -1084,7 +1169,7 @@ export class CodexSecurity {
1084
1169
  });
1085
1170
  return { codex, environment };
1086
1171
  }
1087
- async #prepareSession({ protectedRoot, stateDirectory, }, options, signal, temporaryRoot, keepCredentialLock = false) {
1172
+ async #prepareSession({ protectedRoot }, options, signal, temporaryRoot, keepCredentialLock = false) {
1088
1173
  let releaseCredentialHome = null;
1089
1174
  const checkOpen = () => {
1090
1175
  this.#requireOpen();
@@ -1122,7 +1207,7 @@ export class CodexSecurity {
1122
1207
  }
1123
1208
  const runtimeHome = await realpath(runtime.codexHome);
1124
1209
  requireOutputOutsideRepository(protectedRoot, runtimeHome, "runtime");
1125
- const sessionConfig = scanRuntimeCodexConfig(effectiveConfig, stateDirectory, runtimeHome);
1210
+ const sessionConfig = scanRuntimeCodexConfig(effectiveConfig, runtimeHome);
1126
1211
  if (options.expectedPluginVersion !== undefined &&
1127
1212
  runtime.plugin.version !== options.expectedPluginVersion) {
1128
1213
  throw new CodexSecurityError(`The original scan used plugin version ${options.expectedPluginVersion}, but the installed version is ${runtime.plugin.version}.`);
@@ -1233,7 +1318,7 @@ export class CodexSecurity {
1233
1318
  }
1234
1319
  async #refreshPersistentRuntime(runtime, environment, signal, mergedConfig) {
1235
1320
  throwIfAborted(signal);
1236
- const config = await preserveCodexSecurityPluginRegistration(runtime.codexHome, sharedCredentialCodexConfig(mergedConfig, codexSecurityStateDirectory(environment), runtime.codexHome));
1321
+ const config = await preserveCodexSecurityPluginRegistration(runtime.codexHome, sharedCredentialCodexConfig(mergedConfig, runtime.codexHome));
1237
1322
  await writeCodexConfig(join(runtime.codexHome, "config.toml"), config);
1238
1323
  runtime.plugin = await bootstrapPlugin(runtime.codexHome, runtime.plugin.pluginRoot, {
1239
1324
  codexCommand: this.#codexCommand(),
@@ -1331,7 +1416,7 @@ export class CodexSecurity {
1331
1416
  const configuredAmbientHome = environmentValue(processEnvironment, "CODEX_HOME");
1332
1417
  const ambientHome = configuredAmbientHome ?? nodeAmbientHome;
1333
1418
  const mergedConfig = requestedConfig ?? (await mergedCodexConfig(this.config));
1334
- const codexConfig = await preserveCodexSecurityPluginRegistration(codexHome, sharedCredentialCodexConfig(mergedConfig, codexSecurityStateDirectory(processEnvironment), codexHome));
1419
+ const codexConfig = await preserveCodexSecurityPluginRegistration(codexHome, sharedCredentialCodexConfig(mergedConfig, codexHome));
1335
1420
  await writeCodexConfig(join(codexHome, "config.toml"), codexConfig);
1336
1421
  const configPath = join(bootstrapWorkspace, "config-preflight.toml");
1337
1422
  throwIfAborted(signal);
@@ -2040,7 +2125,7 @@ export function classifyConnectionFailure(error) {
2040
2125
  return "timeout";
2041
2126
  return "unknown";
2042
2127
  }
2043
- export function scanRuntimeCodexConfig(config, stateDirectory, protectedCredentialHome) {
2128
+ export function scanRuntimeCodexConfig(config, protectedCredentialHome) {
2044
2129
  const approvalPolicy = scanApprovalPolicy(config);
2045
2130
  const hardened = structuredClone(config);
2046
2131
  delete hardened["sandbox_mode"];
@@ -2072,7 +2157,6 @@ export function scanRuntimeCodexConfig(config, stateDirectory, protectedCredenti
2072
2157
  filesystem: {
2073
2158
  ":root": "read",
2074
2159
  ":workspace_roots": "write",
2075
- [stateDirectory]: "write",
2076
2160
  ...(protectedCredentialHome === undefined
2077
2161
  ? {}
2078
2162
  : { [protectedCredentialHome]: "read" }),
@@ -2081,7 +2165,7 @@ export function scanRuntimeCodexConfig(config, stateDirectory, protectedCredenti
2081
2165
  },
2082
2166
  };
2083
2167
  }
2084
- function sharedCredentialCodexConfig(config, stateDirectory, credentialHome) {
2168
+ function sharedCredentialCodexConfig(config, credentialHome) {
2085
2169
  const shared = {
2086
2170
  approval_policy: scanApprovalPolicy(config),
2087
2171
  features: { plugins: true },
@@ -2104,7 +2188,7 @@ function sharedCredentialCodexConfig(config, stateDirectory, credentialHome) {
2104
2188
  };
2105
2189
  }
2106
2190
  }
2107
- return scanRuntimeCodexConfig(shared, stateDirectory, credentialHome);
2191
+ return scanRuntimeCodexConfig(shared, credentialHome);
2108
2192
  }
2109
2193
  export function scanPreflightCodexConfig(config) {
2110
2194
  const safeString = (value) => typeof value === "string" &&