Skip to content

feat(auth): #66: replace regex password strength with entropy-based validation - #76

Merged
imdeepmind merged 1 commit into
developfrom
#66
Aug 30, 2026
Merged

feat(auth): #66: replace regex password strength with entropy-based validation#76
imdeepmind merged 1 commit into
developfrom
#66

Conversation

@imdeepmind

Copy link
Copy Markdown
Owner

Closes #66

Summary

Replaces the hand-rolled regex-based password_strength validation with the go-password-validator library, which scores passwords by Shannon entropy instead of checking a fixed set of character classes.

Changes

  • internal/features/auth/service.go — added minPasswordEntropy = 60.0 named constant; validatePasswordStrength now calls passwordvalidator.Validate(password, minPasswordEntropy). The four regexp.MustCompile class-counting checks are gone.
  • internal/shared/errors/errors.go — added ErrWeakPassword sentinel so a weak password surfaces a clear, actionable message instead of the generic "incomplete or invalid" error.
  • internal/features/auth/service.goRegister/ResetPassword return ErrWeakPassword when the password_strength rule fails, ErrInvalidInput otherwise (via passwordValidationError).
  • frontend/src/lib/validations.ts — dropped the client-side class-counting regex checks (uppercase/lowercase/number/symbol) from the password schemas; kept min 8. Strength is now backend-owned.
  • go.mod/go.sum — added github.com/wagslane/go-password-validator v0.3.0.

Behavior

  • Long strong passphrases (e.g. correcthorsebatterystaple, ~117 bits) are accepted.
  • Short/weak passwords (e.g. password, ~37 bits) are rejected with a clear message.
  • min=8 and the password_strength validator glue are unchanged; the Wails-bound surface is untouched (no wailsjs regeneration needed).

Verification

  • go build ./..., go vet ./..., gofmt clean
  • npm --prefix frontend run lint, npm --prefix frontend run type-check

@imdeepmind
imdeepmind merged commit 746962b into develop Aug 30, 2026
6 checks passed
@imdeepmind
imdeepmind deleted the #66 branch August 30, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace custom password strength regex validation with go-password-validator (entropy-based)

1 participant