Plugin: Password Complexity Policy

Open
#1,139 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
postgresql, typescript

Research direction

Start by reading the existing plugin mechanism and authentication flows for registration, password changes, and resets; the issue does not name specific files or tests. Then map where policy configuration and validation would integrate across those flows and the admin panel. Done means the listed policy rules can be configured and enforced at every specified entry point, with structured errors and tests covering each rule and flow.

Written by the indexing model from the issue text.

Description

area: plugins enhancement priority: P3

Feature Description

Add a new SonicJS plugin that allows admins to define and enforce password complexity requirements across all user accounts.

Motivation

Currently SonicJS has no built-in mechanism to mandate password strength. Organizations with compliance requirements (SOC 2, HIPAA, internal security policies) need the ability to enforce minimum password complexity to reduce the risk of account compromise.

Proposed Solution

A new plugin (e.g. @sonicjs/plugin-password-policy) that integrates with the existing auth flow and exposes admin-configurable rules:

Admin Configuration (via CMS admin panel or config)
  • Minimum length — e.g. 12 characters
  • Character classes — require uppercase, lowercase, digits, special characters (individually toggleable)
  • Maximum length — optional cap
  • Disallow common passwords — block passwords from a known-weak list (e.g. rockyou top N)
  • Disallow username in password — prevent trivial user-specific passwords
  • Password history — prevent reuse of last N passwords
  • Expiry / rotation — optional max password age with forced reset
Enforcement Points
  • Registration — reject non-compliant passwords at signup
  • Password change / reset — enforce policy on all password updates
  • Admin-initiated reset — when an admin resets a user's password, enforce policy on the new value
  • Existing accounts — optional: flag non-compliant accounts and prompt on next login
API / Integration
  • Exposes a validatePassword(password, policy) utility for use in custom forms/APIs
  • Returns structured errors (e.g. { rule: 'minLength', required: 12, actual: 8 }) for clean UI feedback
  • Policy config stored in D1 (admin-editable at runtime) with sensible defaults
UI
  • Admin panel section to view/edit the active policy
  • Inline validation feedback on password input fields

Alternatives Considered

  • Enforcing policy only at the application level (no admin control) — too rigid for multi-tenant or configurable deployments
  • Relying entirely on the identity provider — SonicJS needs to own this for self-hosted setups

Acceptance Criteria

  • Plugin installable via standard SonicJS plugin mechanism
  • Admin can configure policy rules without a code deploy
  • Policy enforced on registration, password change, and reset flows
  • Structured validation errors returned for UI rendering
  • Defaults are secure-but-reasonable out of the box
  • Tests cover each rule and enforcement point
Dominant language
TypeScript
Stars
1.8k
Forks
219
Avg merge
2d 21h
Merged PRs (30d)
67

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SonicJs-Org/sonicjs

All issues in SonicJs-Org/sonicjs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.