OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
test: exercise scan-root aliases in the native Python suite (#2000)
Michael D'Angelo781db93214cd
diff --git a/plugins/codex-security/tests/test_workbench_native_index_queries.py b/plugins/codex-security/tests/test_workbench_native_index_queries.pyindex 635284e81..47b1c8027 100644--- a/plugins/codex-security/tests/test_workbench_native_index_queries.py+++ b/plugins/codex-security/tests/test_workbench_native_index_queries.py@@ -332,28 +332,29 @@ def test_scan_list_returns_lightweight_running_first_summaries(workbench_api, inassert "findings" not in scans[0]+ "simulate_windows",+ [+ pytest.param(False, id="native", marks=pytest.mark.cross_platform),+ pytest.param(True, id="ntpath"),+ ],+)def test_scan_root_filter_matches_windows_path_aliases(- workbench_api, indexed_collections, tmp_path, monkeypatch+ workbench_api, indexed_collections, tmp_path, monkeypatch, simulate_windows):connection, _ = indexed_collections+ history = workbench_api["scan_history"]+ if simulate_windows:+ monkeypatch.setattr(history, "os", SimpleNamespace(name="nt", path=ntpath, sep="\\"))root = tmp_path / "Scan Results"+ root.mkdir()for scan_id, directory in zip(- SCAN_IDS, (root / "first", tmp_path / "Scan Results Other", tmp_path / "unrelated")+ SCAN_IDS, (f"{root}/first", tmp_path / "Scan Results Other", history.os.path.normpath(root))):connection.execute("UPDATE scans SET scan_dir = ? WHERE id = ?", (str(directory), scan_id))- history = workbench_api["scan_history"]- monkeypatch.setattr(history, "os", SimpleNamespace(name="nt", path=ntpath, sep="\\"))- args = query_args(scan_root=str(root).upper(), limit=None)-- assert [scan["scanId"] for scan in history.list_scans(connection, args)["scans"]] == [- SCAN_IDS[0]- ]- connection.execute(- "UPDATE scans SET scan_dir = ? WHERE id = ?", (ntpath.normpath(str(root)), SCAN_IDS[0])- )- assert [scan["scanId"] for scan in history.list_scans(connection, args)["scans"]] == [- SCAN_IDS[0]- ]+ scan_root = str(root).upper() if history.os.name == "nt" else str(root)+ scans = history.list_scans(connection, query_args(scan_root=scan_root, limit=None))["scans"]+ assert {scan["scanId"] for scan in scans} == {SCAN_IDS[0], SCAN_IDS[2]}def test_scan_list_probes_requested_repository_once(diff --git a/sdk/typescript/scripts/test-timings.json b/sdk/typescript/scripts/test-timings.jsonindex 03cbe4042..f2a716144 100644--- a/sdk/typescript/scripts/test-timings.json+++ b/sdk/typescript/scripts/test-timings.json@@ -1184,11 +1184,6 @@"darwin": 2.5,"win32": 5.5},- "workbench-scan-root-alias.test.ts": {- "linux": 0.3,- "darwin": 0.4,- "win32": 0.7- },"workbench-windows-compatibility.test.ts": {"linux": 0.6,"darwin": 0.8,diff --git a/sdk/typescript/tests-ts/workbench-scan-root-alias.test.ts b/sdk/typescript/tests-ts/workbench-scan-root-alias.test.tsdeleted file mode 100644index 65bdb71e8..000000000--- a/sdk/typescript/tests-ts/workbench-scan-root-alias.test.ts+++ /dev/null@@ -1,57 +0,0 @@-import { execFile } from "node:child_process";-import { mkdirSync, mkdtempSync, realpathSync, rmSync } from "node:fs";-import { tmpdir } from "node:os";-import { join } from "node:path";-import { promisify } from "node:util";-import { expect, test } from "bun:test";-import { resolvePluginPython } from "../src/runtime.js";-import { PLUGIN_ROOT } from "./plugin-root.js";--test("matches scan-root filters including Windows path aliases", async () => {- const python = await resolvePluginPython();-- const root = realpathSync(- mkdtempSync(join(tmpdir(), "codex-security-scan-root-case-")),- );- const scanRoot = join(root, "Scan History");- mkdirSync(scanRoot);- try {- const probe = [- "import argparse, json, sqlite3, sys",- "sys.path.insert(0, sys.argv[1])",- "from workbench_db import apply_migrations",- "import workbench_scan_history as history",- "connection = sqlite3.connect(':memory:')",- "connection.row_factory = sqlite3.Row",- "connection.execute('PRAGMA foreign_keys = ON')",- "apply_migrations(connection)",- "timestamp = '2026-10-08T00:00:00Z'",- "connection.execute('INSERT INTO workspaces (id, created_at, updated_at) VALUES (?, ?, ?)', ('workspace', timestamp, timestamp))",- "for scan_id, scan_dir in [('scan', sys.argv[2] + '/scan'), ('sibling', sys.argv[2] + ' Other/scan')]:",- " connection.execute('INSERT INTO scans (id, workspace_id, target_path, target_revision, scope, mode, scan_dir, status, phase, started_at, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (scan_id, 'workspace', 'repository', 'revision', '.', 'standard', scan_dir, 'complete', 'reporting', timestamp, timestamp, timestamp))",- " connection.execute('INSERT INTO scan_progress (scan_id, scope_file_count, review_items_completed, review_items_total, updated_at) VALUES (?, 1, 1, 1, ?)', (scan_id, timestamp))",- "args = argparse.Namespace(repository=None, scan_root=sys.argv[3], target_id=None, mode=None, status=None, query=None, limit=None, offset=0)",- "print(json.dumps(history.list_scans(connection, args)))",- ].join("\n");- const result = await promisify(execFile)(- python,- [- "-I",- "-B",- "-c",- probe,- join(PLUGIN_ROOT, "scripts"),- scanRoot,- process.platform === "win32" ? scanRoot.toUpperCase() : scanRoot,- ],- { encoding: "utf8", timeout: 10_000, windowsHide: true },- );-- expect(result.stderr).toBe("");- expect(JSON.parse(result.stdout)).toMatchObject({- scans: [{ scanId: "scan" }],- });- } finally {- rmSync(root, { recursive: true, force: true });- }-});