-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
SameSite cookie attribute does not work; suggest to remove it #25344
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
Comments
Or just |
I'm not sure how Symfony typically handles cases like this, but if people enabled usage of SameSite thinking it will give them better protection against CSRF attacks, which is what SameSite is meant for, then it better be a serious error and not |
See #25348, we have everything in core already to fix it now. |
…ite" ones (nicolas-grekas, cvilleger) This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Send cookies using header() to fix "SameSite" ones | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25344 | License | MIT | Doc PR | - Commits ------- 73fec23 [HttpFoundation] Add functional tests for Response::sendHeaders() e350ea0 [HttpFoundation] Send cookies using header() to fix "SameSite" ones
In #19104 support was added for the SameSite attribute in cookies. However, a pretty big oversight is that this parameter is never passed to PHP's
setcookie()
in http-foundation/Response.php. You can't even if you'd want to, because PHP will only support SameSite in 7.3 see https://wiki.php.net/rfc/same-site-cookieI'm not sure why SameSite was already added to Symfony if PHP doesn't support it yet, but this is quite misleading. I spent several hours debugging my Laravel app trying to figure out why SameSite wasn't sent, and eventually I found out that Symfony never passes it to PHP, because PHP doesn't accept the option yet.
Until PHP 7.3 is released and assuming the RFC I linked to is implemented, I suggest to remove the SameSite property from Symfony since right now it doesn't do anything and is plainly misleading.
The text was updated successfully, but these errors were encountered: