Skip to content

fix(security): add SameSite attribute to CSRF cookie#2035

Merged
bpamiri merged 1 commit intodevelopfrom
peter/fix-csrf-cookie-samesite
Apr 9, 2026
Merged

fix(security): add SameSite attribute to CSRF cookie#2035
bpamiri merged 1 commit intodevelopfrom
peter/fix-csrf-cookie-samesite

Conversation

@bpamiri
Copy link
Copy Markdown
Collaborator

@bpamiri bpamiri commented Apr 9, 2026

Summary

  • Adds SameSite=Lax attribute to the CSRF protection cookie, preventing cross-site POST requests
  • New csrfCookieSameSite setting (default: "Lax") — configurable, set to empty string to omit
  • Tests verify the attribute is included/omitted based on configuration

Test plan

  • Verify SecurityDefaultsSpec passes on Lucee 6 + SQLite
  • Verify CSRF cookie includes SameSite=Lax in browser dev tools
  • Verify setting csrfCookieSameSite = "" omits the attribute

🤖 Generated with Claude Code

The CSRF protection cookie was missing the SameSite attribute, leaving
applications more vulnerable to cross-site request forgery. Default to
"Lax" which prevents cross-site POST requests while allowing normal
navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bpamiri bpamiri merged commit 01a61ac into develop Apr 9, 2026
2 of 3 checks passed
@bpamiri bpamiri deleted the peter/fix-csrf-cookie-samesite branch April 9, 2026 08:37
@bpamiri bpamiri mentioned this pull request Apr 16, 2026
7 tasks
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.

1 participant