From d44d6a97bda26a464e1e252f087462f3f09c4b5e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Jul 2026 11:20:31 +0000 Subject: [PATCH] fix: default router protection to disabled when unset Align System::getEnv fallback for _APP_OPTIONS_ROUTER_PROTECTION with variables.php and .env (disabled). Opt in with enabled. Refs #12798 Co-authored-by: Chirag Aggarwal --- app/controllers/general.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 8d31e9507a..52ce7bc49a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -132,7 +132,8 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S } } - if (!in_array($host, $platformHostnames) && System::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'enabled') === 'enabled') { + // Default must match app/config/variables.php and .env (`disabled`). Opt in with `enabled`. + if (!in_array($host, $platformHostnames) && System::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled') { throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite over this domain. Please add it as custom domain to your project or disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.', view: $errorView); }