Skip to content

Bug 1851434: make password quality hookable, drop passwdqc params - #197

Open
topunix wants to merge 1 commit into
bugzilla:mainfrom
topunix:bug-1851434-password
Open

topunix wants to merge 1 commit into
bugzilla:mainfrom
topunix:bug-1851434-password

Conversation

@topunix

@topunix topunix commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1851434

Split out of #183 per review, which now carries only the secure_mail guard.

What changed

assert_password_is_secure has been an empty stub since Data::Password::passwdqc was removed in 8edd271, so no password check runs today. This PR follows the agreed direction that password quality should be hookable from core, with stricter policy living in an extension:

  • password_complexity = no_constraints (the default) applies no checks, same as main today. Installs that haven't changed this param see no new enforcement.
  • password_complexity = bmo rejects passwords shorter than USER_PASSWORD_MIN_LENGTH, then requires 3 of 5: lowercase, uppercase, digit, non-alphanumeric, or longer than 12 characters.
  • New password_check hook for extensions. It only runs when the core check accepted the password, so an extension can add a rejection but never clear one. POD in Bugzilla/Hook.pm.
  • Removed the passwdqc_* params, their checkers and help text, and t/903-passwdqc-conf.t, since nothing reads them.
  • Updated two qa/config fixture passwords to pass the bmo complexity rule, which the QA environment uses.

Tests

New t/password-policy.t (Bugzilla::Test::MockParams, no database needed; the hook is stubbed with Test2::Tools::Mock):

  • no_constraints accepts a 1-character password
  • bmo rejects a short password
  • bmo rejects a long but simple password
  • bmo accepts a password meeting 3 of 5 features
  • a hook can reject a password the core check accepted
  • a hook cannot clear a core rejection

t/004template.t, t/005whitespace.t and t/012throwables.t also pass.

Upgrade note

Installs with passwdqc_* settings lose them, but those settings have not been enforced since passwdqc was removed. For enforcement, set password_complexity = bmo, or implement the password_check hook in an extension.

Rework assert_password_is_secure per review feedback on PR bugzilla#183.

The default password_complexity (no_constraints) now applies no checks
at all, matching main's current (empty-stub) behavior. The bmo
complexity setting rejects passwords shorter than
USER_PASSWORD_MIN_LENGTH, then requires 3 of 5 character-class/length
features.

The password_check hook is now only invoked when the core check has
accepted the password, so an extension can add a rejection but can
never clear one made by the core check. Update the hook's POD to
match: reason is a reference to an undefined scalar, and an extension
sets it to reject.

Update two qa/ fixture passwords so they pass the bmo complexity
check, which the QA test environment enables.

Add t/password-policy.t, covering: no_constraints accepting a
1-character password, bmo rejecting short and long-but-simple
passwords, bmo accepting a complex password, a hook rejecting an
otherwise-accepted password, and a hook being unable to clear a core
rejection.

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant