A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: limit OAuth prelogin responses to consent display fields (RX-108)
Amruth Pillaib470d590e5df
diff --git a/apps/server/src/http/oauth-flow.integration.test.ts b/apps/server/src/http/oauth-flow.integration.test.tsindex 01d5e4490..00a8c3675 100644--- a/apps/server/src/http/oauth-flow.integration.test.ts+++ b/apps/server/src/http/oauth-flow.integration.test.ts@@ -676,8 +676,21 @@ describe.skipIf(!databaseURL)("MCP OAuth flow with PostgreSQL", () => {body: JSON.stringify(body),}),);- const register = async (name: string) =>- (await post("oauth2/register", { client_name: name, redirect_uris: ["http://127.0.0.1:33921/callback"] })).json();+ const register = async (name: string) => {+ const response = await post("oauth2/register", {+ client_name: name,+ redirect_uris: ["http://127.0.0.1:33921/callback"],+ contacts: ["[email protected]"],+ client_uri: "https://client.example.test",+ logo_uri: "https://client.example.test/icon.png",+ tos_uri: "https://client.example.test/terms",+ policy_uri: "https://client.example.test/privacy",+ });+ expect(response.status, await response.clone().text()).toBe(201);+ const registered = await response.json();+ expect(registered.contacts).toEqual(["[email protected]"]);+ return registered;+ };const client = await register("Signed client");const other = await register("Other client");const query = new URLSearchParams({@@ -698,7 +711,7 @@ describe.skipIf(!databaseURL)("MCP OAuth flow with PostgreSQL", () => {const valid = await prelogin(client.client_id, signed);expect(valid.status, await valid.clone().text()).toBe(200);- await expect(valid.json()).resolves.toMatchObject({ client_id: client.client_id, client_name: "Signed client" });+ await expect(valid.json()).resolves.toEqual({ client_id: client.client_id, client_name: "Signed client" });const tampered = new URLSearchParams(signed);tampered.set("scope", "openid api:read api:write api:delete");const refusedSignature = async (response: Response) => {diff --git a/packages/auth/src/config.ts b/packages/auth/src/config.tsindex 95bb1969d..162be7e53 100644--- a/packages/auth/src/config.ts+++ b/packages/auth/src/config.ts@@ -784,6 +784,9 @@ const getAuthConfig = () => {}),after: createAuthMiddleware(async (ctx) => {const payload = ctx.context.returned as JWTPayload | undefined;+ if (ctx.path === "/oauth2/public-client-prelogin" && payload && typeof payload.client_id === "string") {+ return ctx.json({ client_id: payload.client_id, client_name: payload.client_name });+ }// Run after the provider authenticates the introspecting client and verifies the token.if (ctx.path !== "/oauth2/introspect" || !payload || payload.active !== true || typeof payload.azp !== "string")return;