Skip to content

ext/standard: notice on long passwords in bcrypt - #23076

Draft
Sjord wants to merge 3 commits into
php:masterfrom
Sjord:bcrypt-72-notice
Draft

ext/standard: notice on long passwords in bcrypt#23076
Sjord wants to merge 3 commits into
php:masterfrom
Sjord:bcrypt-72-notice

Conversation

@Sjord

@Sjord Sjord commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@Sjord

Sjord commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

This could also apply to crypt. However, with crypt there is not a distinction between creating the hash and verifying the hash, as there is with password_hash / password_verify, which means that anyone that can access to login screen can trigger the notice by entering a long password. That makes the notice less meaningful and bigger chance of BC break.

@Sjord

Sjord commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@nikic @narfbg @ircmaxell I am looking into this again, and you seemed to have objected last time. Do you feel the same now?

This is mostly for the case where some static string is prepended to the password before being passed to password_hash, and not so much for the case where users actually use 72 character passwords.

@narfbg

narfbg commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the ping, @Sjord.

I do still think that warnings would do more harm than good.

However, I might not be against a fail-closed approach where an exception is thrown. Not to say that I'd outright support that (the BC break can be too big a price to pay) but it would solve most of the problems I have with the warning idea.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants