feat(plugin-auth): password complexity policy (ADR-0069 D1, P1)#2368
Merged
Conversation
Adds `password_require_complexity` (toggle, default off) + `password_min_classes` (1-4, default 3) auth settings. A custom validator runs in the better-auth `before` hook on /sign-up/email, /reset-password, /change-password and rejects a password using fewer than min_classes of the four character classes (upper/lower/digit/symbol) with PASSWORD_POLICY_VIOLATION — better-auth natively enforces only min/max length. Default-off / additive (no upgrade behavior change); ADR-0049 (enforcement ships with the setting); no new identity fields. Verified live (dogfood): complexity OFF accepts a weak password; ON rejects a lowercase-only password (400 PASSWORD_POLICY_VIOLATION) and accepts a 3-class password, on BOTH /sign-up/email and /change-password (newPassword). Unit: 126 plugin-auth + 6 manifest tests green; builds incl. strict DTS green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This was referenced Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADR-0069 P1 (tracking #2281): D1 password complexity. Continues the password-policy work alongside the HIBP breached-password reject (#2361), reusing the same setting→before-hook-enforcement pattern.
What
authsettings:password_require_complexity(toggle, default off) +password_min_classes(1–4, default 3), in the password-policy group.beforehook on/sign-up/email,/reset-password,/change-passwordand rejects a password using fewer thanpassword_min_classesof the four character classes (upper / lower / digit / symbol) withPASSWORD_POLICY_VIOLATION. better-auth natively enforces only min/max length — class-mix is the custom piece.ADR-0049
Default-off / additive (no upgrade behavior change); the setting ships with its enforcement (no false surface). No new identity fields.
Verification
400 PASSWORD_POLICY_VIOLATION) and accepts a 3-class password — confirmed on both/sign-up/email(password) and/change-password(newPassword).ADR-0069 P1 status
✅ D1 HIBP (#2361) · ✅ D2 lockout + rate-limit (#2365) · ✅ D1 complexity (this PR). Remaining: D1 expiry/history, D3 enforced MFA (larger — core-runtime gate + objectui follow-up).
🤖 Generated with Claude Code