Plugin: Password Complexity Policy

Aperta
#1,139 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
1.8k
Fork
219
Merge medio
2g 21h
PR unite (30g)
67

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SonicJs-Org/sonicjs

Tutte le issue di SonicJs-Org/sonicjs

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.