← Java / Spring · Contents

JAVA-094 / Beginner

Weak password policy (length and complexity)

A07:2021 · CWE-521 Weak Password Requirements

Why is this a problem?

Short, dictionary-based passwords are accepted.

How to fix it

java
@Size(min = 12, max = 128) String password;   // Focus on length and check breached passwords (HIBP)

Further reading