@openai/codex-security 0.1.10 → 0.1.11

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 (55) hide show
  1. package/README.md +27 -13
  2. package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
  3. package/_bundled_plugin/.mcp.json +3 -1
  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/scripts/deep_scan_config.py +21 -1
  7. package/_bundled_plugin/scripts/deep_scan_workbench.py +44 -14
  8. package/_bundled_plugin/scripts/finalize_scan_contract.py +15 -207
  9. package/_bundled_plugin/scripts/generate_in_scope_files.py +40 -16
  10. package/_bundled_plugin/scripts/generate_rank_input.py +38 -5
  11. package/_bundled_plugin/scripts/rank_preview.py +4 -0
  12. package/_bundled_plugin/scripts/report_projection.py +39 -1
  13. package/_bundled_plugin/scripts/workbench_cli.py +5 -0
  14. package/_bundled_plugin/scripts/workbench_db.py +283 -4
  15. package/_bundled_plugin/scripts/workbench_schema.py +15 -0
  16. package/_bundled_plugin/scripts/workbench_source_excerpt.py +1 -5
  17. package/_bundled_plugin/scripts/workbench_target.py +82 -0
  18. package/_bundled_plugin/skills/deep-security-scan/SKILL.md +5 -3
  19. package/dist/api.d.ts +1 -0
  20. package/dist/api.d.ts.map +1 -1
  21. package/dist/api.js +217 -92
  22. package/dist/api.js.map +1 -1
  23. package/dist/auth.d.ts +2 -3
  24. package/dist/auth.d.ts.map +1 -1
  25. package/dist/auth.js +59 -270
  26. package/dist/auth.js.map +1 -1
  27. package/dist/cli.d.ts.map +1 -1
  28. package/dist/cli.js +14 -4
  29. package/dist/cli.js.map +1 -1
  30. package/dist/contract.js +7 -5
  31. package/dist/contract.js.map +1 -1
  32. package/dist/cost.d.ts +1 -0
  33. package/dist/cost.d.ts.map +1 -1
  34. package/dist/cost.js +23 -1
  35. package/dist/cost.js.map +1 -1
  36. package/dist/knowledge-base.d.ts.map +1 -1
  37. package/dist/knowledge-base.js +2 -1
  38. package/dist/knowledge-base.js.map +1 -1
  39. package/dist/multiscan.d.ts.map +1 -1
  40. package/dist/multiscan.js +1 -0
  41. package/dist/multiscan.js.map +1 -1
  42. package/dist/runtime.d.ts +9 -6
  43. package/dist/runtime.d.ts.map +1 -1
  44. package/dist/runtime.js +127 -284
  45. package/dist/runtime.js.map +1 -1
  46. package/dist/scan-comparison.js +1 -1
  47. package/dist/scan-comparison.js.map +1 -1
  48. package/dist/targets.d.ts +1 -0
  49. package/dist/targets.d.ts.map +1 -1
  50. package/dist/targets.js +22 -0
  51. package/dist/targets.js.map +1 -1
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/dist/version.js.map +1 -1
  55. package/package.json +2 -2
@@ -1136,6 +1136,285 @@ def complete_scan(
1136
1136
  )
1137
1137
 
1138
1138
 
1139
+ def complete_budget_exhausted_scan(
1140
+ connection: sqlite3.Connection, args: argparse.Namespace
1141
+ ) -> dict[str, Any]:
1142
+ scan_id = require_uuid(args.scan_id, "scan-id")
1143
+ cost_json = parse_scan_cost(args.cost_json)
1144
+ if cost_json is None:
1145
+ raise SystemExit("Budget-exhausted scan completion requires the measured scan cost.")
1146
+ with scan_completion_lock(scan_id):
1147
+ scan = require_scan(connection, scan_id)
1148
+ if scan["status"] != "running" or scan["mode"] != "deep" or scan["recipe_json"] is None:
1149
+ raise SystemExit("Only a running CLI Deep Scan can complete after its cost limit.")
1150
+ recipe = json.loads(scan["recipe_json"], parse_constant=reject_non_finite_json)
1151
+ if not isinstance(recipe, dict) or recipe.get("mode") != "deep":
1152
+ raise SystemExit("Budget-exhausted scan completion requires a Deep Scan launch recipe.")
1153
+ cost = json.loads(cost_json)
1154
+ measured = cost.get("cost", cost)
1155
+ limit = recipe.get("maxCostUsd")
1156
+ if (
1157
+ not isinstance(limit, (int, float))
1158
+ or isinstance(limit, bool)
1159
+ or not isinstance(measured, dict)
1160
+ or measured.get("estimatedUsd", 0) <= limit
1161
+ ):
1162
+ raise SystemExit("Deep Scan has not exceeded its configured cost limit.")
1163
+ run = connection.execute(
1164
+ "SELECT status, terminal_reason, manifest_path FROM deep_scan_runs WHERE scan_id = ?",
1165
+ (scan_id,),
1166
+ ).fetchone()
1167
+ if (
1168
+ run is None
1169
+ or run["status"] != "succeeded"
1170
+ or run["terminal_reason"] not in {"saturated", "capped"}
1171
+ or not run["manifest_path"]
1172
+ ):
1173
+ raise SystemExit(
1174
+ "Budget-exhausted scan completion requires successfully completed Deep Scan "
1175
+ "discovery."
1176
+ )
1177
+ scan_dir = require_canonical_scan_directory(Path(scan["scan_dir"]))
1178
+ candidates = budget_exhausted_candidates(scan, scan_dir)
1179
+ warning = optional_text(args.message, maximum=2400)
1180
+ if warning is None:
1181
+ warning = (
1182
+ f"Deep Scan reached its cost limit after an estimated "
1183
+ f"${measured['estimatedUsd']:.6g}; completed discovery was preserved."
1184
+ )
1185
+ budget_exhausted_draft(scan, scan_dir, candidates, warning)
1186
+ warnings = json.loads(scan["completion_warnings_json"])
1187
+ if warning not in warnings:
1188
+ connection.execute(
1189
+ "UPDATE scans SET completion_warnings_json = ? WHERE id = ? AND status = 'running'",
1190
+ (json.dumps([*warnings, warning]), scan_id),
1191
+ )
1192
+ connection.commit()
1193
+ return complete_scan_locked(connection, scan_id, None, cost_json)
1194
+
1195
+
1196
+ def budget_exhausted_candidates(scan: sqlite3.Row, scan_dir: Path) -> list[dict[str, Any]]:
1197
+ artifacts = deep_scan.canonical_discovery_artifacts(scan)
1198
+ ledger = Path(artifacts["candidateLedgerPath"])
1199
+ try:
1200
+ inventory = Path(artifacts["inScopeFilesPath"])
1201
+ inventory_descriptor = open_scan_local_file_descriptor(
1202
+ scan_dir,
1203
+ inventory.relative_to(scan_dir).as_posix(),
1204
+ "Canonical Deep Scan in-scope inventory",
1205
+ )
1206
+ with os.fdopen(inventory_descriptor, "rb") as source:
1207
+ lines = re.split(r"\r?\n", source.read().decode("utf-8"))
1208
+ in_scope = {re.sub(r"^(?:\./)+", "", line) for line in lines if line}
1209
+ descriptor = open_scan_local_file_descriptor(
1210
+ scan_dir,
1211
+ ledger.relative_to(scan_dir).as_posix(),
1212
+ "Canonical Deep Scan candidate ledger",
1213
+ )
1214
+ with os.fdopen(descriptor, "r", encoding="utf-8") as source:
1215
+ candidates = [
1216
+ json.loads(line, parse_constant=reject_non_finite_json)
1217
+ for line in source
1218
+ if line.strip()
1219
+ ]
1220
+ except (ContractError, OSError, UnicodeError, ValueError) as exc:
1221
+ raise SystemExit(f"Canonical Deep Scan candidate ledger is invalid: {exc}") from exc
1222
+
1223
+ candidate_ids: set[str] = set()
1224
+ for candidate in candidates:
1225
+ if not isinstance(candidate, dict):
1226
+ raise SystemExit("Canonical Deep Scan candidate ledger rows must be objects.")
1227
+ candidate_id = candidate.get("candidate_id")
1228
+ locations = candidate.get("locations")
1229
+ if (
1230
+ not isinstance(candidate_id, str)
1231
+ or not candidate_id.strip()
1232
+ or candidate_id in {".", ".."}
1233
+ or "/" in candidate_id
1234
+ or "\\" in candidate_id
1235
+ or candidate_id in candidate_ids
1236
+ or not isinstance(candidate.get("summary"), str)
1237
+ or not candidate["summary"].strip()
1238
+ or not isinstance(candidate.get("evidence"), str)
1239
+ or not candidate["evidence"].strip()
1240
+ or not isinstance(locations, list)
1241
+ or not locations
1242
+ ):
1243
+ raise SystemExit("Canonical Deep Scan candidate ledger contains an invalid candidate.")
1244
+ candidate_ids.add(candidate_id)
1245
+ for location in locations:
1246
+ if not isinstance(location, dict):
1247
+ raise SystemExit("Canonical Deep Scan candidate location must be an object.")
1248
+ path = location.get("path")
1249
+ if (
1250
+ not isinstance(path, str)
1251
+ or not path
1252
+ or "\\" in path
1253
+ or "\x00" in path
1254
+ or re.match(r"^[A-Za-z]:", path)
1255
+ or PurePosixPath(path).is_absolute()
1256
+ or any(part in {".", "..", ""} for part in path.split("/"))
1257
+ ):
1258
+ raise SystemExit(
1259
+ "Canonical Deep Scan candidate location must be repository-relative."
1260
+ )
1261
+ if not any(location["path"] in in_scope for location in locations):
1262
+ raise SystemExit(
1263
+ "Canonical Deep Scan candidate must include a location in its in-scope inventory."
1264
+ )
1265
+ return candidates
1266
+
1267
+
1268
+ def budget_exhausted_draft(
1269
+ scan: sqlite3.Row,
1270
+ scan_dir: Path,
1271
+ candidates: list[dict[str, Any]],
1272
+ warning: str,
1273
+ ) -> None:
1274
+ documents: dict[str, dict[str, Any]] = {}
1275
+ for name in ("scan-manifest.json", "findings.json", "coverage.json"):
1276
+ path = artifact_path(scan_dir, name, required=False)
1277
+ if path is not None:
1278
+ documents[name] = read_json_object(path)
1279
+ if documents and len(documents) != 3:
1280
+ raise SystemExit("Budget-exhausted scan contains an incomplete canonical scan draft.")
1281
+
1282
+ if documents:
1283
+ manifest = documents["scan-manifest.json"]
1284
+ findings = documents["findings.json"]
1285
+ coverage = documents["coverage.json"]
1286
+ if not isinstance(manifest.get("scan"), dict) or not isinstance(
1287
+ findings.get("findings"), list
1288
+ ):
1289
+ raise SystemExit("Budget-exhausted scan contains an invalid canonical scan draft.")
1290
+ for key in ("surfaces", "explicitExclusions", "deferred"):
1291
+ if not isinstance(coverage.get(key), list):
1292
+ raise SystemExit("Budget-exhausted scan contains invalid canonical coverage.")
1293
+ if manifest["scan"].get("sealedAt") is not None or manifest["scan"].get("artifacts"):
1294
+ raise SystemExit("Budget-exhausted scan cannot replace an already sealed scan draft.")
1295
+ else:
1296
+ contract = scan_contract(scan)
1297
+ target_contract = contract["target"]
1298
+ target: dict[str, Any] = {
1299
+ "kind": target_contract["allowedKinds"][0],
1300
+ "targetId": target_contract["targetId"],
1301
+ "displayName": target_contract["displayName"],
1302
+ }
1303
+ if scan["target_revision"] != "unversioned":
1304
+ target["revision"] = scan["target_revision"]
1305
+ if "requiredSnapshotDigest" in target_contract:
1306
+ target["snapshotDigest"] = target_contract["requiredSnapshotDigest"]
1307
+ manifest = {
1308
+ "scan": {
1309
+ "target": target,
1310
+ "scope": {"limitations": [warning], "validationMode": "incomplete"},
1311
+ }
1312
+ }
1313
+ findings = {"findings": []}
1314
+ coverage = {
1315
+ "completeness": "partial",
1316
+ "inventoryStrategy": (
1317
+ "scoped_path" if expected_coverage_mode(scan) == "scoped_path" else "repository"
1318
+ ),
1319
+ "surfaces": [],
1320
+ "explicitExclusions": [],
1321
+ "deferred": [],
1322
+ }
1323
+
1324
+ findings_by_candidate = {
1325
+ candidate_id
1326
+ for finding in findings["findings"]
1327
+ if isinstance(finding, dict)
1328
+ and isinstance(candidate_id := finding_candidate_id(finding), str)
1329
+ }
1330
+ existing_deferred = {
1331
+ item.get("candidateId", item.get("id"))
1332
+ for item in coverage["deferred"]
1333
+ if isinstance(item, dict)
1334
+ and isinstance(item.get("candidateId", item.get("id")), str)
1335
+ }
1336
+ existing_surfaces = {
1337
+ item.get("id")
1338
+ for item in coverage["surfaces"]
1339
+ if isinstance(item, dict) and isinstance(item.get("id"), str)
1340
+ }
1341
+ for candidate in candidates:
1342
+ candidate_id = candidate["candidate_id"]
1343
+ if candidate_id in findings_by_candidate or candidate_id in existing_deferred:
1344
+ continue
1345
+ paths = list(dict.fromkeys(location["path"] for location in candidate["locations"]))
1346
+ surface_id = f"candidate-{candidate_id}"
1347
+ validation = candidate.get("validation")
1348
+ validation = validation.get("disposition") if isinstance(validation, dict) else None
1349
+ attack = candidate.get("attack_path")
1350
+ attack = attack.get("decision") if isinstance(attack, dict) else None
1351
+ disposition = (
1352
+ "needs_follow_up"
1353
+ if validation == "deferred" or attack == "deferred"
1354
+ else "not_applicable"
1355
+ if validation == "not_applicable"
1356
+ else "rejected"
1357
+ if validation == "suppressed" or attack == "ignore"
1358
+ else "needs_follow_up"
1359
+ )
1360
+ if surface_id not in existing_surfaces:
1361
+ coverage["surfaces"].append(
1362
+ {
1363
+ "id": surface_id,
1364
+ "label": candidate["summary"],
1365
+ "disposition": disposition,
1366
+ "notes": candidate["evidence"],
1367
+ "receiptRefs": [],
1368
+ }
1369
+ )
1370
+ existing_surfaces.add(surface_id)
1371
+ if disposition != "needs_follow_up":
1372
+ continue
1373
+ coverage["deferred"].append(
1374
+ {
1375
+ "id": candidate_id,
1376
+ "candidateId": candidate_id,
1377
+ "reason": (
1378
+ "Validation was deferred because the scan reached its cost limit: "
1379
+ f"{candidate['summary']}. Evidence: {candidate['evidence']}"
1380
+ ),
1381
+ "paths": paths,
1382
+ "surfaceIds": [surface_id],
1383
+ }
1384
+ )
1385
+ if not any(
1386
+ isinstance(item, dict)
1387
+ and isinstance(reason := item.get("reason"), str)
1388
+ and (
1389
+ reason == "Validation was deferred because the scan reached its cost limit."
1390
+ or reason.startswith(
1391
+ "Validation was deferred because the scan reached its cost limit: "
1392
+ )
1393
+ )
1394
+ for item in coverage["deferred"]
1395
+ ):
1396
+ coverage["deferred"].append(
1397
+ {
1398
+ "id": "scan-cost-limit",
1399
+ "reason": "Validation was deferred because the scan reached its cost limit.",
1400
+ }
1401
+ )
1402
+ coverage["completeness"] = "partial"
1403
+ for name, payload in (
1404
+ ("findings.json", findings),
1405
+ ("coverage.json", coverage),
1406
+ ("scan-manifest.json", manifest),
1407
+ ):
1408
+ try:
1409
+ write_scan_local_bytes(
1410
+ scan_dir,
1411
+ name,
1412
+ (json.dumps(payload, allow_nan=False, indent=2, sort_keys=True) + "\n").encode(),
1413
+ )
1414
+ except (ContractError, OSError, TypeError, ValueError) as exc:
1415
+ raise SystemExit(f"Budget-exhausted scan draft could not be saved: {exc}") from exc
1416
+
1417
+
1139
1418
  def complete_scan_locked(
1140
1419
  connection: sqlite3.Connection,
1141
1420
  scan_id: str,
@@ -1168,8 +1447,7 @@ def complete_scan_locked(
1168
1447
  claim_token,
1169
1448
  error_message="Scan completion is owned by another continuation.",
1170
1449
  )
1171
- if scan["recipe_json"] is None:
1172
- deep_scan.require_deep_scan_ready_for_parent_completion(connection, scan)
1450
+ deep_scan.require_deep_scan_ready_for_parent_completion(connection, scan)
1173
1451
  warnings = json.loads(scan["completion_warnings_json"])
1174
1452
  target_warnings: list[str] = []
1175
1453
  warning = scan_target_warning(scan)
@@ -1262,8 +1540,7 @@ def complete_scan_locked(
1262
1540
  return scan_context(connection, scan["id"])
1263
1541
  if scan["status"] != "running":
1264
1542
  raise SystemExit("Only a running scan can be completed.")
1265
- if scan["recipe_json"] is None:
1266
- deep_scan.require_deep_scan_ready_for_parent_completion(connection, scan)
1543
+ deep_scan.require_deep_scan_ready_for_parent_completion(connection, scan)
1267
1544
  handoff.require_current_continuation(
1268
1545
  scan,
1269
1546
  claim_token,
@@ -3400,6 +3677,8 @@ def main() -> None:
3400
3677
  result = complete_scan(
3401
3678
  connection, args, prepare_only=args.command == "prepare-scan-completion"
3402
3679
  )
3680
+ elif args.command == "complete-budget-exhausted-scan":
3681
+ result = complete_budget_exhausted_scan(connection, args)
3403
3682
  elif args.command == "cancel-scan":
3404
3683
  result = cancel_scan(connection, args)
3405
3684
  elif args.command == "fail-scan":
@@ -635,6 +635,14 @@ MIGRATIONS = (
635
635
  SET stop_after_consecutive_errors = stop_after_no_new;
636
636
  """,
637
637
  ),
638
+ (
639
+ 28,
640
+ "persist deep scan discovery time limit",
641
+ """
642
+ ALTER TABLE deep_scan_runs
643
+ ADD COLUMN max_time_hours REAL NOT NULL DEFAULT 96;
644
+ """,
645
+ ),
638
646
  )
639
647
 
640
648
 
@@ -689,6 +697,13 @@ def apply_migrations(
689
697
  "completion_warnings_json",
690
698
  "TEXT NOT NULL DEFAULT '[]'",
691
699
  )
700
+ elif version == 28:
701
+ add_column_if_missing(
702
+ connection,
703
+ "deep_scan_runs",
704
+ "max_time_hours",
705
+ "REAL NOT NULL DEFAULT 96",
706
+ )
692
707
  continue
693
708
  if version == 6:
694
709
  repair_thread_scoped_workspaces_migration(connection)
@@ -10,11 +10,10 @@ from typing import Any
10
10
 
11
11
  # Some plugin hosts launch Python with safe-path isolation enabled.
12
12
  sys.path.insert(0, str(Path(__file__).resolve().parent))
13
- from workbench_target import clean_worktree_content_digest, git_bytes, git_output
13
+ from workbench_target import clean_worktree_content_digest, git_bytes
14
14
 
15
15
  CONTEXT_LINES = 3
16
16
  MAX_BYTES = 16_000
17
- MAX_FILE_BYTES = 1_048_576
18
17
  MAX_LINES = 60
19
18
 
20
19
 
@@ -70,9 +69,6 @@ def scanned_source_text(scan: sqlite3.Row, target: Path, path: str) -> str | Non
70
69
  if snapshot_digest is not None and snapshot_digest != clean_worktree_content_digest():
71
70
  return None
72
71
  object_name = f"{revision}:{path}"
73
- size = git_output(target, "cat-file", "-s", object_name)
74
- if size is None or not size.isdigit() or int(size) > MAX_FILE_BYTES:
75
- return None
76
72
  content = git_bytes(target, "cat-file", "blob", object_name)
77
73
  return content.decode("utf-8", errors="replace") if content is not None else None
78
74
 
@@ -40,10 +40,91 @@ def git_bytes(
40
40
  return completed.stdout if completed.returncode == 0 else None
41
41
 
42
42
 
43
+ def git_blob_bytes(
44
+ target: Path,
45
+ object_names: list[str],
46
+ *,
47
+ git_dir: Path | None = None,
48
+ work_tree: Path | None = None,
49
+ ) -> list[bytes | None]:
50
+ """Read ordered raw blobs with one NUL-framed ``git cat-file --batch`` call."""
51
+ if not object_names:
52
+ return []
53
+
54
+ request = b"\0".join(os.fsencode(name) for name in object_names) + b"\0"
55
+ completed = git_command(
56
+ target,
57
+ "cat-file",
58
+ "--batch",
59
+ "-Z",
60
+ text=False,
61
+ input_data=request,
62
+ git_dir=git_dir,
63
+ work_tree=work_tree,
64
+ )
65
+ if completed.returncode != 0:
66
+ return [None] * len(object_names)
67
+
68
+ try:
69
+ return _decode_git_batch_blobs(completed.stdout, len(object_names))
70
+ except ValueError:
71
+ return [None] * len(object_names)
72
+
73
+
74
+ def _decode_git_batch_blobs(output: bytes, count: int) -> list[bytes | None]:
75
+ """Decode ordered ``cat-file --batch -Z`` records without scanning blob bytes."""
76
+ blobs: list[bytes | None] = []
77
+ offset = 0
78
+ for _ in range(count):
79
+ header, offset = _read_nul_field(output, offset)
80
+ size = _git_batch_blob_size(header)
81
+ if size is None:
82
+ blobs.append(None)
83
+ continue
84
+ blob, offset = _read_sized_nul_field(output, offset, size)
85
+ blobs.append(blob)
86
+ return blobs
87
+
88
+
89
+ def _read_nul_field(output: bytes, offset: int) -> tuple[bytes, int]:
90
+ """Read one NUL-terminated protocol field and return the next offset."""
91
+ end = output.find(b"\0", offset)
92
+ if end < 0:
93
+ raise ValueError("missing NUL terminator")
94
+ return output[offset:end], end + 1
95
+
96
+
97
+ def _git_batch_blob_size(header: bytes) -> int | None:
98
+ """Return a blob header's byte count, or ``None`` for a non-blob record."""
99
+ fields = header.rsplit(b" ", 2)
100
+ if len(fields) != 3 or fields[1] != b"blob":
101
+ return None
102
+ try:
103
+ size = int(fields[2])
104
+ except ValueError as error:
105
+ raise ValueError("invalid blob size") from error
106
+ if size < 0:
107
+ raise ValueError("invalid blob size")
108
+ return size
109
+
110
+
111
+ def _read_sized_nul_field(
112
+ output: bytes,
113
+ offset: int,
114
+ size: int,
115
+ ) -> tuple[bytes, int]:
116
+ """Read exactly ``size`` blob bytes followed by one NUL record terminator."""
117
+ end = offset + size
118
+ if output[end : end + 1] != b"\0":
119
+ raise ValueError("missing blob terminator")
120
+ return output[offset:end], end + 1
121
+
122
+
43
123
  def git_command(
44
124
  target: Path,
45
125
  *args: str,
46
126
  text: bool,
127
+ input_data: str | bytes | None = None,
47
128
  git_dir: Path | None = None,
48
129
  work_tree: Path | None = None,
49
130
  ) -> subprocess.CompletedProcess[str] | subprocess.CompletedProcess[bytes]:
@@ -65,6 +146,7 @@ def git_command(
65
146
  capture_output=True,
66
147
  env=environment,
67
148
  text=text,
149
+ input=input_data,
68
150
  )
69
151
  except FileNotFoundError:
70
152
  # Git is optional for Codebase scans. Treat an unavailable executable like
@@ -89,7 +89,7 @@ When the existing scan has a `handoffClaimToken`, preserve and pass that same to
89
89
 
90
90
  For a scoped-path scan, pass the resolved scoped directory as `targetPath` with `scope: "."`; never silently widen it to the repository root.
91
91
 
92
- Make one call and wait for it. The call blocks for up to 24 hours and returns only after discovery completes, fails, or is canceled. The tool owns the transition into the discovery phase, so leave the public scan phase at preflight before calling it. Do not publish discovery progress yourself while the call is pending.
92
+ Make one call and wait for it. Discovery stops dispatching new workers after the configured `[deep_scan].max_time_hours` duration, cancels unfinished discovery, merges every completed discovery, and returns the existing `capped` terminal manifest. The default and maximum configured duration are 96 hours, reserving approximately one hour for finalization under the 97-hour tool-call timeout. Then continue immediately with centralized validation, attack-path analysis, and reporting. The call otherwise returns only after discovery completes, fails, or is canceled. The tool owns the transition into the discovery phase, so leave the public scan phase at preflight before calling it. Do not publish discovery progress yourself while the call is pending.
93
93
 
94
94
  Handle the terminal result as follows:
95
95
 
@@ -97,7 +97,7 @@ Handle the terminal result as follows:
97
97
  - `status: "canceled"`: stop without starting validation or finalization.
98
98
  - Tool error: report the exact stable MCP error, including its failure-manifest path when present, and stop the current response. This is a terminal failure of that logical scan: do not call `start_codex_security_deep_scan` again in this response; do not call `get_codex_security_scan_context` in this response; do not call `complete_codex_security_scan` in this response; do not call the target form again to create a replacement scan, do not cancel an already terminal failed scan, do not return a final answer, satisfy a structured output schema, do not synthesize no-findings coverage, or emit benchmark JSON.
99
99
 
100
- If the host represents the pending tool call as a running execution cell, keep waiting on that same cell instead of starting another tool call. Stopping the current Codex response or reaching the host's 24-hour timeout detaches only the caller; it does not cancel the scan. Only while the scan is still active may a later desktop turn rejoin with `{ scanId, handoffClaimToken? }`, or a CLI/headless turn repeat the identical target form to rejoin the owning thread's active scan. After an MCP process restart, the new coordinator safely adopts the expired lease and preserves completed discovery receipts. A terminal tool failure is not a detached waiter and must not be replaced. When the user explicitly asks to stop an active scan, call `cancel_codex_security_scan({ scanId })`.
100
+ If the host represents the pending tool call as a running execution cell, keep waiting on that same cell instead of starting another tool call. Stopping the current Codex response or reaching the host's tool-call timeout detaches only the caller; it does not cancel the scan. Only while the scan is still active may a later desktop turn rejoin with `{ scanId, handoffClaimToken? }`, or a CLI/headless turn repeat the identical target form to rejoin the owning thread's active scan. After an MCP process restart, the new coordinator safely adopts the expired lease and preserves completed discovery receipts. A terminal tool failure is not a detached waiter and must not be replaced. When the user explicitly asks to stop an active scan, call `cancel_codex_security_scan({ scanId })`.
101
101
 
102
102
  The native Security workbench observes durable discovery progress without another scan-start call.
103
103
 
@@ -112,12 +112,14 @@ Treat the returned manifest as the sole discovery-to-parent boundary. Require it
112
112
  - merged, canceled, and intentionally omitted worker IDs
113
113
  - final discovery count and no-new streak
114
114
 
115
- Do not read live worker state, repair worker artifacts, or redo discovery. If a required manifest field or shared discovery artifact is missing or malformed, report the tool failure and stop before validation. An empty compact candidate ledger is the ordinary no-findings discovery result; it still requires a valid terminal manifest.
115
+ Do not read live worker state, repair worker artifacts, or redo discovery. If a required manifest field or shared discovery artifact is missing or malformed, report the tool failure and stop before validation. An empty compact candidate ledger with completed discovery workers is the ordinary no-findings discovery result; it still requires a valid terminal manifest. If the manifest is `capped` with `discoveryCount: 0`, no source review completed: treat its empty ledger as incomplete discovery, never as evidence that the repository has no vulnerabilities.
116
116
 
117
117
  ## Centralized Tail
118
118
 
119
119
  After accepting the terminal manifest, continue in the same turn. A discovery manifest is never a final scan result and never authorizes a user-facing or benchmark response:
120
120
 
121
+ If the manifest is `capped` with `discoveryCount: 0`, do not invent or synthesize a threat model. Publish the ordinary forward phase transitions and close the empty phases directly with `record_codex_security_candidate_validations({ scanId, validations: [] })` and `record_candidate_attack_paths({ scanId, attackPaths: [] })`. Record `record_codex_security_scan_draft({ scanId, handoffClaimToken?, findings: [], coverage: { completeness: "partial", surfaces: [], explicitExclusions: [], deferred: [{ reason: "The configured discovery time limit elapsed before any source review completed." }] } })` without `threatModel`, then call `complete_codex_security_scan({ scanId, handoffClaimToken? })`. Preserve the actual scan scope and make clear that the report is partial because no source review completed; do not claim the repository is free of vulnerabilities. The usual draft, completion, and error-handling rules below still apply.
122
+
121
123
  1. Read the canonical review items and candidate set with `list_codex_security_review_items({ scanId, handoffClaimToken?, cursor?, limit? })` and `list_codex_security_candidates({ scanId, cursor?, limit? })`. Follow `nextCursor` until all pages are read. If either tool fails or returns malformed records, report the tool failure and stop; do not repair coordinator-owned discovery artifacts, reopen discovery, or silently drop candidates.
122
124
  2. Synthesize one canonical validation threat model from the ordered worker threat models and write it to the per-scan `<context_dir>/threat_model.md` path. Preserve relevant attacker models, trust boundaries, privileged surfaces, contradictions, and risk framings conservatively. This threat model is downstream context, not a retroactive discovery filter.
123
125
  3. Run `$codex-security:validation` once in compact Deep candidate mode over the canonical merged candidates, recording every result with `record_codex_security_candidate_validations`.
package/dist/api.d.ts CHANGED
@@ -45,6 +45,7 @@ export interface DeepScanOptions {
45
45
  subagents?: number;
46
46
  stopAfterNoNew?: number;
47
47
  maxDiscoveryRuns?: number;
48
+ maxTimeHours?: number;
48
49
  }
49
50
  export interface ScanOptions extends DeepScanOptions {
50
51
  auth?: ScanAuthMode;
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAcA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAM7D,OAAO,EAEL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAiBvB,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;AAChF,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,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