From 81706610126e8f1c66fd75d74f564015e17d55d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sun, 18 May 2025 20:51:52 +0200 Subject: [PATCH 1/3] Fix domain validaiton --- app/controllers/api/proxy.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Function/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Redirect/Create.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php | 2 +- src/Appwrite/Platform/Workers/Certificates.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index a275738246..e96f8bfb2c 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -216,7 +216,7 @@ App::patch('/v1/proxy/rules/:ruleId/verification') $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index 443a5db35e..218ae4ce9b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -122,7 +122,7 @@ class Create extends Action if ($status === 'created') { $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 039f583150..4c98d3f0a2 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -134,7 +134,7 @@ class Create extends Action if ($status === 'created') { $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index a693e3ec30..37db1512d4 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -126,7 +126,7 @@ class Create extends Action if ($status === 'created') { $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index ac55b709e8..1d39df2b24 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -134,7 +134,7 @@ class Create extends Action if ($status === 'created') { $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 0c0229b88a..afa288849a 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -300,7 +300,7 @@ class Certificates extends Action $validators = []; $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); } if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { From 2ba4ae8e605c195575544dae08a76010243a01ca Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sun, 18 May 2025 18:54:29 +0000 Subject: [PATCH 2/3] fix: request response formats for 1.7.x --- src/Appwrite/Utopia/Request/Filters/V19.php | 6 ++++++ src/Appwrite/Utopia/Response/Filters/V19.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/Appwrite/Utopia/Request/Filters/V19.php b/src/Appwrite/Utopia/Request/Filters/V19.php index 31296b2eb2..27b854b46f 100644 --- a/src/Appwrite/Utopia/Request/Filters/V19.php +++ b/src/Appwrite/Utopia/Request/Filters/V19.php @@ -19,6 +19,12 @@ class V19 extends Filter case 'functions.listExecutions': unset($content['search']); break; + case 'project.createVariable': + case 'project.listVariables': + case 'functions.createVariable': + case 'functions.updateVariable': + $content['secret'] = false; + break; } return $content; } diff --git a/src/Appwrite/Utopia/Response/Filters/V19.php b/src/Appwrite/Utopia/Response/Filters/V19.php index 8ab430e569..2025cb629d 100644 --- a/src/Appwrite/Utopia/Response/Filters/V19.php +++ b/src/Appwrite/Utopia/Response/Filters/V19.php @@ -16,14 +16,19 @@ class V19 extends Filter Response::MODEL_FUNCTION => $this->parseFunction($content), Response::MODEL_FUNCTION_LIST => $this->handleList($content, 'functions', fn ($item) => $this->parseFunction($item)), Response::MODEL_DEPLOYMENT => $this->parseDeployment($content), + Response::MODEL_DEPLOYMENT_LIST => $this->handleList($content, 'deployments', fn ($item) => $this->parseDeployment($item)), Response::MODEL_PROXY_RULE => $this->parseProxyRule($content), + Response::MODEL_PROXY_RULE_LIST => $this->handleList($content, 'rules', fn ($item) => $this->parseProxyRule($item)), Response::MODEL_MIGRATION => $this->parseMigration($content), + Response::MODEL_MIGRATION_LIST => $this->handleList($content, 'migrations', fn ($item) => $this->parseMigration($item)), Response::MODEL_PROJECT => $this->parseProject($content), + Response::MODEL_PROJECT_LIST => $this->handleList($content, 'projects', fn ($item) => $this->parseProject($item)), Response::MODEL_PROVIDER_REPOSITORY => $this->parseProviderRepository($content), Response::MODEL_TEMPLATE_VARIABLE => $this->parseTemplateVariable($content), Response::MODEL_USAGE_FUNCTION => $this->parseUsageFunction($content), Response::MODEL_USAGE_FUNCTIONS => $this->parseUsageFunctions($content), Response::MODEL_VARIABLE => $this->parseVariable($content), + Response::MODEL_VARIABLE_LIST => $this->handleList($content, 'variables', fn ($item) => $this->parseVariable($item)), default => $parsedResponse, }; From 1e24d14dd11548728e30a6a0d16e836ce3d7d1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sun, 18 May 2025 21:32:26 +0200 Subject: [PATCH 3/3] Fix DNS lookup speed --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 4980315c9a..d7aa8b8d9e 100644 --- a/.env +++ b/.env @@ -24,7 +24,7 @@ _APP_OPENSSL_KEY_V1=your-secret-key _APP_DOMAIN=traefik _APP_DOMAIN_FUNCTIONS=functions.localhost _APP_DOMAIN_SITES=sites.localhost -_APP_DOMAIN_TARGET_CNAME=test.appwrite.io +_APP_DOMAIN_TARGET_CNAME=test.localhost _APP_DOMAIN_TARGET_A=127.0.0.1 _APP_DOMAIN_TARGET_AAAA=::1 _APP_RULES_FORMAT=md5