Skip to content

feat(plugin-auth): password complexity policy (ADR-0069 D1, P1)#2368

Merged
os-zhuang merged 1 commit into
mainfrom
auth/adr-0069-complexity
Jun 27, 2026
Merged

feat(plugin-auth): password complexity policy (ADR-0069 D1, P1)#2368
os-zhuang merged 1 commit into
mainfrom
auth/adr-0069-complexity

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

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

  • New auth settings: password_require_complexity (toggle, default off) + password_min_classes (1–4, default 3), in the password-policy group.
  • 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 password_min_classes of the four character classes (upper / lower / digit / symbol) with PASSWORD_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

  • Unit: 126 plugin-auth + 6 manifest tests green; builds incl. strict DTS green.
  • Live dogfood (showcase): complexity OFF accepts a weak password; ON rejects a lowercase-only password (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

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>
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 27, 2026 1:33pm

Request Review

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling and removed size/m labels Jun 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-auth, packages/services.

14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/implementation-status.mdx (via @objectstack/plugin-auth)
  • content/docs/concepts/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/getting-started/cli.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/auth-sso.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/authentication.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/kernel-services.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/packages.mdx (via @objectstack/plugin-auth, packages/services)
  • content/docs/guides/plugins.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/production-readiness.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/runtime-services/audit-service.mdx (via packages/services)
  • content/docs/guides/runtime-services/index.mdx (via packages/services)
  • content/docs/guides/runtime-services/settings-service.mdx (via packages/services)
  • content/docs/protocol/objectos/i18n-standard.mdx (via packages/services)
  • content/docs/releases/v9.mdx (via @objectstack/plugin-auth)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant