Skip to content
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

fix: prevent unparseable response cookie from causing request to fail [INS-4851] #8289

Conversation

ryan-willis
Copy link
Contributor

@ryan-willis ryan-willis commented Jan 10, 2025

In order to prevent malformed cookies from throwing application errors for otherwise successful requests, this PR changes to loose cookie parsing so that a set-cookie header sent as "=value" will be transformed into key: "", value: "value". We are choosing to retain RFC-compliant types so a missing key will be an empty string as opposed to null or undefined.

One caveat is: since the cookie is malformed, it will not be added to the cookie jar.

@ryan-willis ryan-willis force-pushed the fix/prevent-unparseable-cookie-exception-INS-4851 branch 2 times, most recently from 052b551 to e26165e Compare January 10, 2025 22:23
Copy link
Contributor

@jackkav jackkav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insomnia cookies have parsing logic pre-dating this feature which behave differently if i recall correctly, its worth checking for deviation this code may have introduced.

@ryan-willis ryan-willis force-pushed the fix/prevent-unparseable-cookie-exception-INS-4851 branch from e26165e to 85360ca Compare January 13, 2025 17:25
@ryan-willis ryan-willis force-pushed the fix/prevent-unparseable-cookie-exception-INS-4851 branch from 85360ca to addb331 Compare January 14, 2025 16:28
@ryan-willis ryan-willis merged commit 78a97f4 into Kong:develop Jan 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants