Opened 11 months ago
Last modified 9 months ago
#35328 assigned Cleanup/optimization
Improve CSRF Origin checking messaging
Reported by: | Ryan Hiebert | Owned by: | Ryan Hiebert |
---|---|---|---|
Component: | CSRF | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Carlton Gibson, tim-schilling | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | 18014 build:success | ||
Description ¶
A very common misconfiguration is for the
SECURE_PROXY_SSL_HEADER
setting to not be configured correctly. This causes the origin checks to fail, but the messaging leads folks like me to the CSRF_TRUSTED_ORIGINS
setting, which is not really what you want in this scenario. In some cases, like GitHub Codespaces, you may also need the USE_X_FORWARDED_HOST
setting as well.
I believe we can make some common scenarios easier to fix by improving our error messaging. Particularly in DEBUG
mode, we can show useful information about their headers and give a suggestion about what fix might be appropriate.
https://forum.djangoproject.com/t/forwarded-headers-csrf-hints/28616
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (9)
comment:1 by , 11 months ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | New feature → Cleanup/optimization |
comment:2 by , 11 months ago
Patch needs improvement: | set |
---|
comment:3 by , 11 months ago
Patch needs improvement: | unset |
---|
comment:4 by , 10 months ago
Owner: | changed from | to
---|
comment:5 by , 10 months ago
Patch needs improvement: | set |
---|
comment:6 by , 9 months ago
Patch needs improvement: | unset |
---|
comment:7 by , 9 months ago
Patch needs improvement: | set |
---|
comment:8 by , 9 months ago
Patch needs improvement: | unset |
---|
comment:9 by , 9 months ago
Patch needs improvement: | set |
---|
Accepting following the linked Forum discussion.