[php-src] PR #21647: [ext/session] Validate session.cookie_samesite against allowed values
| From: | jorgsowa | Date: | Mon, 06 Apr 2026 07:11:26 +0000 |
| Subject: | [php-src] PR #21647: [ext/session] Validate session.cookie_samesite against allowed values | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35566@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21647
Author: jorgsowa
## Summary
- Adds
OnUpdateSessionSameSite() INI handler that enforces the SameSite whitelist
(Strict, Lax, None, or empty string)
- Rejects any other value with E_WARNING and returns FAILURE, preventing
arbitrary strings (including CRLF sequences) from being appended verbatim into the
Set-Cookie header
- php_setcookie() in ext/standard/head.c has a /* Should check value
of SameSite? */ TODO comment for the same gap — this addresses it at the INI layer
- session.cookie_path and session.cookie_domain already have equivalent
validation in php_setcookie() at call time; session.cookie_partitioned is
a boolean INI entry requiring no string validation
## Test plan
- [ ] ext/session/tests/session_cookie_samesite_validation.phpt — verifies invalid
and CRLF-containing values are rejected, and that
Strict/Lax/None/"" are all accepted