-
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
Password rehashing doesn't work when using basic / onceBasic #50627
Comments
The issue is most likely the As I feared when encountering this issue myself, the message is a bit hard to grasp and debug, and moreover results in, in my eyes, confusing end-user behavior; see also #49834. I think at least some elaboration in the release notes on this could be added, although I personally would still think disabling algorithm verification by default is the way to go. Edit: to solve your problem for now, update your |
@valorin could you maybe confirm this? Thanks @jnoordsij! |
Thanks @jnoordsij, very helpful! Can conform the old behavior is back when I set However, the hashes are not updated after a |
Sorry, I need to correct myself. With the configs I agree with the post from @jnoordsij in #49834, that this is confusing default behavior. |
Yep, looks like two different issues at play here.
The first is only an issue if you've got hashes with different algos (as the OP does), but the second is a bug that I believe should be fixed. The question is though, would it be considered a breaking change, or just a bugfix? |
Just to add, I can't see a huge benefit to defaulting That said, maybe a documented env var would help? |
(Just wondering, definitely not an expert or something, just trying to learn and understand.) Is there any real life scenario where the user has that much access that it can actually influence the hashing algorithm in any way at creation time? Because I feel like that is always entirely dictated by the application; and even if not, it would be erroneous behavior anyways if a user can somehow influence the hash algorithm but it being denied usage in any way afterwards. |
Yep, it's possible if you use Eloquent's Hashed Cast on your models. The hashed cast checks if the password value is hashed before rehashing - to prevent you double-hashing the value when passing model values around. Unfortunately, this means that anyone submitting a hash in a password field can bypass the app hashing configuration and save a hash with a custom, and potentially malicious configuration. It's the reason for this PR: #48814 |
To help solve part of the issue reported in laravel#50627, exposing an env var to toggle hash verification avoids the need to manually implement the hashing.php file.
I made a PR that adds a simple env var for I'll aim to PR a fix for |
To help solve part of the issue reported in #50627, exposing an env var to toggle hash verification avoids the need to manually implement the hashing.php file.
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
This one has been solved by #50843. Thanks all! |
Laravel Version
11.0.7
PHP Version
8.3.4
Database Driver & Version
MariaDB 10.11.7
Description
The default hashing method of my application is argon2id. However, I've still some users with a bcrypt password.
PR #48665 introduces password rehashing - that's enabled in my application. However, if a user authenticates via
basic
oronceBasic
, the password is not rehashed and the error is thrown. In Laravel 10 they were able to login (keeping their bcrypt hashed password), however in Laravel 11 an error is being triggered:This password does not use the Argon2id algorithm.
, which is true - but I would expect that they can login and that their password will be rehashed. If a user use the 'normal' login viaAuth::attempt()
it works properly.I'm willing to prepare a PR to solve this, but I've no time to dive into it on short term - so I just created this issue for now.
Steps To Reproduce
HASH_DRIVER
toargon2id
basic
oronceBasic
, the login attempt will failThe text was updated successfully, but these errors were encountered: