#24496: Check CSRF Referer against CSRF_TRUSTED_ORIGINS
------------------------------+------------------------------------
     Reporter:  mattrobenolt  |                    Owner:  joshkehn
         Type:  New feature   |                   Status:  assigned
    Component:  CSRF          |                  Version:  master
     Severity:  Normal        |               Resolution:
     Keywords:  csrf          |             Triage Stage:  Accepted
    Has patch:  1             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------

Comment (by carljm):

 Replying to [comment:19 joshkehn]:
 > I think the domain check complicates matters enough to warrant a
 separate fix. I've essentially repurposed this ticket to accommodate the
 `CSRF_TRUSTED_ORIGINS` additions so I'd suggest creating a new ticket.

 I think instead we should revert the changes to ticket title and
 description here, and open a new ticket for `CSRF_TRUSTED_ORIGINS`, since
 this ticket was originally about `CSRF_COOKIE_DOMAIN` and that's its
 history. Sorry I led you down the wrong path yesterday.

 > I don't know about the `get_host()` vs. `CSRF_COOKIE_DOMAIN` check.
 Let's say `CSRF_COOKIE_DOMAIN` is set to `.example.com` and
 `ALLOWED_HOSTS` is set to `['api.example.com', 'api-dev.example.com']`. To
 allow cross origin requests also set `CSRF_TRUSTED_ORIGINS` to
 `['dashboard.example.com']`.
 >
 > At this point Django would allow a request referred from
 `badhost.example.com`, since it's part of the `CSRF_TRUSTED_ORIGINS` +
 `CSRF_COOKIE_DOMAIN`. Is that acceptable?

 Yes, that's fine. `ALLOWED_HOSTS` is not relevant here. If
 `CSRF_COOKIE_DOMAIN` is set to `.example.com`, that's a declaration that
 all subdomains of `.example.com` are trusted to submit unsafe requests
 (well, they still have to pass the CSRF token check, but they're trusted
 enough to pass the referrer check).

--
Ticket URL: <https://code.djangoproject.com/ticket/24496#comment:20>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.6429c891deca63dcbfacd73cddf7fd2c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to