Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

refactor(plugin): share finalizer fixtures and migration moves (#1216)

mldangelo-oaidff043688e8e
diff --git a/plugins/codex-security/scripts/workbench_db.py b/plugins/codex-security/scripts/workbench_db.py
index c1d08a3c5..0ea3217b6 100644
--- a/plugins/codex-security/scripts/workbench_db.py
+++ b/plugins/codex-security/scripts/workbench_db.py
@@ -2882,14 +2882,7 @@ def backfill_legacy_finding_details(connection: sqlite3.Connection, scan: sqlite
except (ContractError, OSError, SystemExit, ValueError):
return
- findings = findings_document.get("findings")
- if not isinstance(findings, list):
- return
- by_occurrence = {
- finding.get("occurrenceId"): finding
- for finding in findings
- if isinstance(finding, dict) and isinstance(finding.get("occurrenceId"), str)
- }
+ by_occurrence = {finding["occurrenceId"]: finding for finding in findings_document["findings"]}
updates = []
for row in legacy_rows:
finding = by_occurrence.get(row["id"])
@@ -2933,17 +2926,13 @@ def backfill_legacy_finding_details(connection: sqlite3.Connection, scan: sqlite
def legacy_finding_matches(row: sqlite3.Row, finding: Any) -> bool:
if not isinstance(finding, dict):
return False
- severity = finding.get("severity")
- confidence = finding.get("confidence")
return (
finding.get("findingId") == row["finding_id"]
and finding.get("title") == row["title"]
and finding.get("summary") == row["summary"]
and finding.get("remediation") == row["remediation"]
- and isinstance(severity, dict)
- and severity.get("level") == row["severity"]
- and isinstance(confidence, dict)
- and confidence.get("level") == row["confidence"]
+ and finding["severity"]["level"] == row["severity"]
+ and finding["confidence"]["level"] == row["confidence"]
)
@@ -3019,7 +3008,6 @@ def finding_result(
result["knownScanIds"] = known_scan_ids
if related:
result["related"] = related
- result.pop("artifactPaths", None)
source_excerpt = finding_source_excerpt(scan, target, locations)
if source_excerpt:
result["sourceExcerpt"] = source_excerpt
diff --git a/plugins/codex-security/scripts/workbench_finding_index.py b/plugins/codex-security/scripts/workbench_finding_index.py
index e0352688b..b898a65f4 100644
--- a/plugins/codex-security/scripts/workbench_finding_index.py
+++ b/plugins/codex-security/scripts/workbench_finding_index.py
@@ -52,15 +52,10 @@ def index_findings(
document: dict[str, Any],
timestamp: str,
) -> None:
- findings = document.get("findings")
- if not isinstance(findings, list):
- raise SystemExit("findings.json must contain a findings array.")
repository_id = connection.execute(
"SELECT target_id FROM scans WHERE id = ?", (scan_id,)
).fetchone()["target_id"]
- for finding in findings:
- if not isinstance(finding, dict):
- raise SystemExit("findings.json entries must be objects.")
+ for finding in document["findings"]:
severity = finding["severity"]
confidence = finding["confidence"]
upsert_finding(connection, finding, timestamp, repository_id)
diff --git a/plugins/codex-security/scripts/workbench_schema.py b/plugins/codex-security/scripts/workbench_schema.py
index 9efb0be4b..d3c414620 100644
--- a/plugins/codex-security/scripts/workbench_schema.py
+++ b/plugins/codex-security/scripts/workbench_schema.py
@@ -1146,6 +1146,29 @@ def normalize_pre_release_execution_profile_migrations(
)
+def move_pre_release_migration(
+ connection: sqlite3.Connection, old_version: int, new_version: int, name: str
+) -> None:
+ migration = connection.execute(
+ "SELECT name FROM schema_migrations WHERE version = ?", (old_version,)
+ ).fetchone()
+ if migration is None or migration["name"] != name:
+ return
+ if (
+ connection.execute(
+ "SELECT 1 FROM schema_migrations WHERE version = ?", (new_version,)
+ ).fetchone()
+ is not None
+ ):
+ raise SystemExit(
+ "The Codex Security database has an unsupported pre-release migration history."
+ )
+ connection.execute(
+ "UPDATE schema_migrations SET version = ? WHERE version = ? AND name = ?",
+ (new_version, old_version, name),
+ )
+
+
def normalize_pre_release_migrations(connection: sqlite3.Connection, timestamp: str) -> None:
normalize_mirror_lineage_migrations(connection)
connection.execute(
@@ -1153,64 +1176,12 @@ def normalize_pre_release_migrations(connection: sqlite3.Connection, timestamp:
("index finding identity and comparison history",),
)
- completion_warning_migration = connection.execute(
- "SELECT name FROM schema_migrations WHERE version = 25"
- ).fetchone()
- if (
- completion_warning_migration is not None
- and completion_warning_migration["name"] == "persist scan completion warnings"
- ):
- if (
- connection.execute("SELECT 1 FROM schema_migrations WHERE version = 26").fetchone()
- is not None
- ):
- raise SystemExit(
- "The Codex Security database has an unsupported pre-release migration history."
- )
- connection.execute(
- "UPDATE schema_migrations SET version = 26 WHERE version = 25 AND name = ?",
- ("persist scan completion warnings",),
- )
-
- phase_progress_migration = connection.execute(
- "SELECT name FROM schema_migrations WHERE version = 12"
- ).fetchone()
- if (
- phase_progress_migration is not None
- and phase_progress_migration["name"] == "phase-specific scan progress"
- ):
- target_migration = connection.execute(
- "SELECT name FROM schema_migrations WHERE version = 20"
- ).fetchone()
- if target_migration is not None:
- raise SystemExit(
- "The Codex Security database has an unsupported pre-release migration history."
- )
- connection.execute(
- "UPDATE schema_migrations SET version = 20 WHERE version = 12 AND name = ?",
- ("phase-specific scan progress",),
- )
+ move_pre_release_migration(connection, 25, 26, "persist scan completion warnings")
+ move_pre_release_migration(connection, 12, 20, "phase-specific scan progress")
normalize_pre_release_execution_profile_migrations(connection, timestamp)
- preflight_progress_migration = connection.execute(
- "SELECT name FROM schema_migrations WHERE version = 13"
- ).fetchone()
- if (
- preflight_progress_migration is not None
- and preflight_progress_migration["name"] == "current scan preflight state"
- ):
- target_migration = connection.execute(
- "SELECT name FROM schema_migrations WHERE version = 21"
- ).fetchone()
- if target_migration is not None:
- raise SystemExit(
- "The Codex Security database has an unsupported pre-release migration history."
- )
- connection.execute(
- "UPDATE schema_migrations SET version = 21 WHERE version = 13 AND name = ?",
- ("current scan preflight state",),
- )
+ move_pre_release_migration(connection, 13, 21, "current scan preflight state")
delivered_claim_migration = connection.execute(
"SELECT name FROM schema_migrations WHERE version = 18"
diff --git a/plugins/codex-security/tests/test_finalize_scan_contract.py b/plugins/codex-security/tests/test_finalize_scan_contract.py
index bdd7d1220..2b458330e 100644
--- a/plugins/codex-security/tests/test_finalize_scan_contract.py
+++ b/plugins/codex-security/tests/test_finalize_scan_contract.py
@@ -116,6 +116,24 @@ class FinalizeScanContractTest(ScanFixtureTestCase):
"deferred": [],
}
+ def write_sealed_scan(self) -> None:
+ self.write_scan()
+ FINALIZER.finalize_scan(self.scan_dir)
+
+ def run_finalizer(self, *args: str) -> subprocess.CompletedProcess[str]:
+ return subprocess.run(
+ [
+ sys.executable,
+ str(Path(FINALIZER.__file__)),
+ "--scan-dir",
+ str(self.scan_dir),
+ *args,
+ ],
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
def write_scan(self) -> None:
self.write_json("scan-manifest.json", self.manifest)
self.write_json("findings.json", self.findings)
@@ -348,8 +366,7 @@ The extraction root is not enforced.
validate.assert_not_called()
def test_sealed_rerun_rejects_malformed_unicode_extensions_without_mutating_files(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["extensions"]["note"] = "bad-" + chr(0xD800)
self.write_json("findings.json", findings)
@@ -370,8 +387,7 @@ The extraction root is not enforced.
self.assertEqual(before, after)
def test_sealed_rerun_preserves_existing_document_bytes(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["summary"] = "é" * 128
compact = (json.dumps(findings, ensure_ascii=False, separators=(",", ":")) + "\n").encode(
@@ -393,8 +409,7 @@ The extraction root is not enforced.
self.assertEqual(path.read_bytes(), compact)
def test_sealed_rerun_accepts_legacy_unknown_evidence_references(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["codeEvidence"] = [
{
@@ -423,8 +438,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_findings)
def test_sealed_rerun_ignores_malformed_legacy_evidence_references(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["code_evidence"] = [
{"id": "legacy-source", "code": "legacy_source()"}
@@ -454,8 +468,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_sealed_rerun_accepts_duplicate_legacy_evidence_ids(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["code_evidence"] = [
{"id": "legacy-duplicate", "code": "first_legacy_source()"},
@@ -470,8 +483,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_findings)
def test_sealed_rerun_ignores_non_string_legacy_validation_scalars(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["validation"] = {
"method": [],
@@ -486,8 +498,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_findings)
def test_sealed_rerun_accepts_formerly_free_form_finding_details(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["validation"] = {
"evidence": {"kind": "trace"},
@@ -504,8 +515,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_findings)
def test_sealed_rerun_ignores_blank_legacy_attack_path_details(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["attackPath"] = {
field: ""
@@ -527,8 +537,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_findings)
def test_sealed_rerun_rejects_nullable_canonical_evidence_catalog(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["codeEvidence"] = None
self.rewrite_sealed_artifact("findings.json", findings)
@@ -701,8 +710,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_rerun_regenerates_sarif_projection_without_mutating_seal(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
first_manifest = (self.scan_dir / "scan-manifest.json").read_bytes()
source_root = self.scan_dir / "source"
@@ -737,8 +745,7 @@ The extraction root is not enforced.
self.assertEqual(manifest["scan"]["sealedAt"], "2026-05-31T18:09:00Z")
def test_sarif_only_entrypoint_exports_a_sealed_scan_without_mutating_it(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
sarif_path = self.scan_dir / "exports" / "results.sarif"
sarif_path.unlink()
canonical = {
@@ -746,18 +753,7 @@ The extraction root is not enforced.
for name in ("scan-manifest.json", "findings.json", "coverage.json", "report.md")
}
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only")
self.assertEqual(result.returncode, 0, result.stderr)
sarif = json.loads(result.stdout)
@@ -781,8 +777,7 @@ The extraction root is not enforced.
{"path": "src/extract.py", "startLine": 41, "endLine": 44, "role": "root_control"},
]
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
canonical = {
name: (self.scan_dir / name).read_bytes()
for name in ("scan-manifest.json", "findings.json", "coverage.json", "report.md")
@@ -843,22 +838,9 @@ The extraction root is not enforced.
self.coverage["mode"] = "deep_repository"
self.finding["extensions"] = {"candidateId": "DSS-145", "reportId": "DSS-145-rogue"}
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", "csv")
self.assertEqual(result.returncode, 0, result.stderr)
reader = csv.DictReader(io.StringIO(result.stdout, newline=""))
@@ -872,22 +854,9 @@ The extraction root is not enforced.
self.finding["extensions"] = {"candidateId": "DSS-146", "reportId": "DSS-146-rogue"}
self.finding["locations"] = [{"path": "src/extract.py", "startLine": 41, "role": "sink"}]
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", "csv")
self.assertEqual(result.returncode, 0, result.stderr)
reader = csv.DictReader(io.StringIO(result.stdout, newline=""))
@@ -906,22 +875,9 @@ The extraction root is not enforced.
self.coverage["mode"] = coverage_mode
self.finding["extensions"] = {field: f"legacy-{field}"}
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", "csv")
self.assertEqual(result.returncode, 0, result.stderr)
reader = csv.DictReader(io.StringIO(result.stdout, newline=""))
@@ -932,22 +888,9 @@ The extraction root is not enforced.
self.coverage["mode"] = "scoped_path"
self.finding["extensions"] = {"ledgerRowId": "SCAN-001-parser"}
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", "csv")
self.assertEqual(result.returncode, 0, result.stderr)
reader = csv.DictReader(io.StringIO(result.stdout, newline=""))
@@ -958,22 +901,9 @@ The extraction root is not enforced.
self.finding["summary"] = "=1+1"
self.finding["remediation"] = " \t+1+1"
self.findings["findings"] = [copy.deepcopy(self.finding)]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", "csv")
self.assertEqual(result.returncode, 0, result.stderr)
row = next(csv.DictReader(io.StringIO(result.stdout, newline="")))
@@ -985,19 +915,7 @@ The extraction root is not enforced.
self.write_scan()
for export_format in ("json", "csv"):
with self.subTest(export_format=export_format, state="unsealed"):
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- export_format,
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", export_format)
self.assertNotEqual(result.returncode, 0)
self.assertIn(
f"{export_format.upper()} export requires a sealed scan", result.stderr
@@ -1007,59 +925,18 @@ The extraction root is not enforced.
self.write_json("findings.json", {"changed": True})
for export_format in ("json", "csv"):
with self.subTest(export_format=export_format, state="tampered"):
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- export_format,
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--export-format", export_format)
self.assertNotEqual(result.returncode, 0)
self.assertIn("sealed artifact changed or is missing", result.stderr)
def test_export_entrypoint_writes_external_output_and_rejects_artifact_overwrite(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.scan_dir / "findings.json"
before = findings.read_bytes()
output = self.scan_dir.parent / "findings.csv"
- exported = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- "--export-output",
- str(output),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
- rejected = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "json",
- "--export-output",
- str(findings),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ exported = self.run_finalizer("--export-format", "csv", "--export-output", str(output))
+ rejected = self.run_finalizer("--export-format", "json", "--export-output", str(findings))
self.assertEqual(exported.returncode, 0, exported.stderr)
self.assertTrue(output.read_text().startswith("occurrence_id,finding_id,title,summary"))
@@ -1077,8 +954,7 @@ The extraction root is not enforced.
"exports/sealed-findings.csv",
):
with self.subTest(artifact_path=artifact_path):
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
output = self.scan_dir / "exports" / "findings.csv"
output.parent.mkdir(parents=True, exist_ok=True)
sealed_export = b"SEALED_EXPORT_SENTINEL\n"
@@ -1100,20 +976,11 @@ The extraction root is not enforced.
)
self.write_json("scan-manifest.json", manifest)
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- "--export-output",
- str(output),
- ],
- capture_output=True,
- text=True,
- check=False,
+ result = self.run_finalizer(
+ "--export-format",
+ "csv",
+ "--export-output",
+ str(output),
)
self.assertNotEqual(result.returncode, 0)
@@ -1124,8 +991,7 @@ The extraction root is not enforced.
self.assertEqual(output.read_bytes(), sealed_export)
def test_export_entrypoint_rejects_a_case_aliased_scan_directory(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
alias = self.scan_dir.parent / self.scan_dir.name.swapcase()
if alias == self.scan_dir or not alias.exists() or not alias.samefile(self.scan_dir):
self.skipTest("filesystem is case-sensitive")
@@ -1144,20 +1010,11 @@ The extraction root is not enforced.
)
self.write_json("scan-manifest.json", manifest)
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- "--export-output",
- str(alias / "exports" / "findings.csv"),
- ],
- capture_output=True,
- text=True,
- check=False,
+ result = self.run_finalizer(
+ "--export-format",
+ "csv",
+ "--export-output",
+ str(alias / "exports" / "findings.csv"),
)
self.assertNotEqual(result.returncode, 0)
@@ -1165,8 +1022,7 @@ The extraction root is not enforced.
self.assertEqual(output.read_bytes(), sealed_export)
def test_export_entrypoint_rejects_symlink_aliased_scan_directories(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
output = self.scan_dir / "exports" / "findings.csv"
protected_contents = b"PROTECTED_EXPORT_SENTINEL\n"
@@ -1180,20 +1036,11 @@ The extraction root is not enforced.
for alias in (direct_alias, parent_alias / self.scan_dir.name):
with self.subTest(alias=str(alias)):
output.write_bytes(protected_contents)
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--export-format",
- "csv",
- "--export-output",
- str(alias / "exports" / "findings.csv"),
- ],
- capture_output=True,
- text=True,
- check=False,
+ result = self.run_finalizer(
+ "--export-format",
+ "csv",
+ "--export-output",
+ str(alias / "exports" / "findings.csv"),
)
self.assertNotEqual(result.returncode, 0)
@@ -1214,18 +1061,7 @@ The extraction root is not enforced.
for name in ("scan-manifest.json", "findings.json", "coverage.json")
}
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- *arguments,
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer(*arguments)
self.assertNotEqual(result.returncode, 0)
self.assertIn("requires", result.stderr)
@@ -1235,78 +1071,38 @@ The extraction root is not enforced.
)
def test_sarif_only_entrypoint_rejects_changed_sealed_artifact(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
self.write_json("findings.json", {"changed": True})
sarif_path = self.scan_dir / "exports" / "results.sarif"
sarif_path.unlink()
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only")
self.assertNotEqual(result.returncode, 0)
self.assertIn("sealed artifact changed or is missing", result.stderr)
self.assertFalse(sarif_path.exists())
def test_sarif_only_entrypoint_rejects_invalid_source_root(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
source_file = self.scan_dir / "source-file"
source_file.write_text("not a directory\n", encoding="utf-8")
for source_root in (self.scan_dir / "missing-source", source_file):
for export_args in (("--sarif-only",), ("--export-format", "sarif")):
with self.subTest(source_root=str(source_root), export_args=export_args):
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- *export_args,
- "--source-root",
- str(source_root),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer(*export_args, "--source-root", str(source_root))
self.assertNotEqual(result.returncode, 0)
self.assertIn("source root: expected an existing directory", result.stderr)
self.assertEqual(result.stdout, "")
def test_sarif_only_entrypoint_writes_external_output_atomically(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
sarif_path = self.scan_dir / "exports" / "results.sarif"
sarif_path.unlink()
output = self.scan_dir.parent / "results.sarif"
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- "--sarif-output",
- str(output),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only", "--sarif-output", str(output))
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout, "")
@@ -1317,28 +1113,14 @@ The extraction root is not enforced.
self.write_scan()
output = self.scan_dir / "exports" / "results.sarif"
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- "--sarif-output",
- str(output),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only", "--sarif-output", str(output))
self.assertNotEqual(result.returncode, 0)
self.assertIn("SARIF projection requires a sealed scan", result.stderr)
self.assertFalse(output.parent.exists())
def test_sarif_only_entrypoint_rejects_sealed_artifact_output(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.scan_dir / "findings.json"
before = findings.read_bytes()
@@ -1364,48 +1146,22 @@ The extraction root is not enforced.
@unittest.skipIf(os.name == "nt", "backslash is a path separator on Windows")
def test_sarif_only_entrypoint_accepts_posix_backslash_output_name(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
output = self.scan_dir.parent / "results\\v1.sarif"
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- "--sarif-output",
- str(output),
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only", "--sarif-output", str(output))
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(json.loads(output.read_text(encoding="utf-8"))["version"], "2.1.0")
def test_sarif_only_entrypoint_accepts_read_only_scan_directory(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
sarif_path = self.scan_dir / "exports" / "results.sarif"
sarif_path.unlink()
sarif_path.parent.rmdir()
self.scan_dir.chmod(0o500)
try:
- result = subprocess.run(
- [
- sys.executable,
- str(Path(FINALIZER.__file__)),
- "--scan-dir",
- str(self.scan_dir),
- "--sarif-only",
- ],
- capture_output=True,
- text=True,
- check=False,
- )
+ result = self.run_finalizer("--sarif-only")
finally:
self.scan_dir.chmod(0o700)
@@ -1465,8 +1221,7 @@ The extraction root is not enforced.
self.assertEqual(payload, {"source": "original"})
def test_sarif_projection_revalidates_sealed_findings(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["locations"][0]["path"] = "../../outside.py"
self.write_json("findings.json", findings)
@@ -1480,8 +1235,7 @@ The extraction root is not enforced.
FINALIZER.write_sarif_projection(self.scan_dir)
def test_sarif_projection_uses_findings_read_before_seal_validation(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
original_summary = self.finding["summary"]
replaced = self.read_json("findings.json")
replaced["findings"][0]["summary"] = "Replaced after seal validation"
@@ -1508,8 +1262,7 @@ The extraction root is not enforced.
self.assertNotIn("Replaced after seal validation", result["message"]["text"])
def test_sarif_projection_hashes_the_findings_bytes_it_parsed(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings_path = self.scan_dir / "findings.json"
sealed_bytes = findings_path.read_bytes()
replaced = self.read_json("findings.json")
@@ -1563,8 +1316,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_sarif_projection_requires_canonical_sealed_artifacts(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
sealed_manifest = self.read_json("scan-manifest.json")
for required_path in ("findings.json", "coverage.json"):
@@ -1600,8 +1352,7 @@ The extraction root is not enforced.
FINALIZER.write_sarif_projection(self.scan_dir)
def test_sarif_projection_revalidates_manifest_schema(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
manifest = self.read_json("scan-manifest.json")
manifest["scan"]["startedAt"] = "not-a-time"
self.write_json("scan-manifest.json", manifest)
@@ -1692,15 +1443,13 @@ The extraction root is not enforced.
self.assertEqual(findings, original)
def test_rejects_changed_canonical_artifact_after_sealing(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
(self.scan_dir / "findings.json").write_text("{}\n", encoding="utf-8")
with self.assertRaisesRegex(FINALIZER.ContractError, "sealed artifact changed"):
FINALIZER.finalize_scan(self.scan_dir)
def test_rejects_sealed_findings_missing_derived_identity(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
sealed_manifest = self.read_json("scan-manifest.json")
sealed_findings = self.read_json("findings.json")
@@ -1979,8 +1728,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_sealed_rerun_accepts_legacy_scalar_finding_details(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["validation"] = {
"assertions": "The destination escapes the extraction root.",
@@ -2032,8 +1780,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_bytes)
def test_sealed_rerun_rejects_malformed_canonical_root_cause(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["rootCause"] = {"summary": []}
self.rewrite_sealed_artifact("findings.json", findings)
@@ -2048,8 +1795,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_bytes)
def test_sealed_rerun_accepts_nullable_legacy_evidence_catalog(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["code_evidence"] = None
self.rewrite_sealed_artifact("findings.json", findings)
@@ -2061,8 +1807,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_bytes)
def test_sealed_rerun_accepts_empty_legacy_root_cause(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["root_cause"] = ""
self.rewrite_sealed_artifact("findings.json", findings)
@@ -2074,8 +1819,7 @@ The extraction root is not enforced.
self.assertEqual((self.scan_dir / "findings.json").read_bytes(), sealed_bytes)
def test_sealed_rerun_ignores_malformed_legacy_evidence_rows(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["code_evidence"] = [
None,
@@ -2127,8 +1871,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_sealed_rerun_accepts_legacy_sequence_attack_path_details(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["attackPath"] = {
"dataflow": ["archive entry path", "filesystem write"],
@@ -2159,8 +1902,7 @@ The extraction root is not enforced.
FINALIZER._json_bytes({"score": float("nan")})
def test_sealed_rerun_regenerates_reports_without_mutating_canonical_artifacts(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
canonical_before = {
name: (self.scan_dir / name).read_bytes()
for name in ("scan-manifest.json", "findings.json", "coverage.json")
@@ -2255,8 +1997,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_rerun_preserves_additional_sealed_artifact_records(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
extra_path = self.scan_dir / "exports" / "extra.json"
extra_path.parent.mkdir(parents=True, exist_ok=True)
extra_path.write_text("{}\n", encoding="utf-8")
@@ -2592,8 +2333,7 @@ The extraction root is not enforced.
self.assertFalse(warnings)
def test_sealed_findings_keep_authored_identity_mismatches_strict(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
findings = self.read_json("findings.json")
findings["findings"][0]["findingId"] = "csf_wrong"
self.rewrite_sealed_artifact("findings.json", findings)
@@ -2717,8 +2457,7 @@ The extraction root is not enforced.
self.assertEqual(manifest["scan"]["findingsRef"], "findings.json")
def test_sealed_contract_refs_remain_strict(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
manifest = self.read_json("scan-manifest.json")
manifest["scan"]["coverageRef"] = "not-the-coverage.json"
self.write_json("scan-manifest.json", manifest)
@@ -2893,8 +2632,7 @@ The extraction root is not enforced.
def test_sealed_coverage_mode_and_open_questions_remain_strict(self) -> None:
self.coverage["openQuestions"] = [{"question": "Still valid before sealing."}]
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
coverage = self.read_json("coverage.json")
coverage["mode"] = "scoped_path"
coverage["openQuestions"] = ["invalid sealed row"]
@@ -2912,8 +2650,7 @@ The extraction root is not enforced.
FINALIZER.finalize_scan(self.scan_dir)
def test_rejects_duplicate_artifact_paths(self) -> None:
- self.write_scan()
- FINALIZER.finalize_scan(self.scan_dir)
+ self.write_sealed_scan()
manifest = self.read_json("scan-manifest.json")
manifest["scan"]["artifacts"].append(copy.deepcopy(manifest["scan"]["artifacts"][0]))
self.write_json("scan-manifest.json", manifest)
diff --git a/plugins/codex-security/tests/test_workbench_setup_and_migrations.py b/plugins/codex-security/tests/test_workbench_setup_and_migrations.py
index 679ee77c1..b622d7454 100644
--- a/plugins/codex-security/tests/test_workbench_setup_and_migrations.py
+++ b/plugins/codex-security/tests/test_workbench_setup_and_migrations.py
@@ -26,6 +26,50 @@ from workbench_test_support import (
write_completed_contract,
)
+EXPECTED_MIGRATIONS = [
+ (1, "initial workbench schema"),
+ (2, "persist capability preflight summaries"),
+ (3, "finding management schema"),
+ (4, "scan handoff delivery claims"),
+ (5, "finding remediation action claims"),
+ (6, "thread-scoped workspaces"),
+ (7, "remediation host delivery state"),
+ (8, "sealed manifest digests"),
+ (9, "scan target filesystem identity"),
+ (10, "scan cancellation state"),
+ (11, "deep scan orchestration state"),
+ (12, "scan continuation threads"),
+ (13, "scan scope file counts"),
+ (14, "imported triage results"),
+ (15, "append-only finding decisions"),
+ (16, "stable repository targets"),
+ (17, "scan target summaries"),
+ (18, "clear legacy delivered handoff claims"),
+ (19, "persist setup workspace preference"),
+ (20, "phase-specific scan progress"),
+ (21, "current scan preflight state"),
+ (22, "replayable scan launch recipes"),
+ (23, "semantic scan comparison matches"),
+ (24, "persist scan cost estimates"),
+ (25, "persist scan model settings"),
+ (26, "persist scan completion warnings"),
+ (27, "persist deep scan consecutive discovery failures"),
+ (28, "persist deep scan discovery time limit"),
+ (29, "persist finding publication associations"),
+ (30, "preserve team-only finding publication associations"),
+ (31, "freeze stopped scan source digests"),
+ (32, "separate deep scan publication failures"),
+ (33, "store complete findings and embeddings without a scan"),
+ (34, "associate findings with repositories"),
+ (35, "persist finding dedupe groups"),
+ (36, "persist local findings workflows"),
+ (37, "checkpoint validated dedupe reviews"),
+ (38, "store findings workflow metadata in columns"),
+ (39, "store dedupe checkpoint bindings in columns"),
+ (40, "index finding identity and comparison history"),
+ (41, "checkpoint finding severity assessments"),
+]
+
def test_sqlite_snapshot_includes_uncheckpointed_wal_rows(tmp_path: Path) -> None:
source = tmp_path / "source.sqlite3"
@@ -825,49 +869,10 @@ def test_workbench_creates_single_final_schema(tmp_path: Path) -> None:
run_workbench(state_dir, "database-info")
with sqlite3.connect(state_dir / "workbench.sqlite3") as connection:
- assert connection.execute("SELECT version, name FROM schema_migrations").fetchall() == [
- (1, "initial workbench schema"),
- (2, "persist capability preflight summaries"),
- (3, "finding management schema"),
- (4, "scan handoff delivery claims"),
- (5, "finding remediation action claims"),
- (6, "thread-scoped workspaces"),
- (7, "remediation host delivery state"),
- (8, "sealed manifest digests"),
- (9, "scan target filesystem identity"),
- (10, "scan cancellation state"),
- (11, "deep scan orchestration state"),
- (12, "scan continuation threads"),
- (13, "scan scope file counts"),
- (14, "imported triage results"),
- (15, "append-only finding decisions"),
- (16, "stable repository targets"),
- (17, "scan target summaries"),
- (18, "clear legacy delivered handoff claims"),
- (19, "persist setup workspace preference"),
- (20, "phase-specific scan progress"),
- (21, "current scan preflight state"),
- (22, "replayable scan launch recipes"),
- (23, "semantic scan comparison matches"),
- (24, "persist scan cost estimates"),
- (25, "persist scan model settings"),
- (26, "persist scan completion warnings"),
- (27, "persist deep scan consecutive discovery failures"),
- (28, "persist deep scan discovery time limit"),
- (29, "persist finding publication associations"),
- (30, "preserve team-only finding publication associations"),
- (31, "freeze stopped scan source digests"),
- (32, "separate deep scan publication failures"),
- (33, "store complete findings and embeddings without a scan"),
- (34, "associate findings with repositories"),
- (35, "persist finding dedupe groups"),
- (36, "persist local findings workflows"),
- (37, "checkpoint validated dedupe reviews"),
- (38, "store findings workflow metadata in columns"),
- (39, "store dedupe checkpoint bindings in columns"),
- (40, "index finding identity and comparison history"),
- (41, "checkpoint finding severity assessments"),
- ]
+ assert (
+ connection.execute("SELECT version, name FROM schema_migrations").fetchall()
+ == EXPECTED_MIGRATIONS
+ )
assert {row[1] for row in connection.execute("PRAGMA table_info(workspaces)")} >= {
"diff_target_kind",
"diff_base_revision",
@@ -1954,49 +1959,10 @@ def test_workbench_upgrades_released_database_schema(tmp_path: Path) -> None:
run_workbench(state_dir, "database-info")
with sqlite3.connect(database) as connection:
- assert connection.execute("SELECT version, name FROM schema_migrations").fetchall() == [
- (1, "initial workbench schema"),
- (2, "persist capability preflight summaries"),
- (3, "finding management schema"),
- (4, "scan handoff delivery claims"),
- (5, "finding remediation action claims"),
- (6, "thread-scoped workspaces"),
- (7, "remediation host delivery state"),
- (8, "sealed manifest digests"),
- (9, "scan target filesystem identity"),
- (10, "scan cancellation state"),
- (11, "deep scan orchestration state"),
- (12, "scan continuation threads"),
- (13, "scan scope file counts"),
- (14, "imported triage results"),
- (15, "append-only finding decisions"),
- (16, "stable repository targets"),
- (17, "scan target summaries"),
- (18, "clear legacy delivered handoff claims"),
- (19, "persist setup workspace preference"),
- (20, "phase-specific scan progress"),
- (21, "current scan preflight state"),
- (22, "replayable scan launch recipes"),
- (23, "semantic scan comparison matches"),
- (24, "persist scan cost estimates"),
- (25, "persist scan model settings"),
- (26, "persist scan completion warnings"),
- (27, "persist deep scan consecutive discovery failures"),
- (28, "persist deep scan discovery time limit"),
- (29, "persist finding publication associations"),
- (30, "preserve team-only finding publication associations"),
- (31, "freeze stopped scan source digests"),
- (32, "separate deep scan publication failures"),
- (33, "store complete findings and embeddings without a scan"),
- (34, "associate findings with repositories"),
- (35, "persist finding dedupe groups"),
- (36, "persist local findings workflows"),
- (37, "checkpoint validated dedupe reviews"),
- (38, "store findings workflow metadata in columns"),
- (39, "store dedupe checkpoint bindings in columns"),
- (40, "index finding identity and comparison history"),
- (41, "checkpoint finding severity assessments"),
- ]
+ assert (
+ connection.execute("SELECT version, name FROM schema_migrations").fetchall()
+ == EXPECTED_MIGRATIONS
+ )
assert "capability_preflight_json" in {
row[1] for row in connection.execute("PRAGMA table_info(workspaces)")
}
@@ -2046,40 +2012,12 @@ def test_workbench_upgrades_pre_release_phase_progress_migration(tmp_path: Path)
run_workbench(state_dir, "database-info")
with sqlite3.connect(database) as connection:
- assert connection.execute(
- "SELECT version, name FROM schema_migrations WHERE version >= 12 ORDER BY version"
- ).fetchall() == [
- (12, "scan continuation threads"),
- (13, "scan scope file counts"),
- (14, "imported triage results"),
- (15, "append-only finding decisions"),
- (16, "stable repository targets"),
- (17, "scan target summaries"),
- (18, "clear legacy delivered handoff claims"),
- (19, "persist setup workspace preference"),
- (20, "phase-specific scan progress"),
- (21, "current scan preflight state"),
- (22, "replayable scan launch recipes"),
- (23, "semantic scan comparison matches"),
- (24, "persist scan cost estimates"),
- (25, "persist scan model settings"),
- (26, "persist scan completion warnings"),
- (27, "persist deep scan consecutive discovery failures"),
- (28, "persist deep scan discovery time limit"),
- (29, "persist finding publication associations"),
- (30, "preserve team-only finding publication associations"),
- (31, "freeze stopped scan source digests"),
- (32, "separate deep scan publication failures"),
- (33, "store complete findings and embeddings without a scan"),
- (34, "associate findings with repositories"),
- (35, "persist finding dedupe groups"),
- (36, "persist local findings workflows"),
- (37, "checkpoint validated dedupe reviews"),
- (38, "store findings workflow metadata in columns"),
- (39, "store dedupe checkpoint bindings in columns"),
- (40, "index finding identity and comparison history"),
- (41, "checkpoint finding severity assessments"),
- ]
+ assert (
+ connection.execute(
+ "SELECT version, name FROM schema_migrations WHERE version >= 12 ORDER BY version"
+ ).fetchall()
+ == EXPECTED_MIGRATIONS[11:]
+ )
assert "continuation_thread_id" in {
row[1] for row in connection.execute("PRAGMA table_info(scans)")
}
@@ -2137,40 +2075,12 @@ def test_workbench_upgrades_pre_release_preflight_progress_migration(tmp_path: P
run_workbench(state_dir, "database-info")
with sqlite3.connect(database) as connection:
- assert connection.execute(
- "SELECT version, name FROM schema_migrations WHERE version >= 12 ORDER BY version"
- ).fetchall() == [
- (12, "scan continuation threads"),
- (13, "scan scope file counts"),
- (14, "imported triage results"),
- (15, "append-only finding decisions"),
- (16, "stable repository targets"),
- (17, "scan target summaries"),
- (18, "clear legacy delivered handoff claims"),
- (19, "persist setup workspace preference"),
- (20, "phase-specific scan progress"),
- (21, "current scan preflight state"),
- (22, "replayable scan launch recipes"),
- (23, "semantic scan comparison matches"),
- (24, "persist scan cost estimates"),
- (25, "persist scan model settings"),
- (26, "persist scan completion warnings"),
- (27, "persist deep scan consecutive discovery failures"),
- (28, "persist deep scan discovery time limit"),
- (29, "persist finding publication associations"),
- (30, "preserve team-only finding publication associations"),
- (31, "freeze stopped scan source digests"),
- (32, "separate deep scan publication failures"),
- (33, "store complete findings and embeddings without a scan"),
- (34, "associate findings with repositories"),
- (35, "persist finding dedupe groups"),
- (36, "persist local findings workflows"),
- (37, "checkpoint validated dedupe reviews"),
- (38, "store findings workflow metadata in columns"),
- (39, "store dedupe checkpoint bindings in columns"),
- (40, "index finding identity and comparison history"),
- (41, "checkpoint finding severity assessments"),
- ]
+ assert (
+ connection.execute(
+ "SELECT version, name FROM schema_migrations WHERE version >= 12 ORDER BY version"
+ ).fetchall()
+ == EXPECTED_MIGRATIONS[11:]
+ )
assert "continuation_thread_id" in {
row[1] for row in connection.execute("PRAGMA table_info(scans)")
}