← PHP / Laravel · Contents

PHP-098 / Intermediate

Weak password policy and lack of awareness of bcrypt's 72-byte limit

A07:2021 Identification and Authentication Failures · CWE-521 Weak Password Requirements

Why is this a problem?

Short passwords are accepted, and bcrypt ignores bytes beyond the first 72.

How to fix it

php
$request->validate(['password' => ['required', 'confirmed', Password::min(12)->mixedCase()->numbers()->uncompromised(), 'max:72']]);

Further reading