Skip to content

feat: enforce minimum password length of 8 characters with warning#1874

Open
jlima8900 wants to merge 1 commit intoKeeper-Security:masterfrom
jlima8900:feat/password-generator-minimum
Open

feat: enforce minimum password length of 8 characters with warning#1874
jlima8900 wants to merge 1 commit intoKeeper-Security:masterfrom
jlima8900:feat/password-generator-minimum

Conversation

@jlima8900
Copy link

@jlima8900 jlima8900 commented Mar 14, 2026

Summary

The $GEN password generator allows passwords as short as 4 characters. This raises the minimum to 8 and logs a warning when the length is clamped.

Changes

  • Minimum length: 4 → 8 (NIST SP 800-63B baseline)
  • Warning logged when requested length is below minimum
  • Help text examples: $GEN:rand,16$GEN (uses default 20)
  • Help text: fix typo, document character types
  • Default (20) and maximum (200) unchanged
  • dice and crypto algorithms unaffected

Why 8, not 16

Legacy systems (mainframes, older databases, some LDAP implementations) enforce max password lengths of 8-14 characters. Setting minimum to 16 would make Commander unusable for those systems. 8 is the NIST SP 800-63B baseline and accommodates legacy constraints while eliminating trivially weak passwords.

The warning ensures users know when their requested length was adjusted.

Test plan

  • $GEN generates 20-character password (default, unchanged)
  • $GEN:rand,24 generates 24-character password
  • $GEN:rand,6 generates 8-character password + logs warning
  • $GEN:rand,4 generates 8-character password + logs warning
  • $GEN:rand,8 generates 8-character password, no warning
  • $GEN:dice,5 unaffected
  • $GEN:crypto unaffected

The $GEN password generator previously allowed passwords as short as 4
characters. This raises the minimum to 8 (NIST SP 800-63B) and logs a
warning when the requested length is below minimum, so users with
legacy system constraints see what happened.

Changes:
- Raise minimum from 4 to 8 for rand algorithm
- Log warning when requested length is clamped
- Update help text examples to use $GEN (default length 20)
- Fix typo in help text (algorith → algorithm)
- Document character types included by default

The default length (20) and maximum (200) are unchanged. The dice and
crypto algorithms are unaffected.
@jlima8900 jlima8900 force-pushed the feat/password-generator-minimum branch from d7b0dea to 75b1bd0 Compare March 15, 2026 03:29
@jlima8900 jlima8900 changed the title feat: enforce minimum password length of 16 characters in generator feat: enforce minimum password length of 8 characters with warning Mar 15, 2026
@jlima8900
Copy link
Author

Note on enterprise password policy:

generate_password() does not consult the enterprise enforcement policy (PasswordRule / DomainPasswordRulesRequest). An enterprise admin can enforce minimum 16 characters with symbols, but $GEN:rand,4 would produce a 4-character password with no validation against that policy.

This PR raises the hardcoded floor from 4 to 8 as a safety net, but the deeper fix would be for generate_password() to check the enterprise password rules when available and use those as the minimum instead of a static value.

That's a larger change (requires params access in generate_password(), API call to fetch rules) — noting it here as a follow-up consideration.

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.

1 participant