-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Setting cookie with Max-Age > 400 days throws #2762
Comments
can you tell me details of error? |
Thanks @hmnd . |
I ready just now @hmnd |
Is there any good in being able to set max-age to more than 400 days? Chrome will automatically change the max-age to 400 days if it exceeds 400 days. The restriction was added in the following PR: #2314 |
@ryuapp I think the more important question is, is there any benefit to throwing when a max age > 400 is set? If you review my earlier comments, you can see this has caused me grief trying to use Hono with Supabase Auth: https://github.com/supabase/auth-helpers/issues/441#issuecomment-2046645189 |
hi @ryuapp . |
Thank you for your comment. Of course, I agree that it's tiresome because of the restrictions. |
@ryuapp @EdamAme-x I'm not doing anything special, just using I don't understand how that's relevant to the issue at hand, though. The question is whether Hono should be interfering with the cookies that users set. IMO Hono should not be interfering here, as it breaks usage of similar packages that set a max-age that the user cannot modify. As I previously mentioned, the RFC is also only relevant to user agents, not web servers. Is there a good reason for Hono to be doing this? |
The only solution seems to be to remove the limits or add an option. |
I think we should only apply the limits in the user agent |
Hi @hmnd Thanks for the issue.
|
Yes it mentions "User Agent" but Max-Age is a attribute for Why don't you file a bug not to hono but to the implementation which ignores RFC? |
I looked at default settings of famous auth libraries such as Auth.js, and found that cookie's max-age was set to 7 days, 30 days, 1 year, etc. |
What version of Hono are you using?
4.3.9
What runtime/platform is your app running on?
Cloudflare Workers
What steps can reproduce the bug?
Set cookie with Max-Age > 400 days.
What is the expected behavior?
Cookie is set without throwing an error.
What do you see instead?
An error is thrown.
Additional information
This has caused an issue with supabase's auth library and could affect similar usage of cookies in other libs/projects.
Given the RFC is targeted primarily at User Agents (The user agent MUST limit the maximum value of the Max-Age attribute), I don't believe it's wise to force this onto users of Hono.
The text was updated successfully, but these errors were encountered: