Opened 5 years ago
Last modified 5 years ago
#31635 closed New feature
SameSite cookie except on a URL — at Version 1
Reported by: | James Pic | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Currently, the SameSite cookie option can be enabled globally, which is great for a lot of use case.
If you have a form that's embedded via an iframe, which requires both session and csrf cookies to be sent on POST, then SameSite needs to be disabled.
The best would be to keep SameSite option on CSRF and Session cookies for the admin and the rest of the site, except for a particular set of views.
This is currently possible by adding a new middleware that will delete the samesite key on the response cookies, I suppose it's fine if that API is going to be supported on the long term, otherwise we should find a public API allowing Django projects to benefit from SameSite in views such as the Admin while having it disabled on other views, like with @xframe_options_exempt