-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Session improvements: re-keying, signing, laziness, GC, etc. #13
Comments
I was surprised to see Dream storing empty sessions. I thought it was probably just a low-priority TODO, but there's a "Lazy sessions" item here, with a stricken section that (I think?) implies that there's some value in persisting empty sessions? Can you clarify what's going on there? |
I wasn't able to come to a decision in the summer about whether the existence of the session is itself important, even if the session is empty. So I chose for now that if a request passes through the session middleware, it always gets a session, even if nothing is stored in it. This allows, at least, recognizing subsequent requests as belonging to the same session. I'm very open to discussing whether this is right or not. |
Seems there are two (IMO) good reasons not to create sessions until they're necessary:
|
Indeed, I completely agree, and now I recall that I was considering these issues as well. And the "Lazy sessions" bullet point is still open, to be addressed. That part of it is stricken is confusing. It is confusing even me at this point, as a reader of this issue months later :P But your comment serves as a good clarification, thank you!
This whole issue is fairly high-priority. However, I'm personally currently working out details and quirks of Dream I/O streams and a Dream client, so I have to delay looking at sessions in detail again until I've taken care of those two things. |
Add documentation on the main module
There is no need to persist state for a pre-session that hasn't had any data associated with it, except to reserve the key. Is that important? This can be addressed by making the session key getter evaluate to a promise. However, that would infect the CSRF generator, template helper, etc. It may be better for it to always return a promise, since then one could implement reads by always reading from persistent storage. However, at that point, someone may want a custom session manager, anyway. There is no need for duplicate checking, as a ~144-bit session ID collision, assuming a good RNG, is not worth protecting against, even for a service with billions of monthly visits, assuming each one generates a fresh session, and all the sessions are concurrent. A service with stricter requirements still, should be easily able to implement a checking session id generator.session_key
tosession_id
, because ID is the common term for it, and the term key collides with usage in cryptographic key, for example keys in TLS. OTOH the session key is generated in about the same way, using a CSRNG, so maybe this is fine. NIST uses session secret, but session identifier remains in one place.Is it safe to just print the session ID to logs?No. OWASP recommends against this. Dream already implements a separate log-safe identifier, which should probably become a hash so that there is at least a 1-way correlation.`Info
.The text was updated successfully, but these errors were encountered: