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

fix(deep-scan): resolve home-relative project config paths on POSIX (#2505)

Michael D'Angelo4e51fb768b70
diff --git a/docs/project-configuration.md b/docs/project-configuration.md
index 597fcf728..c56eb3ddb 100644
--- a/docs/project-configuration.md
+++ b/docs/project-configuration.md
@@ -101,6 +101,9 @@ what will run, ask for the effective worker count, subagents per worker, stop
conditions, review cap, and discovery time limit. The plugin returns each value
and its source in `setup.deepScanConfig` from `inspect_codex_security_setup`.
Both setup and `start_codex_security_deep_scan` accept `projectConfigPath`.
+For a file under your home directory, `~/security/scan.yaml` and
+`~\security\scan.yaml` both select the same file. On POSIX, use the `~/`
+spelling when the filename itself contains a backslash.
Explicit project settings override per-user `[deep_scan]` settings, which override
built-in defaults. The per-user file remains
diff --git a/plugins/codex-security/mcp-app/src/deep-scan/project-config.ts b/plugins/codex-security/mcp-app/src/deep-scan/project-config.ts
index 7b24e3ea7..bb6dd9e8b 100644
--- a/plugins/codex-security/mcp-app/src/deep-scan/project-config.ts
+++ b/plugins/codex-security/mcp-app/src/deep-scan/project-config.ts
@@ -18,7 +18,11 @@ export async function readDeepScanProjectConfig(
canonicalTarget: string,
): Promise<DeepScanProjectConfig | undefined> {
if (file === undefined) return undefined;
- const selected = file.replace(/^~(?=$|[/\\])/, () => homedir());
+ const spelling =
+ process.platform !== "win32" && file.startsWith("~\\")
+ ? file.replaceAll("\\", "/")
+ : file;
+ const selected = spelling.replace(/^~(?=$|[/\\])/, () => homedir());
const extension = extname(selected).toLowerCase();
if (![".json", ".yaml", ".yml"].includes(extension)) {
throw new Error(
diff --git a/plugins/codex-security/mcp-app/tests/test_deep_scan_project_config.ts b/plugins/codex-security/mcp-app/tests/test_deep_scan_project_config.ts
index a45dfe77a..6558af2a2 100644
--- a/plugins/codex-security/mcp-app/tests/test_deep_scan_project_config.ts
+++ b/plugins/codex-security/mcp-app/tests/test_deep_scan_project_config.ts
@@ -201,6 +201,14 @@ await test("built MCP setup previews and saves the selected project before scan
).setup;
assert.deepEqual(driveRelative.deepScanConfig, preview);
} else if (process.platform !== "win32") {
+ const homeConfigPath = "~\\repository\\selected.yaml";
+ const homeConfig = (
+ await call("inspect_codex_security_setup", {
+ ...selection,
+ projectConfigPath: homeConfigPath,
+ })
+ ).setup;
+ assert.deepEqual(homeConfig.deepScanConfig, preview);
await mkdir(join(targetPath, "subdirectory"));
await symlink(join(targetPath, "subdirectory"), join(root, "link"));
await writeFile(
@@ -213,6 +221,7 @@ await test("built MCP setup previews and saves the selected project before scan
).setup;
assert.equal(throughLink.target.targetPath, targetPath);
assert.deepEqual(throughLink.deepScanConfig, preview);
+ selection.projectConfigPath = homeConfigPath;
}
const workspace = (
await call("open_codex_security_workspace", {