Password Policy Testing: Check Rules Without Frustrating Users
Password rules can create security theater when they reject strong passwords for arbitrary reasons or encourage predictable substitutions. A policy should improve account safety without making users fight the form.
The problem is not only the regex. It is the combination of the regex, the error message, password manager support, maximum length, and whether the rule accidentally blocks passphrases.
Test the policy against real examples
Create a set of passwords that should pass and fail. Include short strings, long passphrases, generated passwords, Unicode characters if supported, repeated characters, and common weak patterns.
- Set a generous maximum length unless there is a proven technical limit.
- Allow pasted passwords so password managers work correctly.
- Avoid rules that require predictable substitutions like replacing a with @.
- Check whether spaces are allowed in long passphrases.
Make error messages specific
Users should know what to fix without seeing the full validation rule. A vague message like invalid password creates repeated failures and support requests.
- Tell the user which requirement failed.
- Do not reveal whether an existing account uses a similar password.
- Keep strength guidance separate from hard validation rules.
- Test the message on mobile where space is limited.
Validate security and usability together
Use a policy tester to check the regex, then try the form with a password manager. If generated passwords pass, long passphrases pass, and weak obvious strings fail, the policy is in better shape.
A good password policy should block risky choices without blocking the tools users rely on to create strong passwords.
Open Password Policy Tester →