[PR #8091] [MERGED] feat: limit enumeration on sign-up when email verification is required #7740

Closed
opened 2026-03-13 13:47:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8091
Author: @bytaesu
Created: 2/21/2026
Status: Merged
Merged: 2/21/2026
Merged by: @Bekacru

Base: canaryHead: 2026-02-22/feat/sign-up-enumeration-protection


📝 Commits (2)

  • e63e163 feat(auth): prevent user enumeration on sign-up
  • bcde430 docs: add onExistingUserSignUp and missing options

📊 Changes

5 files changed (+280 additions, -8 deletions)

View changed files

📝 docs/content/docs/authentication/email-password.mdx (+47 -0)
📝 docs/content/docs/reference/options.mdx (+3 -0)
📝 packages/better-auth/src/api/routes/sign-up.test.ts (+172 -0)
📝 packages/better-auth/src/api/routes/sign-up.ts (+44 -8)
📝 packages/core/src/types/init-options.ts (+14 -0)

📄 Description

It doesn't change the default behavior, but since error handling may change, it should be introduced in v1.5.


Summary by cubic

Implements #7972: prevent user enumeration on sign-up by returning a generic success for existing emails when requireEmailVerification is on or autoSignIn is off. Adds an onExistingUserSignUp callback to notify the real account holder; default behavior stays the same.

  • New Features
    • Existing-email sign-ups return success without a token; no sign-in occurs.
    • New onExistingUserSignUp callback runs only when requireEmailVerification is true or autoSignIn is false.
    • Reduces timing leaks by normalizing email and hashing passwords on duplicate requests; updated docs and tests.

Written for commit bcde43031e. Summary will update 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/8091 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/21/2026 **Status:** ✅ Merged **Merged:** 2/21/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2026-02-22/feat/sign-up-enumeration-protection` --- ### 📝 Commits (2) - [`e63e163`](https://github.com/better-auth/better-auth/commit/e63e163eb5dccc5fec8be9f14984e186c6a415e3) feat(auth): prevent user enumeration on sign-up - [`bcde430`](https://github.com/better-auth/better-auth/commit/bcde43031e9fbda188d16028473cab7a53a05c76) docs: add onExistingUserSignUp and missing options ### 📊 Changes **5 files changed** (+280 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/authentication/email-password.mdx` (+47 -0) 📝 `docs/content/docs/reference/options.mdx` (+3 -0) 📝 `packages/better-auth/src/api/routes/sign-up.test.ts` (+172 -0) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+44 -8) 📝 `packages/core/src/types/init-options.ts` (+14 -0) </details> ### 📄 Description It doesn't change the default behavior, but since error handling may change, it should be introduced in v1.5. - Closes #7972 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Implements #7972: prevent user enumeration on sign-up by returning a generic success for existing emails when requireEmailVerification is on or autoSignIn is off. Adds an onExistingUserSignUp callback to notify the real account holder; default behavior stays the same. - **New Features** - Existing-email sign-ups return success without a token; no sign-in occurs. - New onExistingUserSignUp callback runs only when requireEmailVerification is true or autoSignIn is false. - Reduces timing leaks by normalizing email and hashing passwords on duplicate requests; updated docs and tests. <sup>Written for commit bcde43031e9fbda188d16028473cab7a53a05c76. Summary will update 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 13:47:48 -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#7740