From 82e6db903ad7a9d5ecb990e4aefa500504687f68 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 8 Apr 2024 03:29:35 +0000 Subject: [PATCH] prevent functions domain and subdomain to be added as custom domain --- app/controllers/api/proxy.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 71125d2c87..c3a9fbe3ee 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -47,6 +47,12 @@ App::post('/v1/proxy/rules') if ($domain === $mainDomain) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.'); } + + $functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + if (str_ends_with($functionsDomain, $domain)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your functions domain or it\'s subdomain to specific resource. Please use different domain.'); + } + if ($domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please pick another one.'); }