Skip to content

ext/session: secure session configuration defaults (RFC)#21938

Merged
Girgias merged 4 commits into
php:masterfrom
jorgsowa:session-security-defaults-rfc
May 19, 2026
Merged

ext/session: secure session configuration defaults (RFC)#21938
Girgias merged 4 commits into
php:masterfrom
jorgsowa:session-security-defaults-rfc

Conversation

@jorgsowa
Copy link
Copy Markdown
Contributor

@jorgsowa jorgsowa commented May 3, 2026

Implements the "Secure Session Configuration Defaults" RFC by changing three INI defaults to provide secure session behavior out of the box:

  • session.use_strict_mode: 0 -> 1
  • session.cookie_httponly: 0 -> 1
  • session.cookie_samesite: "" -> "Lax"

RFC: https://wiki.php.net/rfc/session_security_defaults

@jorgsowa jorgsowa force-pushed the session-security-defaults-rfc branch from f1e14f9 to 8e76687 Compare May 17, 2026 15:40
@jorgsowa jorgsowa marked this pull request as ready for review May 17, 2026 18:14
@jorgsowa jorgsowa requested a review from Girgias as a code owner May 17, 2026 18:14
Copy link
Copy Markdown
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Merge conflict but LGTM, thank you!

jorgsowa added 3 commits May 18, 2026 21:54
Implements the "Secure Session Configuration Defaults" RFC by changing
three INI defaults to provide secure session behavior out of the box:

- session.use_strict_mode: 0 -> 1 (mitigates session fixation)
- session.cookie_httponly: 0 -> 1 (mitigates XSS access to session cookie)
- session.cookie_samesite: "" -> "Lax" (mitigates CSRF)

RFC: https://wiki.php.net/rfc/session_security_defaults
@jorgsowa jorgsowa force-pushed the session-security-defaults-rfc branch from 02424cb to 23ebec1 Compare May 18, 2026 19:54
@jorgsowa
Copy link
Copy Markdown
Contributor Author

All new defaults have been accepted in RFC: https://wiki.php.net/rfc/session_security_defaults

PR is ready to be merged after all tests pass.

@Girgias Girgias merged commit 27ead91 into php:master May 19, 2026
19 checks passed
Comment thread php.ini-development
; enabling it is encouraged.
; vulnerability.
; https://wiki.php.net/rfc/strict_sessions
session.use_strict_mode = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This entry should probably also be commented out, since it matches the default. Same for the others. Might make sense to do this change as a follow-up.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants