From d1fa9efdaf4cd5cc665193ad2508b49b9918fd0b Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 26 Oct 2026 21:33:38 -0500 Subject: [PATCH] test(evals): cover encoded diagnostics and enforce private host isolation --- tests/runner-e2e/harness-env.ts | 1 + tests/runner-e2e/private-diagnostics.test.ts | 3 ++- tests/runner-e2e/private-diagnostics.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/runner-e2e/harness-env.ts b/tests/runner-e2e/harness-env.ts index db0e3b7aae5..eeb800dda71 100644 --- a/tests/runner-e2e/harness-env.ts +++ b/tests/runner-e2e/harness-env.ts @@ -213,6 +213,7 @@ export function buildPaperclipServerEnvironment( } for (const key of [...GENERATED_SERVER_SECRET_KEYS, ...installedCliKeys, ...installedDaytonaPluginKeys]) delete result[key]; Object.assign(result, overrides); + delete result[PRIVATE_DIAGNOSTICS_ENV]; return result; } diff --git a/tests/runner-e2e/private-diagnostics.test.ts b/tests/runner-e2e/private-diagnostics.test.ts index f907afad33d..e8e87c08eae 100644 --- a/tests/runner-e2e/private-diagnostics.test.ts +++ b/tests/runner-e2e/private-diagnostics.test.ts @@ -11,7 +11,7 @@ describe("private diagnostic output boundary", () => { const password = 'synthetic-credential-<&"-12345678'; const pem = "-----BEGIN PRIVATE KEY-----\nU1lOVEhFVElDLVByaXZhdGUtS2V5LUxpbmUx\nU1lOVEhFVElDLVByaXZhdGUtS2V5LUxpbmUy\n-----END PRIVATE KEY-----"; const short = "Ax4\nBy5\nCz6"; const outputs: string[] = []; const stream = createPrivateDiagnosticStream(() => [password, pem, short], value => outputs.push(value)); - const input = `HTTP503: π provider unavailable ${password}\n${pem}\n${short}\nJSON ${JSON.stringify(password)}\nHTML ${password.replace(/&/g, "&").replace(/ { it("synchronously registers a generated cookie before first output and rereads at final flush", () => { const { root, file } = registry(); const secrets = trackedPrivateSecrets([], "selected-case", { [PRIVATE_DIAGNOSTICS_ENV]: file, PAPERCLIP_RUNNER_E2E_TEMP_ROOT: root }); expect(buildPaperclipServerEnvironment({ [PRIVATE_DIAGNOSTICS_ENV]: file })[PRIVATE_DIAGNOSTICS_ENV]).toBeUndefined(); + expect(buildPaperclipServerEnvironment({}, { [PRIVATE_DIAGNOSTICS_ENV]: file })[PRIVATE_DIAGNOSTICS_ENV]).toBeUndefined(); const outputs: string[] = []; const stream = createPrivateDiagnosticStream(() => readPrivateDiagnosticSecrets(file, root), value => outputs.push(value)); const cookie = "generated-session-canary-982726351"; secrets.push(cookie); expect(readPrivateDiagnosticSecrets(file, root)).toContain(cookie); diff --git a/tests/runner-e2e/private-diagnostics.ts b/tests/runner-e2e/private-diagnostics.ts index c1cb46aa64a..ee6d259cb5c 100644 --- a/tests/runner-e2e/private-diagnostics.ts +++ b/tests/runner-e2e/private-diagnostics.ts @@ -48,7 +48,7 @@ export function trackedPrivateSecrets(initial: string[], executionId: string, en export function diagnosticSecrets(values: readonly string[]): string[] { const variants = normalizedSecrets(values).flatMap(value => { let structured = false; try { const parsed = JSON.parse(value); structured = parsed !== null && typeof parsed === "object"; } catch { /* Ordinary secret. */ } - return [value, JSON.stringify(value).slice(1, -1), encodeURIComponent(value), + return [value, JSON.stringify(value).slice(1, -1), encodeURIComponent(value), Buffer.from(value).toString("base64"), Buffer.from(value).toString("base64url"), value.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"), // Short nonempty password/key lines are private too. JSON punctuation is // structural; its actual string credential values are separately indexed