-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Add default max length for Password rule object #49752
Conversation
Is the use of
|
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions! If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response. |
Thanks for your comments.
Clearly refers to chars and the number of chars could differ to the number of bytes. |
Oh, damn, good point. I always get confused between those... I don't like the idea of using bytes in the validation message - the concept is confusing to those who don't understand the difference between bytes and chars. I wonder if we should stick with simple and validate based on 72 characters, and just allow bcrypt to truncate it if someone uses multi-byte chars? Another option is to hash the raw password before bcrypting, to remove the limits. But I've seen advice against this. 🤔 |
I think it makes sense for Perhaps the best thing to do on the bcrypt 72 byte truncation issue is... nothing? It's a limitation of the hashing algorithm that's impossible to meaningfully explain to users. Any developer who decides it does need explaining could do so easily enough in their app:
|
I agree. I think it's fine to keep |
@taylorotwell , we've discussed this topic and came to the conclusion to limit the password by chars and not bytes. |
@angelej In the discussion above I think we reached the conclusion that it isn't worth trying to handle the bcrypt byte truncation behaviour, so I suspect this PR doesn't need re-opening. |
I don't understand the OWASP recommendation on this. People that use 72 or more chars for their password are very likely using a password manager. I don't care whether it uses 72 or 75 or 80. All should be more secure than any handpicked password. But I am annoyed when I need to generate passwords multiple times because the max length is locked. |
@pxlrbt if you use a password which is longer than 72 characters an it is truncated (like with bcrypt), but still accept such a password knowing only the first 72 characters will be used, you will give the user a false sense of security, because they assume, that all characters will be used. |
@Jubeki Bcrypt truncates the password after 72 bytes not 72 "characters". |
@ziadoz I mostly assume that ASCII-charactes (which are 1 byte) are what normally are used in passwords, though that is wrong to assume you are right. |
While I agree with the sentiment that enforcing a maximum length is annoying, 72 characters/bytes is significantly more than the 8, 16, or 20 characters we're normally getting frustrated at in stupid password limits. Do you actually use passwords longer than 72 characters normally that this would affect you? In my opinion, a 72+ character password is massive overkill, I can't see any practical reason for using a password that long. Regarding OWASP, my understanding is the same as @Jubeki - it's to prevent a false sense of security with the hidden truncation of the password. Also note, this wasn't merged, so all we've got so far is an optional rule in the other PR that isn't enabled by default. Making this a moot point if this isn't reopened or attempted in another PR. |
Set the default max length for the Password rule object to 72 chars, see #49739