Skip to content

Conversation

robotdan
Copy link
Member

Fix cookie parsing to account for double-quoted values.

@voidmain
Copy link
Member

What happens if the string is mangled?

foo="bar
foo=bar"

Do we need to expand the states in the FSM to account for this and handle it gracefully? Or should the value contain the quote in these cases?

@robotdan
Copy link
Member Author

What happens if the string is mangled?

foo="bar foo=bar"

Do we need to expand the states in the FSM to account for this and handle it gracefully? Or should the value contain the quote in these cases?

I thought about that, but these are invalid values from what I can tell. With the current change, I would just strip them and and both of those would end up as foo=bar. So we would correct the invalid quoting.

But we could also ignore this cookie as well and throw it out if it is incorrectly quoted like that.

@robotdan
Copy link
Member Author

I added two more tests to assert the missing quote on opening or closing condition to at least assert the current behavior. Open to throwing the cookie out as well.

@voidmain
Copy link
Member

Works for me!

Copy link
Member

@voidmain voidmain left a comment

Choose a reason for hiding this comment

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

LTGM

@robotdan robotdan merged commit 0f8139d into master Mar 29, 2024
@robotdan robotdan deleted the degroff/parse-dquote-cookie-value branch March 29, 2024 23:34
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