From 5b8e31f3c40ff534534ec05221f77632283bbe73 Mon Sep 17 00:00:00 2001 From: Dotta Date: Thu, 27 Aug 2026 12:41:01 -0500 Subject: [PATCH] fix(e2e): recognize durable Codex runtime auth --- tests/runner-e2e/launch.ts | 9 ++------ tests/runner-e2e/redaction.ts | 15 +++++++++++++ tests/runner-e2e/support.test.ts | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/tests/runner-e2e/launch.ts b/tests/runner-e2e/launch.ts index b569de390cf..0f38a9a9d02 100644 --- a/tests/runner-e2e/launch.ts +++ b/tests/runner-e2e/launch.ts @@ -25,6 +25,7 @@ import { assertEmbeddedDatabaseIsolation } from "./instance-isolation.js"; import { assertSecretFree, findSecretLeakInDirectory, + isEphemeralCodexRuntimeAuthFile, normalizedSecrets, sanitizeJson, } from "./redaction.js"; @@ -519,15 +520,9 @@ async function runAttempt(input: { ignoreFile: (file) => expectedEphemeralCredentials.has(file), }); if (!leak) break; - const relative = path - .relative(paperclipHome, leak.file) - .split(path.sep) - .join("/"); const isManagedCodexRuntimeAuth = label === "Paperclip home" && - /^instances\/[^/]+\/companies\/[^/]+\/agents\/[^/]+\/codex-home\/auth\.json$/.test( - relative, - ); + isEphemeralCodexRuntimeAuthFile(paperclipHome, leak.file); if (isManagedCodexRuntimeAuth) { const metadata = await lstat(leak.file); if (metadata.isFile() && (metadata.mode & 0o777) === 0o600) { diff --git a/tests/runner-e2e/redaction.ts b/tests/runner-e2e/redaction.ts index e2dd40ce3a5..5c42e529c60 100644 --- a/tests/runner-e2e/redaction.ts +++ b/tests/runner-e2e/redaction.ts @@ -19,6 +19,21 @@ export function normalizedSecrets(values: readonly (string | undefined)[]) { ].sort((left, right) => right.length - left.length); } +export function isEphemeralCodexRuntimeAuthFile( + paperclipHome: string, + file: string, +) { + const relative = path.relative(paperclipHome, file).split(path.sep).join("/"); + return ( + /^instances\/[^/]+\/companies\/[^/]+\/agents\/[^/]+\/codex-home\/auth\.json$/.test( + relative, + ) || + /^instances\/[^/]+\/runtime\/paperclip-runner\/durable-sessions\/[^/]+\/codex-home\/auth\.json$/.test( + relative, + ) + ); +} + export function redactText(value: string, secrets: readonly string[]) { let redacted = redactDiagnosticText(value, "[REDACTED]"); return redactKnownSecretsAndShapes(redacted, secrets); diff --git a/tests/runner-e2e/support.test.ts b/tests/runner-e2e/support.test.ts index f36a6b5867c..e41f3539353 100644 --- a/tests/runner-e2e/support.test.ts +++ b/tests/runner-e2e/support.test.ts @@ -17,6 +17,7 @@ import { findSecretLeak, findSecretLeakInJsonValues, findSecretLeakInDirectory, + isEphemeralCodexRuntimeAuthFile, redactText, sanitizeJson, } from "./redaction.js"; @@ -483,6 +484,43 @@ describe("runner E2E evidence redaction", () => { ).resolves.toMatchObject({ file: forbiddenConfig }); }); + it("recognizes both managed and durable-session Codex runtime auth files", () => { + const root = path.join(os.tmpdir(), "paperclip-home"); + expect( + isEphemeralCodexRuntimeAuthFile( + root, + path.join( + root, + "instances/instance-1/companies/company-1/agents/agent-1/codex-home/auth.json", + ), + ), + ).toBe(true); + expect( + isEphemeralCodexRuntimeAuthFile( + root, + path.join( + root, + "instances/instance-1/runtime/paperclip-runner/durable-sessions/session-1/codex-home/auth.json", + ), + ), + ).toBe(true); + expect( + isEphemeralCodexRuntimeAuthFile( + root, + path.join(root, "instances/instance-1/runtime/auth.json"), + ), + ).toBe(false); + expect( + isEphemeralCodexRuntimeAuthFile( + root, + path.join( + root, + "instances/instance-1/runtime/paperclip-runner/durable-sessions/session-1/codex-home/config.toml", + ), + ), + ).toBe(false); + }); + it("publishes only allowlisted sanitized files and reports source leaks", async () => { const root = await mkdtemp( path.join(os.tmpdir(), "runner-e2e-evidence-test-"),