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

FIX Revoke a single session #59

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Apr 13, 2021

Copy link

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging out from one session invalidates my "Remember" me token in other browsers. Feel like this should be addressed by this PR

https://youtu.be/GoxWA0EoCtA

@emteknetnz emteknetnz force-pushed the pulls/1/revoke-one branch 6 times, most recently from adeb0f3 to 43c5ced Compare April 14, 2021 04:49
@emteknetnz
Copy link
Member Author

@maxime-rainville Have updated so that RememberLoginHash's for unrevoked sessions are untouched

@maxime-rainville maxime-rainville self-requested a review April 14, 2021 05:26
Copy link

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following silverstripe/silverstripe-framework#9794, we decided that logout_across_devices would default to false when you install session manager.

My thinking is this:

  • The vanilla install should keep the current default behaviour even if we don't think it's the best one in most cases. You need to set $logout_across_devices to false if you want the better log out behaviour.
  • Session manager should implicitly set $logout_across_devices to false. If you logout, only the "Remember Me" token for the current session will be invalidated.
  • Irrespective of what value is set for $logout_across_devices, when you use session manager to terminate a specific session, any "remember me" token associated to that session must be invalidated.

This seems like the sensible place to implement this change.

src/Middleware/LoginSessionMiddleware.php Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
src/Security/LogOutAuthenticationHandler.php Show resolved Hide resolved
@maxime-rainville maxime-rainville self-requested a review April 19, 2021 21:40
Copy link

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally and it works great.

The only thing that's missing is adding a bit of YML config so logout_across_devices defaults to false

@@ -5,5 +5,7 @@ import:

env:
global:
# require at minimum recipe 4.7 so that redux based toast notification are available
- REQUIRE_RECIPE="4.7.x-dev || "
- REQUIRE_RECIPE="4.x-dev"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still trying to test 4.7, 4.6 and 4.5 releases. That's preventing the builds from being 🟢

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried changing this to use a different provision

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New provision worked, travis green

@emteknetnz
Copy link
Member Author

The only thing that's missing is adding a bit of YML config so logout_across_devices defaults to false

Do we do that here? It's not an AC on the issue.

This pull-request works with logout_across_devices true or false - the decision to change the default of logout_across_devices to false made total sense as an outcome of the investigation, and it's what this pull-request does though on a temporary basis.

I'm just wondering if we need to reevaluate whether we even need to change the default value? Either way, should probably happen on a seperate PR since it's not an AC here?

@maxime-rainville
Copy link

maxime-rainville commented Apr 20, 2021

It was a pretty clear conclusion from silverstripe/silverstripe-framework#9794 (comment)

Yes, we should have defined an AC for it. But if no one is arguing that this shouldn't happen is there much point spinning up a separate issue to manage the addition of 3 lines of YML?

@emteknetnz
Copy link
Member Author

OK rereading the previous investigation it makes a bit more sense. Partially to help clarify my own understanding, I've spun up a new issue and brought into sprint (needs to happen) #65 - could you check that it's correct? PR for it should probably only take a few minutes.

@maxime-rainville
Copy link

#65 looks good. Just make sure your YML section is named so people can use the #after statement to override it

@emteknetnz
Copy link
Member Author

Great ta will do. This PR should be good to merge now. I'll sort the YML PR now.

Copy link

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the point of splitting this up in a separate issue. But otherwise it looks good.

@emteknetnz emteknetnz merged commit c2c165e into silverstripe:1 Apr 21, 2021
@emteknetnz emteknetnz deleted the pulls/1/revoke-one branch April 21, 2021 02:42
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.

2 participants