hashPasswordForCookie triggers deprecation warning with passwordless users (null passed to hash_hmac) #58524
Unanswered
joostdebruijn
asked this question in
Ideas
Replies: 1 comment
-
|
Moving this to Ideas as the contract clearly suggest password should always be a string: framework/src/Illuminate/Contracts/Auth/Authenticatable.php Lines 28 to 33 in fed40f0 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
12.48.1
PHP Version
8.5.2
Database Driver & Version
MariaDB 11.8.5
Description
In applications with passwordless users, calling
hashPasswordForCookieresults in a deprecation warning:hash_hmac(): Passing null to parameter #2 ($data) of type string is deprecated in vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 635This happens because, for passwordless users, the password is
null, which gets passed directly tohash_hmacas the$dataparamete.Related/possibly relevant: PR #58107 refactored handling of password storage in session cookies, but I am unsure what would be the secure or intended approach when the user does not have a password at all. I do not want to introduce custom logic for empty passwords that weakens security or causes inconsistencies in session handling. However, I believe there might be more occurrences in the framework where passwordless users might be a problem as well.
What is the best secure way forward to support passwordless users while addressing this deprecation?
Steps To Reproduce
null).hashPasswordForCookie(such as using the "remember me" functionality).hash_hmac(): Passing null to parameter #2 ($data) of type string is deprecated in vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 635Expected: The framework should not produce deprecation warnings, and session/cookie security should remain strong even for users with no password set.
Beta Was this translation helpful? Give feedback.
All reactions