#15617: CSRF referer checking too strict
-----------------------------------------+-------------------------
               Reporter:  adam           |        Owner:  lukeplant
                 Status:  assigned       |    Milestone:
              Component:  Uncategorized  |      Version:  1.3-beta
             Resolution:                 |     Keywords:
           Triage Stage:  Accepted       |    Has patch:  0
    Needs documentation:  0              |  Needs tests:  0
Patch needs improvement:  0              |
-----------------------------------------+-------------------------
Changes (by lukeplant):

 * status:  new => assigned
 * owner:  nobody => lukeplant
 * stage:  Unreviewed => Accepted


Comment:

 This is definitely a bug. However, the fix is not so simple, because we
 are using 'startswith' to check the referer, and with the proposed change,
 `https://example.com` could be matched by `https://example.com.evil.com`
 . That is almost certainly why I added that slash.

 The correct way to do with is to compare the (protocol, domain, port)
 triple, as specified here:
 http://www.w3.org/Security/wiki/Same_Origin_Policy

 We could do with a 'same_origin' utility function that is properly tested
 and implements the above check using urlparse, and then is used by the
 middleware.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15617#comment:2>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to