From 390c340bdcb2cbe6cf53897e8b69d09dcfa7baee Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 03:53:55 +0000 Subject: [PATCH] Cover auth token trimming across whitespace characters Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index be018ab0a4..9b117f1f4d 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -397,6 +397,23 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("trims non-space surrounding whitespace from auth tokens", async () => { + const server = await startRuntimeApiServer({ + port: 0, + launchCwd: process.cwd(), + authToken: "\n\tsecret-token\t\n", + }); + servers.push(server); + + const wsUrl = new URL(server.wsUrl); + expect(wsUrl.searchParams.get("token")).toBe("secret-token"); + + const client = await connectClient(server.wsUrl); + const hello = await client.nextMessage(); + expect(hello.type).toBe("hello"); + client.socket.close(); + }); + it("encodes auth token query parameter in runtime websocket URL", async () => { const server = await startRuntimeApiServer({ port: 0,