Skip to content

Commit 5a0d539

Browse files
committed
test(auth): lowercase bearer also exercised on the MCP client path
Review pick on #24501: the lowercase-scheme assertion only used the provider registry token, so the McpClientAuthenticator branch of the middleware never saw a lowercase scheme. The test's client authenticator mock compared the raw header case-sensitively, unlike the real parser after this PR. Accept the lowercase scheme in the mock and add a lowercase clientToken call, keeping the provider assertion. Model: GLM-5.3 (ZCode)
1 parent 76d7efb commit 5a0d539

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/server/src/mcp/McpHttpServer.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,10 @@ it.effect("admits provider and OAuth client credentials and points only clients
758758
Layer.succeed(McpHttpServer.McpClientAuthenticator, {
759759
authenticate: (request) =>
760760
Effect.succeed(
761-
request.headers.authorization === `Bearer ${clientToken}` ? clientScope : undefined,
761+
request.headers.authorization === `Bearer ${clientToken}` ||
762+
request.headers.authorization === `bearer ${clientToken}`
763+
? clientScope
764+
: undefined,
762765
),
763766
}),
764767
),
@@ -798,10 +801,12 @@ it.effect("admits provider and OAuth client credentials and points only clients
798801
expect((yield* call(clientToken)).status).toBe(200);
799802
// RFC 9110 §11.1: the auth-scheme is case-insensitive, so "bearer" authenticates too.
800803
expect((yield* call(providerToken, "bearer")).status).toBe(200);
804+
expect((yield* call(clientToken, "bearer")).status).toBe(200);
801805
expect(seen.map((scope) => scope.requestNamespace)).toEqual([
802806
"provider-session",
803807
"client:session-1",
804808
"provider-session",
809+
"client:session-1",
805810
]);
806811

807812
const missing = yield* call(undefined);

0 commit comments

Comments
 (0)