Skip to content

fix: prevent account enumeration on recover endpoint for invalid emai… - #2723

Open
guptamilind0099 wants to merge 3 commits into
supabase:masterfrom
guptamilind0099:fix/recover-account-enumeration
Open

fix: prevent account enumeration on recover endpoint for invalid emai…#2723
guptamilind0099 wants to merge 3 commits into
supabase:masterfrom
guptamilind0099:fix/recover-account-enumeration

Conversation

@guptamilind0099

@guptamilind0099 guptamilind0099 commented Aug 22, 2026

Copy link
Copy Markdown

(#2702)

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Fixes #2702.
On POST /auth/v1/recover, attempting password recovery for an existing user on an invalid or reserved email domain (such as @example.com) returns HTTP 400 email_address_invalid, whereas a missing user returns HTTP 200 OK. This response discrepancy creates an account enumeration vector.
Please link any relevant issues here.

What is the new behavior?

Intercepts ErrorCodeEmailAddressInvalid inside the Recover handler and responds with HTTP 200 OK, matching the missing user response and eliminating the account enumeration leak.

Added unit test TestRecover_EmailAddressInvalidNoLeak in internal/api/recover_test.go to ensure both existing and missing users on invalid domains return HTTP 200 OK.

Additional context

Verified locally against PostgreSQL test suite.

Comment thread internal/api/recover.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POST /auth/v1/recover returns email_address_invalid for an existing user and success for a missing user (account enumeration)

1 participant