Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(web): allow configured loopback Accounts origins in all builds

AswinAsok5aa72f86b04d
diff --git a/web/README.md b/web/README.md
index 1cd619fa7f..b6108a743a 100644
--- a/web/README.md
+++ b/web/README.md
@@ -43,8 +43,8 @@ Passkey flows only navigate to `https://accounts.ente.com` and
`https://accounts.ente.io` by default (the latter supports legacy passkeys).
Self-hosted builds must set `NEXT_PUBLIC_ENTE_ACCOUNTS_ORIGIN` to their trusted
Accounts web app origin, matching the server's `apps.accounts` configuration.
-This replaces the hosted origins. HTTPS is required; development builds also
-allow an explicitly configured HTTP loopback origin, e.g. `http://localhost:3001`.
+This replaces the hosted origins. HTTPS is required except for an explicitly
+configured HTTP loopback origin, e.g. `http://localhost:3001`.
## Docker images
diff --git a/web/packages/base/safe-navigation.ts b/web/packages/base/safe-navigation.ts
index 37271859e1..6d80152dac 100644
--- a/web/packages/base/safe-navigation.ts
+++ b/web/packages/base/safe-navigation.ts
@@ -1,4 +1,4 @@
-import { buildEnvAccountsOrigin, isDevBuild } from "./env";
+import { buildEnvAccountsOrigin } from "./env";
/** Parse an absolute server-supplied URL before using it as a destination. */
export const trustedNavigationURL = (
@@ -23,9 +23,8 @@ export const trustedNavigationURL = (
};
/**
- * Trust the client build's Accounts origin, never an API-selected origin.
- * Both hosted origins are needed during the legacy passkey RP migration.
- * Local HTTP requires an explicit build override and a development build.
+ * Use the configured Accounts origin, or the hosted origins for current and
+ * legacy passkeys. Local HTTP is allowed only when explicitly configured.
*/
export const accountsNavigationURL = (value: string): URL =>
trustedNavigationURL(
@@ -33,5 +32,5 @@ export const accountsNavigationURL = (value: string): URL =>
buildEnvAccountsOrigin
? [new URL(buildEnvAccountsOrigin).origin]
: ["https://accounts.ente.com", "https://accounts.ente.io"],
- isDevBuild && !!buildEnvAccountsOrigin,
+ !!buildEnvAccountsOrigin,
);