[ext/session] Validate session.cookie_samesite against allowed values#21647
Closed
jorgsowa wants to merge 1 commit intophp:masterfrom
Closed
[ext/session] Validate session.cookie_samesite against allowed values#21647jorgsowa wants to merge 1 commit intophp:masterfrom
jorgsowa wants to merge 1 commit intophp:masterfrom
Conversation
Add OnUpdateSessionSameSite() INI handler that enforces the SameSite whitelist (Strict, Lax, None, or empty string), rejecting any other value with E_WARNING. Previously OnUpdateSessionStr() accepted arbitrary strings including CRLF sequences, which were appended verbatim into the Set-Cookie header. The php_setcookie() function has a TODO comment for the same gap; this addresses it at the INI layer.
Member
|
Why close the PR? |
Contributor
Author
|
This is AI slop. I didn't check carefully the content before submitting PR. I want to do it properly. Sorry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OnUpdateSessionSameSite()INI handler that enforces the SameSite whitelist (Strict,Lax,None, or empty string)E_WARNINGand returnsFAILURE, preventing arbitrary strings (including CRLF sequences) from being appended verbatim into theSet-Cookieheaderphp_setcookie()inext/standard/head.chas a/* Should check value of SameSite? */TODO comment for the same gap — this addresses it at the INI layersession.cookie_pathandsession.cookie_domainalready have equivalent validation inphp_setcookie()at call time;session.cookie_partitionedis a boolean INI entry requiring no string validationTest plan
ext/session/tests/session_cookie_samesite_validation.phpt— verifies invalid and CRLF-containing values are rejected, and thatStrict/Lax/None/""are all accepted