fix(codex): normalize compacted Windows permission paths

This commit is contained in:
Peter Steinberger
2026-04-25 02:27:44 +01:00
parent e68b2269b9
commit 52ea8eadcb
2 changed files with 5 additions and 2 deletions

View File

@@ -641,7 +641,7 @@ describe("Codex app-server approval bridge", () => {
const [, , requestPayload] = mockCallGatewayTool.mock.calls[0] ?? [];
const description = (requestPayload as { description: string }).description;
expect(description).toContain("File system roots: ~; readPaths: ~\\.ssh\\id_rsa, ~/project");
expect(description).toContain("File system roots: ~; readPaths: ~/.ssh/id_rsa, ~/project");
expect(description).not.toContain("High-risk targets");
});

View File

@@ -436,7 +436,10 @@ function sanitizePermissionPathValue(value: string): string {
.replace(/^\/home\/(?!\.{1,2}(?=\/|$))[^/]+(?=\/|$)/, "~")
.replace(/^\/Users\/(?!\.{1,2}(?=\/|$))[^/]+(?=\/|$)/, "~")
.replace(/^[A-Za-z]:[\\/]Users[\\/](?!\.{1,2}(?=[\\/]|$))[^\\/]+(?=[\\/]|$)/i, "~");
return truncate(homeCompacted, PERMISSION_VALUE_MAX_LENGTH);
const displayPath = homeCompacted.startsWith("~")
? homeCompacted.replace(/\\/g, "/")
: homeCompacted;
return truncate(displayPath, PERMISSION_VALUE_MAX_LENGTH);
}
function sanitizePermissionScalar(value: string): string {