-
Notifications
You must be signed in to change notification settings - Fork 210
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: bad interaction between session state changes and renewal #265
Conversation
31e5e25
to
277d5bb
Compare
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.
Thanks for working on this!
For the sake of readers like me who haven't really looked into the problem, is there a comment that can be left on these conditionals explaining the behavior? Not obvious at first glance (to me) what this solves. |
That's a simple explanation for the issue from poem-web/poem#196 and that issue happens in
|
Ok, got it. So, if I understand correctly, this won't break the other way because a renewed session will reassign the cookie with the changed state as well. If that's the case, it almost feels like the enum states don't quite capture the model. I.e., "changed" and "renewed" not being mutually exclusive is should make the state more like setting independent boolean flags than an enum? But that's a later problem. We'll get this PR shipped. Excuse if I have any of this wrong, I'm not actually a user of this crate myself (yet). |
Nope, Enums is working well and I think I resolved the issue that is happening. @LukeMathWalker Can you give us your opinion? |
I think @robjtede's intuition is correct - renewing the session id and changes to the session state are independent and should be tracked separately. |
So is there anything I should do more or is everything just fine? |
My concern is that this might break it the other way; storage implementations handle independently a change in session content and session lifespan? It would not affect cookie storage but in Redis storage it would be the different... eg:
^
I'm less sure about things as I'm making edits. |
Here's what I want to know:
Answering "yes" to 1. will allow this PR to be merged. Understanding 2. will be helpful for opening an issue to move us toward that ideal representation that I suspect will reduce the number of non-obvious nested ifs necessary in this logic. |
I think yes because that is the way how
Honestly, I'm don't familiar with
and I don't know what the ideal representation. |
This should not introduce new bugs, as far as my understanding goes. The middleware instructs the backend to perform a delete on the data associated with the old session key and a save of the current session state against the new key (see actix-extras/actix-session/src/middleware.rs Line 275 in cfd16c5
|
PR Type
Bug Fix
PR Checklist
cargo +nightly fmt
).Overview
Closes #244