@openai/codex-security 0.1.25 → 0.1.26
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.
- package/README.md +222 -8
- package/_bundled_plugin/.app.json +0 -5
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/references/config-preflight.md +2 -2
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/scan-artifacts.md +5 -1
- package/_bundled_plugin/references/scan-contract.md +7 -3
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +27 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +6 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +2 -5
- package/_bundled_plugin/scripts/report_projection.py +1 -1
- package/_bundled_plugin/scripts/workbench_cli.py +3 -0
- package/_bundled_plugin/scripts/workbench_db.py +11 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +41 -22
- package/_bundled_plugin/scripts/workbench_scan_usage.py +7 -6
- package/_bundled_plugin/scripts/workbench_schema.py +31 -0
- package/_bundled_plugin/scripts/workbench_severity.py +119 -0
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +5 -3
- package/_bundled_plugin/skills/verify-fix/SKILL.md +5 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -5
- package/dist/api.js.map +1 -1
- package/dist/classify-scan-severity.d.ts +16 -0
- package/dist/classify-scan-severity.d.ts.map +1 -0
- package/dist/classify-scan-severity.js +96 -0
- package/dist/classify-scan-severity.js.map +1 -0
- package/dist/classify-severity.d.ts +38 -0
- package/dist/classify-severity.d.ts.map +1 -0
- package/dist/classify-severity.js +185 -0
- package/dist/classify-severity.js.map +1 -0
- package/dist/cli.d.ts +5 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +323 -89
- package/dist/cli.js.map +1 -1
- package/dist/cost.js +20 -6
- package/dist/cost.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +1 -1
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/finding-catalogue.d.ts +11 -0
- package/dist/finding-catalogue.d.ts.map +1 -0
- package/dist/finding-catalogue.js +150 -0
- package/dist/finding-catalogue.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/patch-tui.js +1 -1
- package/dist/patch-tui.js.map +1 -1
- package/dist/publication-store.d.ts.map +1 -1
- package/dist/publication-store.js +9 -4
- package/dist/publication-store.js.map +1 -1
- package/dist/publication.d.ts +9 -0
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +45 -5
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -2
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +2 -2
- package/dist/publish.js.map +1 -1
- package/dist/scan-comparison.d.ts +42 -37
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +535 -161
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +5 -0
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/severity-store.d.ts +2 -0
- package/dist/severity-store.d.ts.map +1 -0
- package/dist/severity-store.js +111 -0
- package/dist/severity-store.js.map +1 -0
- package/dist/thread-source.d.ts +1 -0
- package/dist/thread-source.d.ts.map +1 -1
- package/dist/thread-source.js +1 -0
- package/dist/thread-source.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
|
@@ -112,13 +112,13 @@ def _latest_successful_reducer(workers: list[Any]) -> Any | None:
|
|
|
112
112
|
)
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
def _saved_result_paths(scan_dir: Path, workers: list[Any]) -> Iterator[str]:
|
|
115
|
+
def _saved_result_paths(scan_dir: Path, workers: list[Any]) -> Iterator[tuple[str, str | None]]:
|
|
116
116
|
latest_reducer = _latest_successful_reducer(workers)
|
|
117
117
|
|
|
118
|
-
def checkpoints(directory: str) -> Iterator[str]:
|
|
118
|
+
def checkpoints(directory: str, kind: str | None = None) -> Iterator[tuple[str, str | None]]:
|
|
119
119
|
for name in _children(scan_dir, directory):
|
|
120
120
|
if re.fullmatch(r"[0-9a-f]{64}\.json", name):
|
|
121
|
-
yield f"{directory}/{name}"
|
|
121
|
+
yield f"{directory}/{name}", kind
|
|
122
122
|
|
|
123
123
|
yield from checkpoints("checkpoints")
|
|
124
124
|
for worker in workers:
|
|
@@ -137,25 +137,32 @@ def _saved_result_paths(scan_dir: Path, workers: list[Any]) -> Iterator[str]:
|
|
|
137
137
|
if re.fullmatch(r"attempt-\d+", name)
|
|
138
138
|
]
|
|
139
139
|
for directory in directories:
|
|
140
|
-
checkpoint_paths = list(checkpoints(f"{directory}/checkpoints"))
|
|
140
|
+
checkpoint_paths = list(checkpoints(f"{directory}/checkpoints", worker["kind"]))
|
|
141
141
|
if worker["kind"] == "discovery" or checkpoint_paths:
|
|
142
|
-
yield f"{directory}/result.json"
|
|
142
|
+
yield f"{directory}/result.json", worker["kind"]
|
|
143
143
|
yield from checkpoint_paths
|
|
144
144
|
if worker["result_manifest_path"] and (
|
|
145
145
|
worker["kind"] == "discovery"
|
|
146
146
|
or (latest_reducer is not None and worker["id"] == latest_reducer["id"])
|
|
147
147
|
):
|
|
148
148
|
try:
|
|
149
|
-
yield
|
|
149
|
+
yield (
|
|
150
|
+
Path(worker["result_manifest_path"]).relative_to(scan_dir).as_posix(),
|
|
151
|
+
worker["kind"],
|
|
152
|
+
)
|
|
150
153
|
except ValueError:
|
|
151
154
|
continue
|
|
152
155
|
|
|
153
156
|
|
|
154
|
-
def _read_saved_result(
|
|
157
|
+
def _read_saved_result(
|
|
158
|
+
scan_dir: Path, relative: str, scan_id: str, *, kind: str | None = None
|
|
159
|
+
) -> tuple[dict[str, Any], str]:
|
|
155
160
|
draft = _read_scan_local_json(scan_dir, relative, "Saved scan checkpoint")
|
|
156
161
|
if draft.get("scanId") != scan_id:
|
|
157
162
|
raise ContractError("checkpoint belongs to a different scan")
|
|
158
|
-
if not isinstance(draft.get("findings"), list) or not isinstance(
|
|
163
|
+
if not isinstance(draft.get("findings"), list) or not isinstance(
|
|
164
|
+
draft.get("coverage", {} if kind == "dedup" else None), dict
|
|
165
|
+
):
|
|
159
166
|
raise ContractError("checkpoint has no semantic findings or coverage")
|
|
160
167
|
return draft, _digest(draft)
|
|
161
168
|
|
|
@@ -207,13 +214,13 @@ def _saved_results_changed(db: Any, connection: Any, scan: Any) -> bool:
|
|
|
207
214
|
"FROM deep_scan_workers WHERE scan_id = ?",
|
|
208
215
|
(scan["id"],),
|
|
209
216
|
).fetchall()
|
|
210
|
-
paths =
|
|
217
|
+
paths = dict(_saved_result_paths(scan_dir, workers))
|
|
211
218
|
frozen_sources = scan["retained_source_digests_json"]
|
|
212
219
|
|
|
213
220
|
def has_saved_source() -> bool:
|
|
214
221
|
for path in paths:
|
|
215
222
|
try:
|
|
216
|
-
_read_saved_result(scan_dir, path, scan["id"])
|
|
223
|
+
_read_saved_result(scan_dir, path, scan["id"], kind=paths[path])
|
|
217
224
|
return True
|
|
218
225
|
except (ContractError, OSError, ValueError):
|
|
219
226
|
continue
|
|
@@ -244,7 +251,9 @@ def _saved_results_changed(db: Any, connection: Any, scan: Any) -> bool:
|
|
|
244
251
|
current_sources = dict(published_sources)
|
|
245
252
|
for path in paths:
|
|
246
253
|
try:
|
|
247
|
-
_, current_sources[path] = _read_saved_result(
|
|
254
|
+
_, current_sources[path] = _read_saved_result(
|
|
255
|
+
scan_dir, path, scan["id"], kind=paths[path]
|
|
256
|
+
)
|
|
248
257
|
except (ContractError, OSError, ValueError):
|
|
249
258
|
continue
|
|
250
259
|
return current_sources != published_sources
|
|
@@ -290,23 +299,26 @@ def _recovery_source_digests(db: Any, connection: Any, scan: Any) -> tuple[dict[
|
|
|
290
299
|
else:
|
|
291
300
|
include_parent = True
|
|
292
301
|
|
|
302
|
+
workers = connection.execute(
|
|
303
|
+
"SELECT id, kind, status, completed_at, artifact_dir, result_manifest_path "
|
|
304
|
+
"FROM deep_scan_workers WHERE scan_id = ?",
|
|
305
|
+
(scan["id"],),
|
|
306
|
+
).fetchall()
|
|
307
|
+
paths = dict(_saved_result_paths(scan_dir, workers))
|
|
293
308
|
recovery_sources = dict(frozen_sources or {})
|
|
294
309
|
for relative, expected_digest in recovery_sources.items():
|
|
295
310
|
try:
|
|
296
|
-
_, digest = _read_saved_result(scan_dir, relative, scan["id"])
|
|
311
|
+
_, digest = _read_saved_result(scan_dir, relative, scan["id"], kind=paths.get(relative))
|
|
297
312
|
except (ContractError, OSError, ValueError) as exc:
|
|
298
313
|
raise ContractError("Frozen stopped-scan checkpoint set is incomplete.") from exc
|
|
299
314
|
if digest != expected_digest:
|
|
300
315
|
raise ContractError("checkpoint changed after the scan stopped")
|
|
301
316
|
|
|
302
|
-
|
|
303
|
-
"SELECT id, kind, status, completed_at, artifact_dir, result_manifest_path "
|
|
304
|
-
"FROM deep_scan_workers WHERE scan_id = ?",
|
|
305
|
-
(scan["id"],),
|
|
306
|
-
).fetchall()
|
|
307
|
-
for relative in set(_saved_result_paths(scan_dir, workers)) - recovery_sources.keys():
|
|
317
|
+
for relative in paths.keys() - recovery_sources.keys():
|
|
308
318
|
try:
|
|
309
|
-
_, recovery_sources[relative] = _read_saved_result(
|
|
319
|
+
_, recovery_sources[relative] = _read_saved_result(
|
|
320
|
+
scan_dir, relative, scan["id"], kind=paths[relative]
|
|
321
|
+
)
|
|
310
322
|
except (ContractError, OSError, ValueError):
|
|
311
323
|
continue
|
|
312
324
|
return recovery_sources, include_parent
|
|
@@ -489,6 +501,7 @@ def merge_saved_results(
|
|
|
489
501
|
parent_preserved_sources = recorded
|
|
490
502
|
source_digests.update(parent_preserved_sources)
|
|
491
503
|
paths: dict[str, str | None] = {}
|
|
504
|
+
reducer_paths: set[str] = set()
|
|
492
505
|
current_results: set[str] = set()
|
|
493
506
|
reducer_outputs: list[tuple[Any, str, list[str], int]] = []
|
|
494
507
|
reducer = _latest_successful_reducer(workers)
|
|
@@ -497,6 +510,7 @@ def merge_saved_results(
|
|
|
497
510
|
try:
|
|
498
511
|
latest_reducer = Path(reducer["result_manifest_path"]).relative_to(scan_dir).as_posix()
|
|
499
512
|
paths[latest_reducer] = None
|
|
513
|
+
reducer_paths.add(latest_reducer)
|
|
500
514
|
except ValueError:
|
|
501
515
|
warnings.append("Skipped a reducer result outside the scan directory.")
|
|
502
516
|
|
|
@@ -526,6 +540,7 @@ def merge_saved_results(
|
|
|
526
540
|
paths[result_path] = None
|
|
527
541
|
for checkpoint_path in checkpoint_paths:
|
|
528
542
|
paths[checkpoint_path] = None
|
|
543
|
+
reducer_paths.update([result_path, *checkpoint_paths])
|
|
529
544
|
reducer_outputs.append((reducer_worker, result_path, checkpoint_paths, attempt))
|
|
530
545
|
|
|
531
546
|
reducer_output(output, int(worker["attempt"] or 0), worker)
|
|
@@ -570,11 +585,15 @@ def merge_saved_results(
|
|
|
570
585
|
|
|
571
586
|
for relative, worker_id in paths.items():
|
|
572
587
|
try:
|
|
573
|
-
draft, digest = _read_saved_result(
|
|
588
|
+
draft, digest = _read_saved_result(
|
|
589
|
+
scan_dir, relative, scan_id, kind="dedup" if relative in reducer_paths else None
|
|
590
|
+
)
|
|
574
591
|
if frozen_source_digests is not None and frozen_source_digests[relative] != digest:
|
|
575
592
|
raise ContractError("checkpoint changed after the scan stopped")
|
|
576
593
|
source_digests[relative] = digest
|
|
577
|
-
|
|
594
|
+
# Recovery expects coverage, but reducer results only contain findings
|
|
595
|
+
# and context. Add an empty value after hashing the original result.
|
|
596
|
+
sources.append((relative, {"coverage": {}, **draft}, worker_id))
|
|
578
597
|
except (ContractError, OSError, ValueError) as exc:
|
|
579
598
|
if (scan_dir / relative).exists():
|
|
580
599
|
warnings.append(f"Preserved unreadable checkpoint {relative}: {exc}")
|
|
@@ -645,7 +664,7 @@ def merge_saved_results(
|
|
|
645
664
|
manifest["scan"]["preservedSources"] = source_digests
|
|
646
665
|
coverage = (
|
|
647
666
|
copy.deepcopy(parent["coverage"])
|
|
648
|
-
if parent
|
|
667
|
+
if parent and parent["coverage"]
|
|
649
668
|
else {
|
|
650
669
|
"completeness": "partial",
|
|
651
670
|
"mode": binding["coverageMode"],
|
|
@@ -501,19 +501,20 @@ def _is_owned_task_start(
|
|
|
501
501
|
turn_id = payload.get("turn_id")
|
|
502
502
|
if not isinstance(turn_id, str) or not turn_id:
|
|
503
503
|
return False
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
# Fresh Codex worker thread/turn IDs use a same-process monotonic UUIDv7 generator.
|
|
505
|
+
thread_order = _uuid7_order(thread_id)
|
|
506
|
+
turn_order = _uuid7_order(turn_id)
|
|
507
|
+
if thread_order is None:
|
|
507
508
|
return True
|
|
508
|
-
return
|
|
509
|
+
return turn_order is not None and turn_order >= thread_order
|
|
509
510
|
|
|
510
511
|
|
|
511
|
-
def
|
|
512
|
+
def _uuid7_order(value: str) -> int | None:
|
|
512
513
|
try:
|
|
513
514
|
parsed = uuid.UUID(value)
|
|
514
515
|
except ValueError:
|
|
515
516
|
return None
|
|
516
|
-
return parsed.int
|
|
517
|
+
return parsed.int if parsed.version == 7 else None
|
|
517
518
|
|
|
518
519
|
|
|
519
520
|
def _token_snapshot(payload: Mapping[str, Any]) -> dict[str, int] | None:
|
|
@@ -836,6 +836,37 @@ MIGRATIONS = (
|
|
|
836
836
|
ON scan_comparisons(after_scan_id, before_scan_id);
|
|
837
837
|
""",
|
|
838
838
|
),
|
|
839
|
+
(
|
|
840
|
+
41,
|
|
841
|
+
"checkpoint finding severity assessments",
|
|
842
|
+
"""
|
|
843
|
+
CREATE TABLE finding_severity_assessments (
|
|
844
|
+
finding_id TEXT PRIMARY KEY REFERENCES findings(id) ON DELETE CASCADE,
|
|
845
|
+
occurrence_id TEXT,
|
|
846
|
+
input_sha256 TEXT NOT NULL,
|
|
847
|
+
rubric_sha256 TEXT,
|
|
848
|
+
knowledge_base_sha256 TEXT,
|
|
849
|
+
assessed_at TEXT NOT NULL,
|
|
850
|
+
source TEXT NOT NULL CHECK (source IN ('existing-severity', 'rubric')),
|
|
851
|
+
decision TEXT NOT NULL CHECK (decision IN ('assessed', 'excluded')),
|
|
852
|
+
level TEXT CHECK (level IN ('critical', 'high', 'medium', 'low', 'informational')),
|
|
853
|
+
rubric_label TEXT,
|
|
854
|
+
rationale TEXT NOT NULL,
|
|
855
|
+
confidence TEXT CHECK (confidence IN ('high', 'medium', 'low')),
|
|
856
|
+
review_trigger TEXT,
|
|
857
|
+
CHECK ((decision = 'assessed' AND level IS NOT NULL)
|
|
858
|
+
OR (decision = 'excluded' AND level IS NULL AND rubric_label IS NULL))
|
|
859
|
+
);
|
|
860
|
+
|
|
861
|
+
CREATE TABLE scan_severity_classifications (
|
|
862
|
+
scan_id TEXT PRIMARY KEY,
|
|
863
|
+
finding_ids_json TEXT NOT NULL,
|
|
864
|
+
assessed_at TEXT NOT NULL,
|
|
865
|
+
rubric_sha256 TEXT,
|
|
866
|
+
knowledge_base_sha256 TEXT
|
|
867
|
+
);
|
|
868
|
+
""",
|
|
869
|
+
),
|
|
839
870
|
)
|
|
840
871
|
|
|
841
872
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Per-finding severity checkpoints and the selection requested for each scan."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sqlite3
|
|
6
|
+
from contextlib import closing
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
from urllib.parse import quote
|
|
10
|
+
|
|
11
|
+
from workbench_finding_index import upsert_finding
|
|
12
|
+
|
|
13
|
+
FIELDS = {
|
|
14
|
+
"findingId": "finding_id",
|
|
15
|
+
"occurrenceId": "occurrence_id",
|
|
16
|
+
"inputSha256": "input_sha256",
|
|
17
|
+
"rubricSha256": "rubric_sha256",
|
|
18
|
+
"knowledgeBaseSha256": "knowledge_base_sha256",
|
|
19
|
+
"assessedAt": "assessed_at",
|
|
20
|
+
"source": "source",
|
|
21
|
+
"decision": "decision",
|
|
22
|
+
"level": "level",
|
|
23
|
+
"rubricLabel": "rubric_label",
|
|
24
|
+
"rationale": "rationale",
|
|
25
|
+
"confidence": "confidence",
|
|
26
|
+
"reviewTrigger": "review_trigger",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def assessments(connection: sqlite3.Connection, finding_ids: list[str]) -> list[dict[str, Any]]:
|
|
31
|
+
rows = connection.execute(
|
|
32
|
+
"""SELECT assessment.* FROM json_each(?) AS selected
|
|
33
|
+
JOIN finding_severity_assessments AS assessment ON assessment.finding_id = selected.value
|
|
34
|
+
ORDER BY selected.key""",
|
|
35
|
+
(json.dumps(finding_ids),),
|
|
36
|
+
)
|
|
37
|
+
return [{key: row[column] for key, column in FIELDS.items()} for row in rows]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def checkpoint(
|
|
41
|
+
connection: sqlite3.Connection, payload: dict[str, Any], timestamp: str
|
|
42
|
+
) -> dict[str, Any]:
|
|
43
|
+
if payload["action"] == "begin":
|
|
44
|
+
with connection:
|
|
45
|
+
connection.execute(
|
|
46
|
+
"""INSERT INTO scan_severity_classifications (
|
|
47
|
+
scan_id, finding_ids_json, assessed_at, rubric_sha256, knowledge_base_sha256
|
|
48
|
+
) VALUES (?, ?, ?, ?, ?)
|
|
49
|
+
ON CONFLICT(scan_id) DO UPDATE SET
|
|
50
|
+
finding_ids_json = excluded.finding_ids_json,
|
|
51
|
+
assessed_at = excluded.assessed_at,
|
|
52
|
+
rubric_sha256 = excluded.rubric_sha256,
|
|
53
|
+
knowledge_base_sha256 = excluded.knowledge_base_sha256""",
|
|
54
|
+
(
|
|
55
|
+
payload["scanId"],
|
|
56
|
+
json.dumps(payload["findingIds"]),
|
|
57
|
+
payload["assessedAt"],
|
|
58
|
+
payload["rubricSha256"],
|
|
59
|
+
payload["knowledgeBaseSha256"],
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
return {"assessments": assessments(connection, payload["findingIds"])}
|
|
63
|
+
if payload["action"] != "save":
|
|
64
|
+
raise SystemExit("Unknown severity checkpoint action.")
|
|
65
|
+
finding = payload["finding"]
|
|
66
|
+
assessment = {**payload["assessment"], "assessedAt": timestamp}
|
|
67
|
+
with connection:
|
|
68
|
+
# External scan directories may not have been indexed on this machine.
|
|
69
|
+
if (
|
|
70
|
+
connection.execute(
|
|
71
|
+
"SELECT 1 FROM findings WHERE id = ?", (finding["findingId"],)
|
|
72
|
+
).fetchone()
|
|
73
|
+
is None
|
|
74
|
+
):
|
|
75
|
+
upsert_finding(connection, finding, timestamp)
|
|
76
|
+
columns = ", ".join(FIELDS.values())
|
|
77
|
+
parameters = ", ".join("?" for _ in FIELDS)
|
|
78
|
+
updates = ", ".join(f"{column} = excluded.{column}" for column in FIELDS.values())
|
|
79
|
+
connection.execute(
|
|
80
|
+
f"""INSERT INTO finding_severity_assessments ({columns})
|
|
81
|
+
VALUES ({parameters})
|
|
82
|
+
ON CONFLICT(finding_id) DO UPDATE SET
|
|
83
|
+
{updates}""",
|
|
84
|
+
tuple(assessment[key] for key in FIELDS),
|
|
85
|
+
)
|
|
86
|
+
return {}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def read_classification(database: Path, scan_id: str) -> dict[str, Any]:
|
|
90
|
+
uri = f"file:{quote(str(database), safe='')}?mode=ro"
|
|
91
|
+
with closing(sqlite3.connect(uri, uri=True, timeout=5)) as connection:
|
|
92
|
+
connection.row_factory = sqlite3.Row
|
|
93
|
+
connection.execute("BEGIN")
|
|
94
|
+
if (
|
|
95
|
+
connection.execute(
|
|
96
|
+
"SELECT 1 FROM sqlite_master WHERE type = 'table' "
|
|
97
|
+
"AND name = 'scan_severity_classifications'"
|
|
98
|
+
).fetchone()
|
|
99
|
+
is None
|
|
100
|
+
):
|
|
101
|
+
return {}
|
|
102
|
+
row = connection.execute(
|
|
103
|
+
"SELECT * FROM scan_severity_classifications WHERE scan_id = ?", (scan_id,)
|
|
104
|
+
).fetchone()
|
|
105
|
+
if row is None:
|
|
106
|
+
return {}
|
|
107
|
+
finding_ids = json.loads(row["finding_ids_json"])
|
|
108
|
+
return {
|
|
109
|
+
"scanId": scan_id,
|
|
110
|
+
"findingIds": finding_ids,
|
|
111
|
+
"assessedAt": row["assessed_at"],
|
|
112
|
+
"rubricSha256": row["rubric_sha256"],
|
|
113
|
+
"knowledgeBaseSha256": row["knowledge_base_sha256"],
|
|
114
|
+
"assessments": assessments(connection, finding_ids),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
if __name__ == "__main__":
|
|
119
|
+
argparse.ArgumentParser(description=__doc__).parse_args()
|
|
@@ -5,7 +5,9 @@ description: Use when the user asks for a deep, exhaustive, multi-pass, or varia
|
|
|
5
5
|
|
|
6
6
|
# Deep Security Scan
|
|
7
7
|
|
|
8
|
-
Use `start_codex_security_deep_scan` to run repeated independent workers against the exact requested target and scope. Each worker
|
|
8
|
+
Use `start_codex_security_deep_scan` to run repeated independent workers against the exact requested target and scope. Each worker reads `../../references/core-scan.md` directly and completes the ordinary Standard audit, saving checkpoints as results arrive and a final scan draft when the audit finishes.
|
|
9
|
+
|
|
10
|
+
The coordinator combines the finished findings and writes the parent scan's unsealed `scan-manifest.json`, `findings.json`, and `coverage.json` before returning `{ manifestPath }`. The final report identifies the configured directories and exclusions alongside the findings.
|
|
9
11
|
|
|
10
12
|
## Phase Ownership
|
|
11
13
|
|
|
@@ -35,9 +37,9 @@ Do not repeat this guard after it passes, on later context loads, or after the s
|
|
|
35
37
|
|
|
36
38
|
After preserving any native continuation's scan context and applying its one-time concurrent-scan guard, read `../../references/scan-prologue.md` once. Deep scans do not run a capability helper, inspect runtime tools, request configuration remediation, or publish preflight checks. The coordinator validates its own ownership, target, scope, and sandbox and manages its workers independently of this thread's delegation runtime and subagent allowance.
|
|
37
39
|
|
|
38
|
-
##
|
|
40
|
+
## Daybreak Access Advisory
|
|
39
41
|
|
|
40
|
-
Immediately before the first `start_codex_security_deep_scan` call, the top-level parent
|
|
42
|
+
Immediately before the first `start_codex_security_deep_scan` call, the top-level parent calls the plugin's `get_codex_security_daybreak_access` tool once when available; workers never perform this advisory. ChatGPT-authenticated desktop and CLI sessions both support this advisory; API-key-only sessions cannot verify account access. Reuse an existing result when continuing the same scan. Report the exact `status` and available Daybreak programs. If `status` is `not_granted`, prominently warn before scan-start progress that Daybreak access is not granted and protected outputs may not be displayable, and include the returned `enrollmentUrl` as a clickable application link, falling back to `https://chatgpt.com/cyber` when it is absent. If `status` is `unknown`, `stale` is `true`, or the tool is unavailable or fails, warn that access could not be verified and protected outputs may not be displayable. Then continue regardless: the advisory never authorizes, gates, or becomes a capability preflight for the scan. Do not poll or repeat it between phases; recheck only when the user explicitly requests a fresh result after an account or Daybreak access change.
|
|
41
43
|
|
|
42
44
|
## Run Independent Standard Scans
|
|
43
45
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verify-fix
|
|
3
|
-
description: Use when the user
|
|
3
|
+
description: Use only when the user explicitly requests verification that a security fix remediates a reported vulnerability. Do not invoke automatically while implementing fixes, reviewing ordinary code changes, or running tests. Do not use for non-security fixes, candidate finding validation, or full repository scans.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Verify Fix
|
|
7
7
|
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
Invoke this skill only for an explicit request to verify a security fix, including a direct `$verify-fix` invocation. A request to implement a fix or run its tests does not by itself request this skill. For other tasks, follow the user's requested workflow and response format without applying this skill's JSON result contract.
|
|
11
|
+
|
|
8
12
|
## Objective
|
|
9
13
|
|
|
10
14
|
Determine whether each supplied security finding has been fixed in the current checkout. Operate in standalone verification-only mode; do not create, modify, or delete repository files, apply patches, commit changes, write artifacts, or modify issue trackers.
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAqCA,OAAO,EAGL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAWL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AA+B5B,OAAO,EACL,UAAU,EAIX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAqCA,OAAO,EAGL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAWL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AA+B5B,OAAO,EACL,UAAU,EAIX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKhF,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAYL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AE,YAAqB,EAC3B,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,UAAQ,GAClB,kBAAkB,CAwCpB;AAED,oFAAoF;AACpF,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAWR;AA8JD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GAEZ,cAAc,GACd,cAAc,GACd,WAAW,GACX,eAAe,GACf,SAAS,GACT,SAAS,CAmCZ;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,EAClB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,UAAU,CAsCZ;AAoCD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAyHvE;AAkFD,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,EAC/B,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAcpB"}
|
package/dist/api.js
CHANGED
|
@@ -928,11 +928,10 @@ export class CodexSecurity {
|
|
|
928
928
|
falsePositives: falsePositiveExamples,
|
|
929
929
|
findings: result.findings.findings,
|
|
930
930
|
workbench: runWorkbench,
|
|
931
|
-
matchFindings: this.#dependencies.matchFindings ??
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
})),
|
|
931
|
+
matchFindings: (input, comparisonOptions) => (this.#dependencies.matchFindings ?? matchScanFindingsInternal)(input, comparisonOptions, {
|
|
932
|
+
surface: this.#surface,
|
|
933
|
+
singleTurn: options.maxCostUsd !== undefined,
|
|
934
|
+
}),
|
|
936
935
|
environment,
|
|
937
936
|
model,
|
|
938
937
|
signal,
|