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: keep the scheme separator for app callbacks on OAuth consent (RX-108)
Amruth Pillai74c8091ddefc
diff --git a/apps/web/src/features/auth/pages/consent.tsx b/apps/web/src/features/auth/pages/consent.tsxindex 83cffe504..286b0df2b 100644--- a/apps/web/src/features/auth/pages/consent.tsx+++ b/apps/web/src/features/auth/pages/consent.tsx@@ -36,8 +36,9 @@ function redirectDestination(redirectUri: string | null) {try {const url = new URL(redirectUri);if (url.protocol === "http:" || url.protocol === "https:") return url.host;- // Any installed app can claim a custom scheme and pair it with a familiar host, so name the scheme too.- return url.host ? `${url.protocol}//${url.host}` : url.protocol.replace(/:$/, "");+ // Any installed app can claim a custom scheme, even one spelled like a website, so keep the scheme and its+ // separator: a site's host never ends in ":".+ return url.host ? `${url.protocol}//${url.host}` : url.protocol;} catch {return null;}diff --git a/tests/e2e/specs/oauth-consent.spec.ts b/tests/e2e/specs/oauth-consent.spec.tsindex 69723b6d4..286ee9df8 100644--- a/tests/e2e/specs/oauth-consent.spec.ts+++ b/tests/e2e/specs/oauth-consent.spec.ts@@ -96,8 +96,12 @@ test("requires explicit OAuth consent before denying or allowing access", asynctest("names an app callback's scheme, not just its host, before consent", async ({ authPage: page, baseURL }) => {const origin = new URL(baseURL ?? "http://localhost:3000").origin;for (const [callback, destination] of [+ ["https://www.cursor.com/agents/mcp/oauth/callback", "www.cursor.com"],+ // An app scheme spelled like a website must not read as that website.+ ["www.cursor.com:/oauth/callback", "www.cursor.com:"],+ ["com.example.app:/oauth/callback", "com.example.app:"],+ ["cursor://anysphere.cursor-mcp/oauth/callback", "cursor://anysphere.cursor-mcp"],["evilapp://www.cursor.com/oauth/callback", "evilapp://www.cursor.com"],- ["com.example.app:/oauth/callback", "com.example.app"],]) {const registration = await page.request.post("/api/auth/oauth2/register", {headers: { origin },