-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cookies inside endpoints called from event.fetch
are not correctly set
#9901
Comments
I have this fixed locally -- just having to think through the ramifications. I'll try to get a PR open tomorrow. |
Contributor
Here's a draft PR: #9908 I'm not sure if it'll actually get merged (I have a couple of concerns about the implementation that I'm discussing with Rich), but it at least identifies and documents the issue. |
5 tasks
dummdidumm
pushed a commit
that referenced
this issue
May 12, 2023
Closes #9901 Bypasses setting Kit defaults on cookies parsed from fetch response headers. To illustrate what the problem was: - Set a cookie in +server.ts: cookies.set('foo', 'bar', { httpOnly: false }) - fetch this endpoint from +page.server.ts - As part of fetch, parse the cookies from the headers - httpOnly isn't set (because false === unset) - Adding this cookie to the cookies causes the default httpOnly: true to be added The better solution here is not to apply defaults to cookies we parse from fetch response headers. If these cookies were set through cookies.set in a +server.ts endpoint, we've already set the defaults, and if they're not, we shouldn't touch them anyway.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When calling an endpoint from
event.fetch
that sets a cookie withhttpOnly: false
the actual response sets the cookie withhttpOnly: true
Reproduction
https://github.com/david-plugge-reproductions/sveltekit-fetch-httponly-cookie
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: