Cover auth token trimming across whitespace characters

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 03:53:55 +00:00
1 parent c41fe91c51
commit 390c340bdc
1 file changed
+17
+17
View File
@@ -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,