-
Notifications
You must be signed in to change notification settings - Fork 90
[ATL-763] [LUM-1951] fix(ios): set max-age on session cookie so it survives cold reopen #32529
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
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 |
|---|---|---|
|
|
@@ -180,7 +180,10 @@ export async function waitForNativeSessionCookie(): Promise<void> { | |
| * same code works across environments without runtime host sniffing. | ||
| */ | ||
| export function installSessionCookies(sessionToken: string): void { | ||
| const cookieAttrs = "path=/; domain=.vellum.ai; secure; samesite=lax"; | ||
| // `max-age` makes the cookie persistent. If unspecified, the cookie | ||
| // expires at the end of the session, and users will be required to | ||
| // login again. | ||
| const cookieAttrs = "path=/; domain=.vellum.ai; secure; samesite=lax; max-age=1209600"; | ||
|
Collaborator
Author
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 don't like that we're manually reinstalling cookies. Why not just use As is, this requires us to keep all of these attributes in sync with the actual cookie, but we're not doing properly right now:
Collaborator
Author
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. cc @noanflaherty in case this has implications for electron |
||
| document.cookie = `sessionid=${sessionToken}; ${cookieAttrs}`; | ||
| document.cookie = `__Secure-sessionid=${sessionToken}; ${cookieAttrs}`; | ||
|
Comment on lines
187
to
188
Collaborator
Author
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. We should only set one of these cookies, not both. Public SPA is served over HTTPS and should use the |
||
| } | ||
|
|
||
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.
This makes the JS-installed native session cookie survive cold restarts, but the web logout path only calls
allauthLogout()best-effort and then clears local state infinally(apps/web/src/stores/auth-store.ts:243-251), even if the DELETE fails/returns non-ok and therefore no serverSet-Cookieexpiry is applied. In that offline/server-error scenario an iOS user appears signed out and is redirected to login, but after reopening the app the now-persistent valid cookie logs them back in; either explicitly expire these cookie names during logout cleanup or avoid persisting them without a matching client-side clear path.Useful? React with 👍 / 👎.
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.
minor edge case that I'm not gonna address here