-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement token-based sessions #4463
Conversation
ebdbfa9
to
6a098c0
Compare
5c4445b
to
fbe1cdb
Compare
6a098c0
to
45361dd
Compare
5da8238
to
f090002
Compare
|
1798576
to
9ff4fad
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.
Overall the implementation looks good to me.
I would like to review the DB queries we fire off during authentication. I tried loading a random settings screen with this PR and in the logs I counted:
4 SELECT requests from user_sessions
1 UPDATE to user_sessions
1 SELECT from users
I feel like we should be able to get by with
1 SELECT from user_sessions
JOIN users
1 UPDATE to user_sessions
defddfb
to
1b66868
Compare
@ukutaht I have revised session retrieval and modified logic so that session, user and last subscription are always fetched in a single query. I have also modified plug pipelines interacting with session to ensure they don't refetch the session or user unless necessary. By the way, I have noticed that our external API endpoints (/api/event included) have This limits the number of session related queries to minimum. When I open funnel settings, I can see 2 SELECTs of user session (one for dead view and one for live view, we can't get around that), and one UPDATE for user_session (via UserSessionTouch). All else is related to validating site access permission (user role, site membership etc.). If we want to address those, I'd opt for doing that in a separate PR. |
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.
Good work! Keeping legacy sessions alive is a really nice touch.
2e856a7
to
2eced93
Compare
2eced93
to
a023574
Compare
a023574
to
bbe81dc
Compare
Changes
Follow-up to #4452 implementing token-based sessions.
user_sessions
and used byAuth.UserSession
schemalast_used_at
andtimeout_at
timestampsUserSessionTouch
which also converts existing legacy sessions to new ones on the goCleanUserSessions
background job cleaning timed out sessions with an additional grace period of 7 days, just in case (sessions, when retrieved are always filtered by timeout, so that's not an issue)Ingestion.Event
pipeline. I have decided to not DRY these as they serve very different purposes.TODO
investigate and fix borked "remember 2fa" cookie mechanismfalse alarm, it's fineTests
Changelog
Documentation
Dark mode