-
-
Notifications
You must be signed in to change notification settings - Fork 987
Use 'req.sessionStore' instead of directly using 'store' object. #643
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
base: master
Are you sure you want to change the base?
Conversation
…is gives flexibity to inject addition parameters like 'req' to store.get and store.destroy (via proxy) without changing the interface of 'Store'
Hmmm, I like where you're going with this and I have a solution as well. Memory/CPU Security? |
First, notice how the global variable app is utilized to "carry" objects throughout the entire codebase.
Next Now we can
|
Thanks for looking into this. A
Please note that this is a modified interface and changing
The JS Proxy looks like following:
|
@knoxcard, Please let me known if there are any specific concerns you want me to address to help merge this PR. As I have stated, our goal is to be able to access |
@sumeetkakkar - I am not a project contributor or owner to this repo. Your best bet is having @dougwilson review this. |
Can you look at #712 and confirm if that will accomplish the same thing as here? It is further along and seems much more flexible, including keeping our internals internal and less at risk for user overrides causing hard to debug issues. |
👍 |
@dougwilson , Can you please share ETA for #712? |
We are working though everything, just there is a large backlog. Part of resolving that is resolving the difference between these two PRs, which is why I messaged on here. Were you able to take a look at the changes in #712 ? Do you believe they will accomplish the same thing has this pull request? |
9d2e29b
to
408229e
Compare
Description
Use
req.sessionStore
instead of directly usingstore
object. This gives flexibility to inject additional parameters likereq
tostore.get
andstore.destroy
via custom traps using JavaScript Proxy without changing the interface of theStore
.Motivation and Context
We want to pass
req
object down to the methods of ourStore
implementation.store.set
method can access it fromsession.req
but it is not available instore.get
andstore.destroy
methods.One workaround we found is to leverage setter of
req.sessionStore
to create JavaScript Proxy of thestore
object. This proxy has traps forstore.get
andstore.set
and it adds thereq
object as a parameter to the function call.To make this work we need changes in this module to use
req.sessionStore.get
andreq.sessionStore.destroy
methods so that the proxy object is used.