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

Cookie parsing strictness #5

Open
kelunik opened this issue Jan 3, 2019 · 4 comments
Open

Cookie parsing strictness #5

kelunik opened this issue Jan 3, 2019 · 4 comments

Comments

@kelunik
Copy link
Member

kelunik commented Jan 3, 2019

Currently we're pretty strict about cookie parsing and return an empty cookie array if any cookie contains invalid data. Maybe we should change this, but it might result in security issues depending on the cookie.

@bwoebi
Copy link
Member

bwoebi commented Jan 14, 2019

Is there any real gain from this? Does it expose any real world issues?

@kelunik
Copy link
Member Author

kelunik commented Jan 14, 2019

I hit this issue because some cookies from another application where present on localhost, probably not that important on deployed applications.

@SUN5H1N3
Copy link

SUN5H1N3 commented Sep 1, 2022

Is there any real gain from this? Does it expose any real world issues?

I ran into a problem that one of the sites was returning a cookie with a value containing spaces. As a result, this cookie was ignored and I received information on the site that was not what I wanted. If I add $value = urlencode($value) before preg_match(..., $value) to Amp\Http\Cookie::_construct() then the behavior becomes normal.

@NoNamePaul94
Copy link

NoNamePaul94 commented Oct 7, 2024

This actually became a real world issue for us today.
We started using JENTIS for tracking an they actually put valid json in their cookie without encoding it:
image
(The redacted content are just numbers)

Since we don't really have control over this cookie but we still recieve the request with it in it, our application just breaks.
Maybe add a json verification as an alternative to the regex or at least keep the valid cookies? (Also as mentioned above, I cannot fully grasp possible security implications)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants