-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
issue#348. Fixed CSRF tokens not sessioned when using scope and memory_sessions #349
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1583,15 +1583,15 @@ val invalidate_session : request -> unit promise | |
|
||
(** {2 Back ends} *) | ||
|
||
val memory_sessions : ?lifetime:float -> middleware | ||
val memory_sessions : middleware | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happened to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was forced to eliminate it for saving existing way of usage session middlewares. In other way every usage of session middleware would look like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this parameter has to be kept, and, in light of the other comment, can be kept. |
||
(** Stores sessions in server memory. Passes session IDs to clients in cookies. | ||
Session data is lost when the server process exits. *) | ||
|
||
val cookie_sessions : ?lifetime:float -> middleware | ||
val cookie_sessions : middleware | ||
(** Stores sessions in encrypted cookies. Use {!Dream.set_secret} to be able to | ||
decrypt cookies from previous server runs. *) | ||
|
||
val sql_sessions : ?lifetime:float -> middleware | ||
val sql_sessions : middleware | ||
(** Stores sessions in an SQL database. Passes session IDs to clients in | ||
cookies. Must be used under {!Dream.sql_pool}. Expects a table | ||
|
||
|
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.
At first glance, this looks like whatever is delayed by the extra
unit
parameter, will be triggered once per process, rather than once per server (or once perscope
). With this change, can there be two concurrent uses of two differentmemory_session
middlewares in one process?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 your questions. Right after you answered them, I realised that my solution is wrong.
No, there can't be.
I suppose that, a correct fix is to change the way how we use session middlewares. I mean like this
Dream.memory_sessions ()
. But in this case we would need to change examples and documentation. I haven't dare to make such global changes without discussion.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.
Could you give some consideration to whether there is an alterative way to fix this without complicating usage in this way? And if not, then it's fine to add a
()
parameter to the session middlewares. Thank you!