From 0696421e56e5bb883aca98351c6cd60a64421301 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 25 Oct 2025 02:30:29 +0800 Subject: [PATCH 1/2] fix: validate pooler domain per profile --- internal/utils/connect.go | 2 +- internal/utils/profile.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/utils/connect.go b/internal/utils/connect.go index 3223bb0323..bd8d199f71 100644 --- a/internal/utils/connect.go +++ b/internal/utils/connect.go @@ -98,7 +98,7 @@ func assertDomainInProfile(host string) error { if err != nil { return errors.Errorf("failed to parse pooler TLD: %w", err) } - if !strings.HasSuffix(CurrentProfile.APIURL, "."+domain) { + if len(CurrentProfile.PoolerHost) > 0 && !strings.EqualFold(CurrentProfile.PoolerHost, domain) { return errors.Errorf("Pooler domain does not belong to current profile: %s", domain) } return nil diff --git a/internal/utils/profile.go b/internal/utils/profile.go index 06b607a0d7..4d07cf5bdb 100644 --- a/internal/utils/profile.go +++ b/internal/utils/profile.go @@ -16,6 +16,7 @@ type Profile struct { APIURL string `mapstructure:"api_url" validate:"required,http_url"` DashboardURL string `mapstructure:"dashboard_url" validate:"required,http_url"` ProjectHost string `mapstructure:"project_host" validate:"required,hostname_rfc1123"` + PoolerHost string `mapstructure:"pooler_host" validate:"required,hostname_rfc1123"` DocsURL string `mapstructure:"docs_url" validate:"omitempty,http_url"` StudioImage string `mapstructure:"studio_image"` } @@ -26,12 +27,14 @@ var allProfiles = []Profile{{ DashboardURL: "https://supabase.com/dashboard", DocsURL: "https://supabase.com/docs", ProjectHost: "supabase.co", + PoolerHost: "supabase.com", }, { Name: "supabase-staging", APIURL: "https://api.supabase.green", DashboardURL: "https://supabase.green/dashboard", DocsURL: "https://supabase.com/docs", ProjectHost: "supabase.red", + PoolerHost: "supabase.green", }, { Name: "supabase-local", APIURL: "http://localhost:8080", @@ -44,6 +47,7 @@ var allProfiles = []Profile{{ DashboardURL: "https://cloud.snap.com/dashboard", DocsURL: "https://cloud.snap.com/docs", ProjectHost: "snapcloud.dev", + PoolerHost: "snapcloud.co", }} var CurrentProfile Profile From ccfcc929d5cbbe3b30ec1bd21a54f575d82efda4 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Mon, 27 Oct 2025 16:34:07 +0800 Subject: [PATCH 2/2] chore: mark pooler host as optional --- internal/utils/profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/utils/profile.go b/internal/utils/profile.go index 4d07cf5bdb..eef9e5a0da 100644 --- a/internal/utils/profile.go +++ b/internal/utils/profile.go @@ -16,7 +16,7 @@ type Profile struct { APIURL string `mapstructure:"api_url" validate:"required,http_url"` DashboardURL string `mapstructure:"dashboard_url" validate:"required,http_url"` ProjectHost string `mapstructure:"project_host" validate:"required,hostname_rfc1123"` - PoolerHost string `mapstructure:"pooler_host" validate:"required,hostname_rfc1123"` + PoolerHost string `mapstructure:"pooler_host" validate:"omitempty,hostname_rfc1123"` DocsURL string `mapstructure:"docs_url" validate:"omitempty,http_url"` StudioImage string `mapstructure:"studio_image"` }