Skip to content

fix(session): secure cookie defaults and session-fixation hardening#103

Merged
benkhalife merged 2 commits into
masterfrom
session-secure-cookie-defaults-and-session-fixation-hardening
Jun 16, 2026
Merged

fix(session): secure cookie defaults and session-fixation hardening#103
benkhalife merged 2 commits into
masterfrom
session-secure-cookie-defaults-and-session-fixation-hardening

Conversation

@benkhalife

Copy link
Copy Markdown
Member

Default session cookies to HttpOnly and SameSite=Lax, and set the Secure flag automatically when the request is over HTTPS. Validate the session ID and reject setting it after the session has started, and preserve cookie attributes when clearing the cookie on destroy.

Make setLifetime() warn and return false when called too late instead of failing silently, and fix has()/forget() to use array_key_exists so null-valued keys are detected and removable. Add optional bind() and verifyFingerprint() for User-Agent session binding.

BREAKING CHANGE: Session::setCookieParams() and Session::setLifetime() change signatures and now return values.

Default session cookies to HttpOnly and SameSite=Lax, and set the
Secure flag automatically when the request is over HTTPS. Validate the
session ID and reject setting it after the session has started, and
preserve cookie attributes when clearing the cookie on destroy.

Make setLifetime() warn and return false when called too late instead
of failing silently, and fix has()/forget() to use array_key_exists so
null-valued keys are detected and removable. Add optional bind() and
verifyFingerprint() for User-Agent session binding.

BREAKING CHANGE: Session::setCookieParams() and Session::setLifetime()
change signatures and now return values.
@benkhalife benkhalife linked an issue Jun 16, 2026 that may be closed by this pull request
@benkhalife
benkhalife merged commit 440e9b7 into master Jun 16, 2026
1 check passed
@benkhalife
benkhalife deleted the session-secure-cookie-defaults-and-session-fixation-hardening branch June 21, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session: secure cookie defaults and session-fixation hardening

1 participant