Opened 9 years ago
Last modified 9 years ago
#25334 closed New feature
Check CSRF Referer against CSRF_TRUSTED_ORIGINS — at Initial Version
Reported by: | Joshua Kehn | Owned by: | Joshua Kehn |
---|---|---|---|
Component: | CSRF | Version: | dev |
Severity: | Normal | Keywords: | csrf |
Cc: | Carl Meyer | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
See previous discussion in #24496
Right now, if you try to share a CSRF token across a subdomain without
https, everything works great since the Referer header isn't validated.
But over https, we want to be a bit more strict and make sure that the
Referer is from another secure site, and also that the Referer matches
where we think it should be coming from. Django should validate that the
Referer header matches one of the domains listed in
CSRF_TRUSTED_ORIGINS
, including the currently responding
ALLOWED_HOST
.