-
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
[5.7] Add the ability to skip algorithm checking #25468
Conversation
I imagine that another name (like |
Very true, If that is deemed too long, |
I suggest just extending BcryptHasher or whatever hasher you want and adding the behavior you want. Then register it using HashManager::extend and using that as your driver. |
@taylorotwell I'm not sure you realise how that breaks existing apps, and will break also new apps in the future when new hashing algos will replace the existing ones? |
I believe that this breaking change was a hasty decision. I don't see any real gain out of this, for the sake of backward compatibility and to support future hashing algorithm, it should be consistent with how I also opened an issue on the framework repo: #25586 |
While I have overcome my issue using @taylorotwell's suggestion, I think @kamui545's has a decent argument. Future Algorithms Upon updating PHP all (bcrypt) hashes checked on login would now throw an exception without updating Laravel - as the password hashes are no longer valid in Laravel's eyes. What would be the solution in this situation? Backwards Compatibility What are your thoughts @taylorotwell? |
This has been fixed in |
Rejoice! 🎉 |
Defaulted verification to |
See #25458.
Upon updating to 5.7 a portion of my user accounts can no longer login (#25458) due to the algorithm checking in place. I think it would be wise to allow us to toggle this feature as and when needed.
Although ideally there should be complete consistency in terms of the hashing algorithm one uses, sometime this is not the case. For me, I have hashes that have originated from other applications and unfortunately some of them appear to have used an older version of bycrpt.
https://en.wikipedia.org/wiki/Bcrypt#Versioning_history
Below we have an example of the issue that I am running into. Because PHP doesn't recognise my bcrypt hash.
Example
Because the above returns an
algoName
ofunknown
the exception is thrown.https://github.com/laravel/framework/blob/5.7/src/Illuminate/Hashing/BcryptHasher.php#L60
PHP's
password_get_info()
function only recognises the$2y$
prefix. https://github.com/php/php-src/blob/master/ext/standard/password.c#L81Solution
I have added an option that you can specify in you config to turn on and off the algorithm checking (obviously on by default).
The issue in the ticket (#25458) is slightly different to my use case, but check it out.
If the is a more intelligent way of going about fixing this, do let me know.