Problem/Motivation
When trying to delete a token the functions creates a hash on an already hashed token. Therefore the token is not deleted in the database.
Proposed resolution
Remove the additional hash function in the deleteToken function:
- ->condition('series', Crypt::hashBase64($token->getSeries()))
+ ->condition('series', $token->getSeries())Remaining tasks
On top of that, it would be great to implement a hook_user_delete() to delete all data for the deleted user stored in the persistent_login database table.
This would also fix: https://www.drupal.org/project/persistent_login/issues/3399159
on a more cleaner way on the perspective of datasecurity/datapolicy
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3400061-2.patch | 1.41 KB | slowflyer |
Issue fork persistent_login-3400061
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
slowflyer commentedPatch fixing the issue and implementing hook_user_delete
Comment #4
slowflyer commentedSame issue on 2.x branch.
Comment #5
gappleThanks for the report and merge request.
I'm going to explore ways to make it more explicit whether the token values are hashed or not
Comment #10
g-brodieiChanging the target branch to 2.x.
When a deleted user that has a persistent session record not expired, the end user who previously logged in with their browser may encounter this PHP error message since the uid matching the current browser session can no longer load any user entity.
Added a new commit providing a hook_update to remove records in persistent_login table based upon deleted users before the fix of token delete is working.
Comment #11
g-brodieiSetting status to needs review, thanks!
Comment #12
g-brodieiAdded the missing `hook_user_delete` solution from @slowflyer to MR !13
Tested the records of deleted user's uid is gone in `persistent_login` table right after user deletion.
Comment #14
gappleThe double-hashing was fixed in 8.x-1.7 and 2.2.1
Cleaning up tokens for deleted users was fixed in 8.x-1.9 and 2.2.3