From 030bb8c0dea42271f5c619f6b7b2c5526e618eee Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 11 Jul 2026 08:23:32 +0530 Subject: [PATCH 1/2] (fix): allow OAuth login on Appwrite subdomains Co-authored-by: Cursor --- templates/cli/lib/utils.ts | 7 +------ tests/e2e/languages/cli/test.js | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/templates/cli/lib/utils.ts b/templates/cli/lib/utils.ts index 606733ceef..8d8e349fb9 100644 --- a/templates/cli/lib/utils.ts +++ b/templates/cli/lib/utils.ts @@ -456,10 +456,6 @@ export const getCloudEndpointRegion = (endpoint: string): string | null => { export const isLocalhostHostname = (hostname: string): boolean => hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]"; -const isCloudEnvironmentHostname = (hostname: string): boolean => - hostname.endsWith(".cloud.appwrite.io") && - CLOUD_LOGIN_ENVIRONMENTS.has(hostname.split(".")[0]); - const getCloudConsoleHostname = (hostname: string): string | null => { if (hostname === "cloud.appwrite.io") { return hostname; @@ -490,8 +486,7 @@ export const isCloudLoginEndpoint = (endpoint: string): boolean => { try { const hostname = new URL(endpoint).hostname; return ( - isCloudHostname(hostname) || - isCloudEnvironmentHostname(hostname) || + hostname.endsWith(".appwrite.io") || (isFlagEnabled("devCloudLogin") && isLocalhostHostname(hostname)) ); } catch (_error) { diff --git a/tests/e2e/languages/cli/test.js b/tests/e2e/languages/cli/test.js index 959706673f..e6e66c61ec 100644 --- a/tests/e2e/languages/cli/test.js +++ b/tests/e2e/languages/cli/test.js @@ -793,6 +793,9 @@ async function runAuthChecks() { assert.equal(isFlagEnabled("devCloudLogin"), false); assert.equal(isCloudLoginEndpoint("https://cloud.appwrite.io/v1"), true); assert.equal(isCloudLoginEndpoint("https://stage.cloud.appwrite.io/v1"), true); + assert.equal(isCloudLoginEndpoint("https://new.appwrite.io/v1"), true); + assert.equal(isCloudLoginEndpoint("https://appwrite.io/v1"), false); + assert.equal(isCloudLoginEndpoint("https://notappwrite.io/v1"), false); assert.equal(isCloudLoginEndpoint("http://localhost/v1"), false); } finally { if (prev === undefined) delete process.env.APPWRITE_CLI_DEV_CLOUD_LOGIN; From 6d6126901d90660f3b43d64b49f90445a082934c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 11 Jul 2026 08:31:38 +0530 Subject: [PATCH 2/2] (test): cover nested Appwrite hostname lookalikes Co-authored-by: Cursor --- tests/e2e/languages/cli/test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/e2e/languages/cli/test.js b/tests/e2e/languages/cli/test.js index e6e66c61ec..69319917aa 100644 --- a/tests/e2e/languages/cli/test.js +++ b/tests/e2e/languages/cli/test.js @@ -796,6 +796,10 @@ async function runAuthChecks() { assert.equal(isCloudLoginEndpoint("https://new.appwrite.io/v1"), true); assert.equal(isCloudLoginEndpoint("https://appwrite.io/v1"), false); assert.equal(isCloudLoginEndpoint("https://notappwrite.io/v1"), false); + assert.equal( + isCloudLoginEndpoint("https://real.appwrite.io.attacker.com/v1"), + false, + ); assert.equal(isCloudLoginEndpoint("http://localhost/v1"), false); } finally { if (prev === undefined) delete process.env.APPWRITE_CLI_DEV_CLOUD_LOGIN;