Skip to content
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

[9.x] Improve password checks #42248

Merged
merged 4 commits into from
May 4, 2022

Conversation

korkoshko
Copy link
Contributor

It also fixes a possible collision when credentials contains only "password" values.

$provider->retrieveByCredentials(['password' => 'dayle', 'password2' => 'night']);

As a result of the code above, the first record will be retrieved from the table in the database.

@driesvints
Copy link
Member

driesvints commented May 4, 2022

This a major breaking change and security risk. You're trying to retrieve users by their unhashed passwords, something that should be avoided at all costs. Please hash your passwords.

@korkoshko
Copy link
Contributor Author

@driesvints Sorry, maybe I didn't express myself very well. After my changes to the retrieveByCredentials method all password values are excluded from credentials array. This method calling by method "attempt" in SessionGuard, which is used in the Auth facade.

@korkoshko
Copy link
Contributor Author

korkoshko commented May 4, 2022

@driesvints Now there is a bug when only two or more keys with the substring "password" can be passed to the "attempt" method as input:

Auth::attempt(['password' => 'dayle', 'password2' => 'night']);

As a result of this "bug", the first record (without filters) will be retrieved from the table, and this is not good : )

@korkoshko
Copy link
Contributor Author

@driesvints just look L108 and then L120 to understand the bug above.

@taylorotwell taylorotwell merged commit 8542414 into laravel:9.x May 4, 2022
@driesvints
Copy link
Member

@korkoshko I finally see what you meant now. Sorry, misjudged this. Thanks for your PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants