-
Notifications
You must be signed in to change notification settings - Fork 348
Fix #251 Add disableTTLResetOnTouch option #264
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
Conversation
Appreciate you looking into this @nfadili, it appears this is functionally equivalent to the the |
I appreciate the quick eyes on this @wavded. There's a slight difference between the two options. I'll try my best to explain:
I believe that when |
Ahh thanks for the clarification @nfadili. My question now is should we make this default. In other words, is this a bug fix or breaking. It seems there is an argument for not disabling TTL on touch. In fact, our current TTL option seems to go along with the https://github.com/expressjs/session#rolling It appears if that is set, we should be updating the TTL in Redis, but if not, we shouldn't. Does that make sense to you? |
That makes sense! The current TTL option does seem to be 'rolling' by default. My intuition says this would likely want to be in sync with whatever My assumption when using this library was that it would not extend sessions. The All that being said, I am not very familiar with the problem space or codebases! So I would defer judgement to you and the other maintainers. Though I think we can agree that there is a valid need for some way to not extend sessions 😄 |
@wavded - I did look at the code a second time a few days ago and came up with the same assumption as you. As in it being equivalent to the the disableTTL option. Now I am reading over everything posted and catching up. |
At this point, my gut is to make a breaking change that conforms to the |
It's worth to note that the current default of As far as always calling In the original issue I reported, the session Regarding indefinite lifetime, it still remains an issue if you do want to roll sessions. With |
@alex996 - so this exactly what is stated here...#259 Seems like a major bug that has been lingering for quite some time. Connect-Redis vs Express-Session in regards to handling a .touch() callconnect-redis
express-session
|
@nfadili @wavded - yes, if express session is set to This comment stated by @iandvt got to me a few days ago, in regards to this issue...
This module has been nothing but good news to me, but a failed session means account security compromise, sensitive information potentially falling into the wrong hands. If anything would require a major version change, a security issue would be it. |
@knoxcard I believe the issue you linked could be easily circumvented with |
I like @alex996 suggestion of checking the cookie expire time on touch and keeping the TTL in sync with that. Whether it needs to have another flag do enable that... I can't think of any scenarios where a user wouldn't want their cookie and Redis TTL to be in sync, can any of you? @nfadili care to modify the PR to support? |
I've spent some time digging through the I hope this explanation makes sense ^^ I absolutely agree with @alex996's point on keeping them in sync, but it doesn't seem to be possible based on what |
@alex996 - in regards to my web platform, i've had |
@xapasnon - posted this in a different ticket, thoughts?
I.e. row 248 is: Should be: Bug? Feature? Misunderstood? |
I poked a little bit and here is what I am seeing. Per @nfadili comment, running the latest To me it seems like change needed is to ignore setting the expiration after initially saving if We already have an option that satisfies most of this, Ideally, we could get @dougwilson what do you think about that? |
@dougwilson - get a chance to look at @wavded's comment above? |
I have a PR for V4 which I believe will provide the required behavior here, instead of reinventing the wheel with how we handle TTL, we will directly depend on |
@wavded sounds great to me. Thank you for incorporating this in v4! I think the decision to offload responsibility to |
V4 has been released, see the readme for more details. But essentially the new |
@wavded I believe this is all that would be needed to fix the issue addressed in #251. I have tested it locally and it is behaving how I initially expected
express-session
to behave with this store.If I am understanding the purpose of the 'touch' function correctly,
connect-redis
might not need to implement 'touch' at all. But the flag i'm proposing in this PR leaves the code backwards compatible to its current behavior while also allowing the caller to specifically have it on or off.