-
Notifications
You must be signed in to change notification settings - Fork 299
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
[3.x] Ensure device has not been logged out #467
Conversation
Signed-off-by: Mior Muhammad Zaki <[email protected]>
This adds a middleware to check that the password has in session is the same as the current users password. This fixes a security issue where an attacker can keep sending requests to an API using the sanctum auth after the password has been changed. Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @crynobone
This solution will log out the current sanctum session, when the password is changed via a sanctum guarded request.
See below recording.
Screen.Recording.2023-08-23.at.11.16.43.mov
There are two reasons.
- The password hash isn't saved after it is changed like it is when using
AuthenticateSession
- Sanctum requests change default guard from
web
tosanctum
after the first check is done.
I have created a new branch on my test repo that uses this pr branch https://github.com/patrickomeara/sanctum-logout-issue/tree/crynobone-solution
Details below.
Co-authored-by: Patrick O'Meara <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @crynobone
Does this recent solution deal with changing the password in a sanctum request and leaving the sanctum session logged in?
Co-authored-by: Patrick O'Meara <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Fixed |
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Continue from #461