[GH-ISSUE #2484] Feature Request: Configurable Password Complexity Rules for Authentication #9218

Closed
opened 2026-04-13 04:37:38 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @andasilva on GitHub (Apr 30, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2484

Is this suited for github?

  • Yes, this is suited for github

It would be extremely helpful to allow projects using this library to configure additional password complexity requirements beyond minimum length. Specifically, I’d like to be able to enforce:

  • At least one uppercase letter
  • At least one lowercase letter
  • At least one special character (e.g. !@#$%^&*())
  • Minimum length (already supported)

Right now, the library lets you specify a minimum password length (e.g. minPasswordLength: 10) but does not provide hooks for more granular complexity checks. As a result, users can create passwords that meet the length requirement but lack variety of character types, which reduces overall security.

Describe the solution you'd like

Introduce new configuration options (e.g. requireUppercase, requireLowercase, requireSpecialChar) that default to false to preserve backwards compatibility. When set to true, the authentication flow will reject any password that does not include at least one of the specified character types, in addition to meeting the existing minLength rule.

Describe alternatives you've considered

Frontend-Only Checks: Implementing validations in the client (e.g. React/Vue form validators) to enforce complexity, but this can be bypassed if not mirrored on the server side.

Bypass auth client with unified Password-Validation and User-Creation Endpoint:
Provide a single server-side route that both enforces password complexity rules and, if validation succeeds, creates the user in one atomic operation.

Additional context

No response

Originally created by @andasilva on GitHub (Apr 30, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2484 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. It would be extremely helpful to allow projects using this library to configure additional password complexity requirements beyond minimum length. Specifically, I’d like to be able to enforce: - At least one uppercase letter - At least one lowercase letter - At least one special character (e.g. !@#$%^&*()) - Minimum length (already supported) Right now, the library lets you specify a minimum password length (e.g. minPasswordLength: 10) but does not provide hooks for more granular complexity checks. As a result, users can create passwords that meet the length requirement but lack variety of character types, which reduces overall security. ### Describe the solution you'd like Introduce new configuration options (e.g. requireUppercase, requireLowercase, requireSpecialChar) that default to false to preserve backwards compatibility. When set to true, the authentication flow will reject any password that does not include at least one of the specified character types, in addition to meeting the existing minLength rule. ### Describe alternatives you've considered **Frontend-Only Checks**: Implementing validations in the client (e.g. React/Vue form validators) to enforce complexity, but this can be bypassed if not mirrored on the server side. **Bypass auth client with unified Password-Validation and User-Creation Endpoint**: Provide a single server-side route that both enforces password complexity rules and, if validation succeeds, creates the user in one atomic operation. ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 04:37:38 -05:00
Author
Owner

@LarsHanegraaf commented on GitHub (Jul 3, 2025):

Also interested in this one, any insight why the proposed PR wouldn't fit?

<!-- gh-comment-id:3031451831 --> @LarsHanegraaf commented on GitHub (Jul 3, 2025): Also interested in this one, any insight why the proposed PR wouldn't fit?
Author
Owner

@LarsHanegraaf commented on GitHub (Jul 3, 2025):

I see, this won't be added for reasons mentioned here https://github.com/better-auth/better-auth/issues/779

<!-- gh-comment-id:3031467304 --> @LarsHanegraaf commented on GitHub (Jul 3, 2025): I see, this won't be added for reasons mentioned here https://github.com/better-auth/better-auth/issues/779
Author
Owner

@dosubot[bot] commented on GitHub (Oct 2, 2025):

Hi, @andasilva. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding configurable password complexity rules with server-side enforcement and backward-compatible defaults.
  • The maintainer acknowledged your request but decided not to implement this feature.
  • The decision references a previous issue (#779) that explains the reasons for not adding configurable complexity rules.
  • No further discussion or alternative solutions have been proposed since then.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of better-auth by commenting here.
  • If I don’t hear from you within 7 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3361998045 --> @dosubot[bot] commented on GitHub (Oct 2, 2025): Hi, @andasilva. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding configurable password complexity rules with server-side enforcement and backward-compatible defaults. - The maintainer acknowledged your request but decided not to implement this feature. - The decision references a previous issue (#779) that explains the reasons for not adding configurable complexity rules. - No further discussion or alternative solutions have been proposed since then. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of better-auth by commenting here. - If I don’t hear from you within 7 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9218