-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Cookie Expiration Age Fix #7327
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you for the contribution! Looks good to me so far. We will have to add it to src/node/cli.ts
as well.
The .
syntax is intriguing, but I want to say we call it auth-cookie-max-age
for now.
@@ -326,6 +335,7 @@ export const getCookieOptions = (req: express.Request): express.CookieOptions => | |||
domain: getCookieDomain(url.host, req.args["proxy-domain"]), | |||
path: normalize(url.pathname) || "/", | |||
sameSite: "lax", | |||
maxAge: getConfigCookieMaxAgeAsMilliseconds(req) || 0, |
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.
Oh wait is 0
the right default? This will delete the cookie instantly, I think? We may want -1
.
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.
Hmm actually zero or negative immediately expires the cookie it seems.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie#max-agenumber
https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.2
Should it just be undefined? Also we may want ??
instead of ||
in case someone does explicitly set it to zero for some reason.
Fixes #7301