The best way to control Claude Code, Codex and more from any computer or phone
fix(server): empty primary cookie no longer blocks bearer auth (#27848)
Co-authored-by: maria-rcks <maria@kuuro.net>
samkelly880 committed
Nov 1, 2026 at 15:42 UTC
aa33734f8aac52b13b6d8b43be910cd5c69c72e8
2 files changed
+15
-1
apps/server/src/auth/EnvironmentAuth.test.ts
+14
@@ -308,6 +308,20 @@ it.layer(NodeServices.layer)("EnvironmentAuth.layer", (it) => {
308
}).pipe(Effect.provide(layerEnvironmentAuth({ mode: "web", host: "192.168.1.50" }))),
309
);
310
311
+ it.effect("prefers a bearer token over an empty primary cookie", () =>
312
+ Effect.gen(function* () {
313
+ const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
314
+ const sessions = yield* SessionStore.SessionStore;
315
+ const bearer = yield* serverAuth.issueSession();
316
+ const verified = yield* serverAuth.authenticateHttpRequest({
317
+ cookies: { [sessions.cookieName]: "" },
318
+ headers: { authorization: `Bearer ${bearer.token}` },
319
+ } as never);
320
+
321
+ expect(verified.sessionId).toBe(bearer.sessionId);
322
+ }).pipe(Effect.provide(layerEnvironmentAuth({ mode: "web", host: "192.168.1.50" }))),
323
+ );
324
+
325
it.effect("preserves pairing grants after rejecting scopes they do not grant", () =>
326
Effect.gen(function* () {
327
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
apps/server/src/auth/EnvironmentAuth.ts
+1
-1
@@ -643,7 +643,7 @@ export function selectRequestCredential(
643
legacyCookieName: string | undefined,
644
) {
645
const cookieToken = request.cookies[cookieName];
646
- if (cookieToken !== undefined) {
646
+ if (cookieToken) {
647
return { token: cookieToken, source: "cookie" } as const;
648
}
649