Skip to content

Make session cookie SameSite configurable from global configuration - #260

Merged
dkmstr merged 1 commit into
v5.0from
v5.0-fix/session-samesite-config
Nov 23, 2026
Merged

dkmstr merged 1 commit into
v5.0from
v5.0-fix/session-samesite-config

Conversation

@dkmstr

@dkmstr dkmstr commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Add the Session cookie SameSite global setting (Security, default Strict, accepts Lax or Strict). A module installed from ready() overrides the SESSION_COOKIE_SAMESITE lookup so the value is read from the configuration at request time. The override is verified at startup and reverted to the Django default if it does not take effect.

Tests cover the default, values saved from the web, invalid values, the Set-Cookie attribute produced by SessionMiddleware, shadowed lookups and the revert path.

Add the Session cookie SameSite global setting (Security, default Strict,
accepts Lax or Strict). A module installed from ready() overrides the
SESSION_COOKIE_SAMESITE lookup so the value is read from the configuration
at request time. The override is verified at startup and reverted to the
Django default if it does not take effect.

Tests cover the default, values saved from the web, invalid values, the
Set-Cookie attribute produced by SessionMiddleware, shadowed lookups and
the revert path.
@dkmstr
dkmstr merged commit 0a1f729 into v5.0 Nov 23, 2026
2 checks passed
@aschumann-virtualcable
aschumann-virtualcable deleted the v5.0-fix/session-samesite-config branch November 24, 2026 02:53
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.

2 participants