[PR #5050] [MERGED] fix(email-otp): prevent user enumeration on email OTP #5739

Closed
opened 2026-03-13 12:33:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5050
Author: @himself65
Created: 10/2/2025
Status: Merged
Merged: 11/19/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/02/fix


📝 Commits (1)

  • 53ba8f2 fix(email-otp): prevent user enumeration

📊 Changes

2 files changed (+59 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+56 -3)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+3 -2)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/5017

Summary by cubic

Prevents user enumeration in the Email OTP flow when disableSignUp is enabled. Unknown emails now return success without sending an email; existing users work as before.

  • Bug Fixes
    • Return success for non-existent emails instead of USER_NOT_FOUND when disableSignUp is true.
    • Do not call sendVerificationOTP for unknown users; still send for existing users.
    • Added tests covering both behaviors.

Written for commit 53ba8f2f64. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5050 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 11/19/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/02/fix` --- ### 📝 Commits (1) - [`53ba8f2`](https://github.com/better-auth/better-auth/commit/53ba8f2f64fea7154822c13cbdbe0d76e92dfb64) fix(email-otp): prevent user enumeration ### 📊 Changes **2 files changed** (+59 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+56 -3) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+3 -2) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/5017 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Prevents user enumeration in the Email OTP flow when disableSignUp is enabled. Unknown emails now return success without sending an email; existing users work as before. - **Bug Fixes** - Return success for non-existent emails instead of USER_NOT_FOUND when disableSignUp is true. - Do not call sendVerificationOTP for unknown users; still send for existing users. - Added tests covering both behaviors. <sup>Written for commit 53ba8f2f64fea7154822c13cbdbe0d76e92dfb64. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:33:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5739