From a3eecd10aa4b5c331d947842345c7126f944bbdc Mon Sep 17 00:00:00 2001 From: Chris Stockton <180184+cstockton@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:46:58 -0700 Subject: [PATCH] chore: merge release/2.165.0 into master (#1875) This merges a small release hotfix committed into the releases branch back into master. --------- Co-authored-by: Kang Ming Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ internal/conf/configuration.go | 4 ++-- internal/mailer/validate.go | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b46ea0e..384a57a5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.165.1](https://github.com/supabase/auth/compare/v2.165.0...v2.165.1) (2024-12-06) + + +### Bug Fixes + +* allow setting the mailer service headers as strings ([#1861](https://github.com/supabase/auth/issues/1861)) ([7907b56](https://github.com/supabase/auth/commit/7907b566228f7e2d76049b44cfe0cc808c109100)) + ## [2.165.0](https://github.com/supabase/auth/compare/v2.164.0...v2.165.0) (2024-12-05) diff --git a/internal/conf/configuration.go b/internal/conf/configuration.go index 390cb29e4..c4d910d99 100644 --- a/internal/conf/configuration.go +++ b/internal/conf/configuration.go @@ -403,7 +403,7 @@ type MailerConfiguration struct { // EXPERIMENTAL: May be removed in a future release. EmailValidationExtended bool `json:"email_validation_extended" split_words:"true" default:"false"` EmailValidationServiceURL string `json:"email_validation_service_url" split_words:"true"` - EmailValidationServiceHeaders string `json:"email_validation_service_key" split_words:"true"` + EmailValidationServiceHeaders string `json:"email_validation_service_headers" split_words:"true"` serviceHeaders map[string][]string `json:"-"` } @@ -414,7 +414,7 @@ func (c *MailerConfiguration) Validate() error { if c.EmailValidationServiceHeaders != "" { err := json.Unmarshal([]byte(c.EmailValidationServiceHeaders), &headers) if err != nil { - return fmt.Errorf("conf: SMTP headers not a map[string][]string format: %w", err) + return fmt.Errorf("conf: mailer validation headers not a map[string][]string format: %w", err) } } diff --git a/internal/mailer/validate.go b/internal/mailer/validate.go index b18a08769..182746699 100644 --- a/internal/mailer/validate.go +++ b/internal/mailer/validate.go @@ -197,7 +197,7 @@ func (ev *EmailValidator) validateService(ctx context.Context, email string) err } rdr := bytes.NewReader(reqData) - req, err := http.NewRequestWithContext(ctx, "GET", ev.serviceURL, rdr) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, ev.serviceURL, rdr) if err != nil { return nil } @@ -218,7 +218,8 @@ func (ev *EmailValidator) validateService(ctx context.Context, email string) err Valid *bool `json:"valid"` }{} - if res.StatusCode != http.StatusOK { + if res.StatusCode/100 != 2 { + // we ignore the error here just in case the service is down return nil }