Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
37def7c
fix(windows): support long paths in scan tooling
faizan-oai Aug 14, 2026
f3ccf52
fix(windows): finalize scans through long paths
faizan-oai Aug 14, 2026
6444017
Merge remote-tracking branch 'origin/main' into agent/support-windows…
faizan-oai Aug 14, 2026
0d34df1
fix(windows): support long deep scan paths
faizan-oai Aug 14, 2026
8dd0409
fix(windows): query history through long paths
faizan-oai Aug 14, 2026
4c26065
fix(windows): open long workbench state paths
faizan-oai Aug 14, 2026
c571062
fix(windows): read long rollout paths
faizan-oai Aug 14, 2026
82f54aa
fix(windows): exclude Python bytecode from packages
mldangelo-oai Aug 15, 2026
054f72a
Merge remote-tracking branch 'origin/main' into HEAD
mldangelo-oai Aug 15, 2026
b4d2f04
fix(windows): preserve long paths through scan results
mldangelo-oai Aug 15, 2026
6dc0fd8
test(windows): run long-path coverage with bundled ripgrep
mldangelo-oai Aug 15, 2026
9a7f97c
fix(windows): handle legacy scan paths and scoped inventories
mldangelo-oai Aug 15, 2026
1fa404f
fix(windows): reconcile legacy target and Unicode paths
mldangelo-oai Aug 15, 2026
189a49d
Merge remote-tracking branch 'origin/main' into HEAD
mldangelo-oai Aug 15, 2026
6391332
test(windows): assert persisted target identity at its contract boundary
mldangelo-oai Aug 15, 2026
e04622e
fix(windows): preserve long-path ranking and sealed scan history
mldangelo-oai Aug 15, 2026
ff8b06b
fix(windows): retain legacy scan roots in workbench history
mldangelo-oai Aug 15, 2026
4641e9b
fix(windows): normalize deep scan children and legacy targets
mldangelo-oai Aug 15, 2026
5c9c09f
fix(windows): extend generated temporary scan artifact paths
mldangelo-oai Aug 15, 2026
9c699ae
fix(windows): merge main and preserve long-path behavior
mldangelo-oai Aug 30, 2026
c22f1f6
test(windows): keep scope path doubles consistent
mldangelo-oai Aug 30, 2026
5865733
Merge main and port Windows path handling to the current workbench
mldangelo-oai Nov 4, 2026
2e45db6
Merge branch 'main' of https://github.com/openai/codex-security into …
mldangelo-oai Nov 4, 2026
4e2b8c7
Keep Windows archive results portable and protect verbatim path ident…
mldangelo-oai Nov 4, 2026
fb51d91
Preserve Windows inventory scope when a long checkout cannot be a chi…
mldangelo-oai Nov 4, 2026
8f71101
Use scan-relative names for Git snapshot order
mldangelo-oai Nov 4, 2026
908afe3
Integrate updated workbench contracts with Windows path handling
mldangelo-oai Nov 4, 2026
4c70197
Keep Windows usage lookups compatible with compressed rollouts
mldangelo-oai Nov 5, 2026
620d779
Resolve bundled path helpers when the SDK loads storage directly
mldangelo-oai Nov 5, 2026
99e9033
Compare Windows path namespaces consistently at containment checks
mldangelo-oai Nov 5, 2026
3f0a13e
Use native separators when reopening Windows inventory paths
mldangelo-oai Nov 5, 2026
6ad5be8
Combine scan-bound usage receipt storage with Windows path handling
mldangelo-oai Nov 5, 2026
9fa7731
Include path support in the compressed usage fixture
mldangelo-oai Nov 5, 2026
1c153c9
Recover saved worker outputs across equivalent Windows path spellings
mldangelo-oai Nov 5, 2026
43d56fa
Retain contextual scan errors and Windows canonical directory checks
mldangelo-oai Nov 5, 2026
732a69a
Merge main and keep Windows long paths in local rename detection
mldangelo-oai Nov 6, 2026
af727e0
fix(windows): compare inventory tool paths using consistent namespace…
mldangelo-oai Nov 6, 2026
1da6ab0
fix(windows): keep workbench SQLite filenames within the pager budget
codex Nov 15, 2026
3871950
fix(windows): retain verbatim filenames during scan archiving
mldangelo-oai Nov 15, 2026
2c39822
fix(windows): compare archive roots using equivalent DOS spellings
codex Nov 15, 2026
3268248
test(windows): record and inspect receipts at the SQLite filename limit
mldangelo-oai Nov 15, 2026
6daf01f
chore(deps): update the evals lockfile to the patched Mongoose release
mldangelo-oai Nov 15, 2026
dd15605
fix(ci): load the installed Ubuntu AppArmor profile
JayYarlagadda Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions evals/triage-finding/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion github-action/scripts/setup-ubuntu-sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ $nrconf{override_rc}{qr(^php8\.3-fpm\.service$)} = 0;
EOF
sudo apt-get update
sudo apt-get install --yes bubblewrap apparmor-profiles
sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict
bwrap_profile=/usr/share/apparmor/extra-profiles/bwrap-userns-restrict
# Ubuntu 26.04 installs this profile under /etc/apparmor.d.
if [[ ! -f "$bwrap_profile" ]]; then
bwrap_profile=/etc/apparmor.d/bwrap-userns-restrict
fi
sudo apparmor_parser -r "$bwrap_profile"
17 changes: 8 additions & 9 deletions plugins/codex-security/mcp-app/src/helpers/generate-inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { dirname, isAbsolute, parse, relative, sep } from "node:path";
import { parseArgs } from "node:util";
import { mkdir, readFile, writeFile } from "./helper-files";
import { expandHome, windowsFiles, windowsJoin } from "./resolve-security-md";
import { decodePosixBytes, encodePosixPath } from "./posix-path";
import { compareCodePoints, stringifyJson } from "./json";
import { print, reportCommandError, ArgumentError } from "./rank-worklists";
import { decodeUtf8 } from "./utf8";
Expand All @@ -33,6 +32,7 @@ import {
blobSamples,
changedPaths,
directoryPaths,
decodeGitPath,
encodeGitPath,
ignoredTrackedPaths,
runRipgrep,
Expand Down Expand Up @@ -128,12 +128,12 @@ async function scopeCandidates(repo: string, scope: string): Promise<string[]> {
"!**/{.git,.svn}",
"--glob",
"!**/{.git,.svn}/**",
"--",
relative(repo, scope) || ".",
],
repo,
relative(repo, scope) || ".",
);
} catch {
} catch (error) {
if (windows && environmentValue("RIPGREP_CONFIG_PATH")) throw error;
const ignoreNames = [".gitignore", ".ignore", ".rgignore"];
const isIgnoreFile = (path: string) => {
try {
Expand Down Expand Up @@ -175,7 +175,7 @@ async function scopeCandidates(repo: string, scope: string): Promise<string[]> {
throw new Error(
`Could not enumerate scoped repository files${result.signal ? ` (${result.signal})` : ""}: ${result.stderr.trim()}`,
);
return decodePosixBytes(result.stdout)
return decodeGitPath(result.stdout)
.split("\0")
.filter(Boolean)
.map((path) => append(repo, path));
Expand Down Expand Up @@ -281,10 +281,9 @@ export async function generateInventory(
"!**/{.git,.svn}",
"--glob",
"!**/{.git,.svn}/**",
"--",
requested,
],
repo,
requested,
).catch((error: unknown) => {
throw new Error(
`could not run ripgrep: ${error instanceof Error ? error.message : String(error)}`,
Expand Down Expand Up @@ -316,13 +315,13 @@ export async function generateInventory(
encodeGitPath(paths.map((path) => prefix + path + "\0").join("")),
]);
}
for (const path of decodePosixBytes(bytes).split("\0").filter(Boolean)) {
for (const path of decodeGitPath(bytes).split("\0").filter(Boolean)) {
if (path.split("/").some((part) => sourceMetadata.has(part))) continue;
if (/[\r\n]/u.test(path))
throw new Error(
"Repository contains a path that cannot fit in the file inventory",
);
inventoryRows.push(encodePosixPath(path + "\n"));
inventoryRows.push(encodeGitPath(path + "\n"));
}
} else if (diff) {
if (
Expand Down
84 changes: 70 additions & 14 deletions plugins/codex-security/mcp-app/src/helpers/inventory-git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import {
} from "node:child_process";
import { randomUUID } from "node:crypto";
import type { Writable } from "node:stream";
import {
import pathSyntax, {
basename,
dirname,
delimiter,
isAbsolute,
parse,
resolve,
sep,
} from "node:path";
Expand Down Expand Up @@ -83,6 +84,23 @@ function selectedBundledRipgrep(candidate: string): boolean {
}
}

// Filesystem resolution can return different Win32 spellings for the same root.
export function toolPathInRepository(
root: string,
candidate: string,
paths = pathSyntax,
): boolean {
const name = paths.relative(
paths.toNamespacedPath(root),
paths.toNamespacedPath(candidate),
);
return (
!paths.isAbsolute(name) &&
name !== ".." &&
!name.startsWith(`..${paths.sep}`)
);
}

function trustedTool(
name: "git" | "rg",
target: string,
Expand Down Expand Up @@ -149,14 +167,7 @@ function trustedTool(
)
continue;
const inRepository = [resolve(candidate), invocation, resolved].some(
(path) => {
try {
inside(protectedRoot, path);
return true;
} catch {
return false;
}
},
(path) => toolPathInRepository(protectedRoot, path),
);
if (inRepository && !(name === "rg" && selectedBundledRipgrep(resolved))) {
if (configured !== undefined)
Expand Down Expand Up @@ -353,19 +364,64 @@ function gitProcess(repo: string, args: string[]) {
export async function runRipgrep(
args: string[],
repo: string,
scope: string,
): Promise<ToolResult> {
if (!windows) return runTool("rg", args, repo);
const scopedArgs = [...args, "--", scope];
if (!windows) return runTool("rg", scopedArgs, repo);
const inherited = inheritedToolPaths([
"RIPGREP_CONFIG_PATH",
"CODEX_SECURITY_GIT",
]);
const rawWindowsLookup = [repo, ...args, ...Object.values(inherited)].some(
rawToolValue,
);
const rawWindowsLookup = [
repo,
...scopedArgs,
...Object.values(inherited),
].some(rawToolValue);
const command = trustedTool("rg", repo, rawWindowsLookup);
if (!command)
throw Object.assign(new Error("spawn rg ENOENT"), { code: "ENOENT" });
return runTool(command, args, repo);
if (!repo.startsWith("\\\\?\\") && repo.length < 260)
return runTool(command, scopedArgs, repo);

const portable = (path: string) => {
const value = path.replaceAll("/", "\\");
return /^\\\\\\?\\UNC\\/iu.test(value)
? "\\\\" + value.slice(8)
: value.replace(/^\\\\\\?\\(?=[a-z]:\\)/iu, "");
};
const root = portable(repo);
if (root.length < 260 && sameFile(repo, root))
return runTool(command, scopedArgs, root);
Comment thread
mldangelo-oai marked this conversation as resolved.
Resolved
if (environmentValue("RIPGREP_CONFIG_PATH")) {
// Operator globs and ignore files can be relative to the working directory.
try {
return await runTool(command, scopedArgs, repo);
} catch (cause) {
throw new Error(
"Could not start ripgrep in the Windows repository directory required by RIPGREP_CONFIG_PATH.",
{ cause },
);
}
}
// CreateProcessW can't use a long or extended current directory. Supply the
// scope as an operand and return the same relative names as a run from repo.
const result = await runTool(
command,
[...args, "--path-separator", "/", "--", resolve(repo, scope)],
parse(root).root,
);
if (result.status !== 0) return result;
const prefix = /^\.([/\\]|$)/u.test(scope) ? "./" : "";
const rows = decodeGitPath(result.stdout).split("\0").filter(Boolean);
const output = rows.map((path) => {
const absolute = portable(path);
if (!isAbsolute(absolute))
throw new Error(
"Ripgrep returned a relative path for an absolute scope.",
);
return prefix + inside(root, absolute) + "\0";
});
return { ...result, stdout: encodeGitPath(output.join("")) };
}

export async function runTool(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import { isMissingPathError } from "./helper-files";
export const windows = process.platform === "win32";
export const fsPath = (path: string) =>
windows ? toNamespacedPath(path) : encodePosixPath(path);
// Git and ripgrep return POSIX separators. Win32 verbatim paths require backslashes.
export const append = (parent: string, child: string) =>
`${parent || "."}${parent.endsWith(sep) ? "" : sep}${child}`;
`${parent || "."}${parent.endsWith(sep) ? "" : sep}${windows ? child.replaceAll("/", sep) : child}`;
export const stat = (path: string) =>
windows
? windowsFiles().stat(Buffer.from(path, "utf16le"))
Expand Down
35 changes: 32 additions & 3 deletions plugins/codex-security/mcp-app/tests/test_inventory_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,45 @@ import fs from "node:fs";
import childProcess from "node:child_process";
import { createRequire, syncBuiltinESMExports } from "node:module";
import { constants, tmpdir } from "node:os";
import { join } from "node:path";
import { join, posix, win32 } from "node:path";
import { importSource } from "./import-module.ts";
import type { WindowsBinding } from "../../native/windows-binding.mjs";

const helperUrl = new URL(
"../../../../sdk/typescript/_bundled_plugin/mcp/helpers.mjs",
import.meta.url,
);
const { git, runTool } = await importSource("src/helpers/inventory-git.ts", {
define: { "import.meta.url": JSON.stringify(helperUrl.href) },
const { git, runTool, toolPathInRepository } = await importSource(
"src/helpers/inventory-git.ts",
{
define: { "import.meta.url": JSON.stringify(helperUrl.href) },
},
);

test("tool containment recognizes equivalent Windows repository paths", () => {
const contained = (root: string, path: string) =>
toolPathInRepository(root, path, win32);
for (const root of [String.raw`C:\repo`, String.raw`\\server\share\repo`]) {
const extended = win32.toNamespacedPath(root);
const child = win32.join(root, "tools", "placeholder");
assert.equal(contained(extended, child), true);
assert.equal(contained(root, win32.toNamespacedPath(child)), true);
assert.equal(contained(extended, root), true);
assert.equal(contained(root, `${root}-other`), false);
}
assert.equal(contained("C:\\repo", "D:\\repo\\tools"), false);
assert.equal(
contained(String.raw`\\server\share\repo`, String.raw`\\server\other\repo`),
false,
);
const volume = String.raw`\\?\Volume{00000000-0000-0000-0000-000000000001}\repo`;
assert.equal(contained(volume, win32.join(volume, "tools")), true);
assert.equal(contained(volume, "C:\\repo\\tools"), false);
assert.equal(toolPathInRepository("/repo", "/repo/..notes", posix), true);
assert.equal(
toolPathInRepository("/repo", "/repo-other/tools", posix),
false,
);
});

for (const [name, details] of [
Expand Down
1 change: 1 addition & 0 deletions plugins/codex-security/plugin-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"scripts/snapshot_sqlite.py",
"scripts/threat_model_projection.py",
"scripts/validate_scan_contract.py",
"scripts/windows_paths.py",
"scripts/windows_scan_local_files.py",
"scripts/workbench/__init__.py",
"scripts/workbench/handoff.py",
Expand Down
Loading
Loading