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

chore(codex-security): sync public projection

faizan-oai5695656bd89f
diff --git a/sdk/typescript/_bundled_plugin/mcp/mcp-app.html.br b/sdk/typescript/_bundled_plugin/mcp/mcp-app.html.br
index a5ad5b1c6..ef829af4e 100644
Binary files a/sdk/typescript/_bundled_plugin/mcp/mcp-app.html.br and b/sdk/typescript/_bundled_plugin/mcp/mcp-app.html.br differ
diff --git a/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-000 b/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-000
index b31598a9f..674a91143 100644
Binary files a/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-000 and b/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-000 differ
diff --git a/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-001 b/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-001
index 999653905..5cc43a4b0 100644
Binary files a/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-001 and b/sdk/typescript/_bundled_plugin/mcp/server.mjs.br.part-001 differ
diff --git a/sdk/typescript/_bundled_plugin/scripts/workbench_cli.py b/sdk/typescript/_bundled_plugin/scripts/workbench_cli.py
index ea9f38a9e..86255caa3 100644
--- a/sdk/typescript/_bundled_plugin/scripts/workbench_cli.py
+++ b/sdk/typescript/_bundled_plugin/scripts/workbench_cli.py
@@ -151,6 +151,10 @@ def parse_args(description: str) -> argparse.Namespace:
compare_scans = subparsers.add_parser("compare-scans")
compare_scans.add_argument("--before-scan-id", required=True)
compare_scans.add_argument("--after-scan-id", required=True)
+ list_global_findings = subparsers.add_parser("list-global-findings")
+ list_global_findings.add_argument("--offset", type=non_negative_int, default=0)
+ list_global_findings.add_argument("--limit", type=positive_int, default=FINDINGS_PAGE_MAX)
+ subparsers.add_parser("list-repositories")
list_findings = subparsers.add_parser("list-findings")
list_findings.add_argument("--scan-id", required=True)
diff --git a/sdk/typescript/_bundled_plugin/scripts/workbench_db.py b/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
index 40224811a..e8fd631d0 100644
--- a/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
+++ b/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
@@ -35,6 +35,7 @@ except ModuleNotFoundError: # pragma: no cover - msvcrt is only available on Wi
# Some plugin hosts launch Python with safe-path isolation enabled.
sys.path.insert(0, str(Path(__file__).resolve().parent))
import deep_scan_workbench as deep_scan
+import workbench_native_indexes as native_indexes
import workbench_progress as progress
import workbench_remediation as remediation
import workbench_scan_history as scan_history
@@ -100,6 +101,7 @@ from workbench_target import (
)
from workbench_target_state import backfill_security_targets, ensure_security_target
from workbench_validation import (
+ bounded_output_text,
capability_preflight_input,
capability_preflight_json,
optional_text,
@@ -3281,11 +3283,6 @@ def scan_local_regular_file(scan_dir: Path, relative_path: str) -> bool:
os.close(descriptor)
-def bounded_output_text(value: Any, maximum_bytes: int) -> str:
- encoded = str(value).encode("utf-8")[:maximum_bytes]
- return encoded.decode("utf-8", errors="ignore")
-
-
def read_finding_details(value: str) -> dict[str, Any]:
try:
details = json.loads(value, parse_constant=reject_non_finite_json)
@@ -3580,6 +3577,14 @@ def main() -> None:
require_scan=require_scan,
read_coverage=coverage_for_comparison,
)
+ elif args.command == "list-global-findings":
+ result = native_indexes.list_global_findings(
+ connection, args, read_coverage=coverage_for_comparison
+ )
+ elif args.command == "list-repositories":
+ result = native_indexes.list_repositories(
+ connection, read_coverage=coverage_for_comparison
+ )
elif args.command == "list-findings":
result = list_findings(connection, args)
elif args.command == "update-progress":
diff --git a/sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py b/sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py
index 7bb5a0c43..794439910 100644
--- a/sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py
+++ b/sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py
@@ -182,7 +182,12 @@ def compare_scans(
elif not comparable:
status = "unknown"
item["reason"] = "The later scan has a different target or incomplete coverage."
- elif not _path_is_covered(previous["relative_path"], after_coverage):
+ elif not scan_covers_path(
+ after,
+ target_id=before["target_id"],
+ path=previous["relative_path"],
+ coverage=after_coverage,
+ ):
status = "unknown"
item["reason"] = "The affected path was excluded or outside the later scope."
else:
@@ -231,7 +236,19 @@ def _scan_findings(connection: sqlite3.Connection, scan_id: str) -> dict[str, sq
return {row["finding_id"]: row for row in rows}
-def _path_is_covered(path: str | None, coverage: dict[str, Any]) -> bool:
+def scan_covers_path(
+ scan: sqlite3.Row,
+ *,
+ target_id: str,
+ path: str | None,
+ coverage: dict[str, Any],
+) -> bool:
+ if (
+ scan["status"] != "complete"
+ or scan["target_id"] != target_id
+ or coverage.get("completeness") != "complete"
+ ):
+ return False
if not isinstance(path, str) or not path:
return False
included = coverage.get("includePaths")
diff --git a/sdk/typescript/_bundled_plugin/scripts/workbench_validation.py b/sdk/typescript/_bundled_plugin/scripts/workbench_validation.py
index eda998bcd..47432cfc0 100644
--- a/sdk/typescript/_bundled_plugin/scripts/workbench_validation.py
+++ b/sdk/typescript/_bundled_plugin/scripts/workbench_validation.py
@@ -243,6 +243,11 @@ def _normalize_preflight_patch(value: Any, index: int) -> dict[str, Any]:
return normalized
+def bounded_output_text(value: Any, maximum_bytes: int) -> str:
+ encoded = str(value).encode("utf-8")[:maximum_bytes]
+ return encoded.decode("utf-8", errors="ignore")
+
+
def require_occurrence(connection: sqlite3.Connection, occurrence_id: str) -> sqlite3.Row:
occurrence_id = optional_text(occurrence_id, maximum=256)
if occurrence_id is None:
diff --git a/sdk/typescript/plugin-files.json b/sdk/typescript/plugin-files.json
index 7467da09d..17cd3df01 100644
--- a/sdk/typescript/plugin-files.json
+++ b/sdk/typescript/plugin-files.json
@@ -46,6 +46,7 @@
"scripts/workbench/__init__.py",
"scripts/workbench/handoff.py",
"scripts/workbench_db.py",
+ "scripts/workbench_native_indexes.py",
"scripts/workbench_progress.py",
"scripts/workbench_remediation.py",
"scripts/workbench_scan_history.py",