-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
cookieOptions and config.toml config for cookie MaxAge are ignored #40
Comments
I'm pretty sure I know what's going on here. The ssr library is overwriting the There is a PR from a community member to get the default lowered to 365 or 400, but has not gotten any traction in the past. Nonetheless, there is also an issue of the ssr library overriding what devs are setting. I assume this is by design, but I'm unsure why. |
Is there any update when this issue might be handled? It's quite concerning that we can't set a shorter expiry time than 1 year for the access token. |
@j4w8n @encima Sorry to ping you, but it does seem like a meaningful security issue that the JWT doesn't expire for a year. |
@Rudolf-Dudarev I think the auth team has been pretty busy with some high-priority features, and I'm guessing they've had to triage other items like this one. Hopefully they will chime-in by early September, if not sooner; but I have no idea. |
Thanks @j4w8n for jumping in here. Here's more context around the fixed value and lack of configurability in the library We recently updated it to 400 days Main goal of the long time is to ensure Supabase Auth session expires before the max-age is reached, so as to guard against random logouts. |
Thanks for the reference @J0. I still think the team should consider leaving it up to the developer as to whether they want to set a lower limit than 400 days for the cookie age. |
Sorry to leave a "+1"comment here, but this is something I've just stumbled across as well and think it's essential that we allow From what I can see in the source code this is the only cookie option that is hardcoded, don't really understand the rationale for this |
Found a way to work arround this issue by extending the cookie options in the get() callback you can pass into createServerClient() "cookies" field.
|
Bug report
Describe the bug
The
supabase/ssr
methodcreateServerClient
ignorescookieOptions
propertymaxAge
. Not only that but theconfig.toml
propertyjwt_expiry
is also ignored when setting the auth cookie expiry. So we get cookies set withExpires / Max-Age
of about 1 year. I have a Next.js app where this is observed.To Reproduce
config.toml
, set thejwt_expiry
to a low value, e.g.,300
(5min)https://supabase.com/docs/guides/auth/server-side/creating-a-client
cokieOptions
object with themaxAge
property in the server client config object with a low value, e.g.,300.
.signInAnonymousley()
orsignInWithPassword()
on the server side.cookieOptions
or theconfig.toml
.I observed this issue in my supabase server client utility function:
Expected behavior
The set cookie has an expiry matching the
jwt_expiry
field inconfig.toml
or is overriden and matches themaxAge
property set in thecreateServerClient
configcookieOptions
.Screenshots
System information
Additional context
Using Next.js 14.
The text was updated successfully, but these errors were encountered: