Hey,
maybe it’s controversial or I’m having a misunderstanding about SameSite Lax, but I’ll ask anyway:
With most browsers supporting SameSite Lax cookies, I was wondering if we still need the different CSRF protection mechanisms in Rails? With the new Rails 8 default to even block non-modern browsers it feels like there’s even less of a chance that old browsers are using a Rails app.
Not having to send all the CSRF tokens would simplify some things:
- Easier caching with etags
- Less automatically generated sessions generated by Rails (ActiveStorage recently introduced a
DisableSession
concern to skip session cookies to allow caching with CDNs more easily) - No
X-CSRF-Token
header needed in AJAX requests - Not having to worry about per form-tokens for BREACH mitigation
One downside on only relying SameSite lax would be that evil.example.com
would be able to execute requests against example.com
by default, which would not be the case today with CSRF tokens. Maybe this downside is bad enough to keep the protection mechanisms?
I’d be interested in other opinions about this topic