Skip to content

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

Merged
ryan-willis merged 2 commits intoKong:developfrom
ryanexus:fix/prevent-unparseable-cookie-exception-INS-4851
Jan 14, 2025
Merged

fix: prevent unparseable response cookie from causing request to fail [INS-4851]#8289
ryan-willis merged 2 commits intoKong:developfrom
ryanexus:fix/prevent-unparseable-cookie-exception-INS-4851

Conversation

@ryan-willis
Copy link
Copy Markdown
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
Copy Markdown
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
@ryan-willis ryan-willis deleted the fix/prevent-unparseable-cookie-exception-INS-4851 branch February 17, 2025 14:28
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