#33529: Possibly Incorrect statement in the docs about CRSF tokens ------------------------------+-------------------------------------- Reporter: Michael | Owner: nobody Type: Bug | Status: closed Component: contrib.auth | Version: 4.0 Severity: Normal | Resolution: invalid Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------------+--------------------------------------
Comment (by Florian Apolloner): > I am guessing the new behaviour is if the CSRF Middleware receives a request that has the X-CSRFToken header, and a csrftoken key in the POST data, it will prefer the POST data? Yes it will prefer POST data but I do not think this is new. > Maybe a note about how the CSRF Middleware verifies the token when : X-CSRFToken header *and* the POST csrftoken entry are *both* provided. This is a common scenario if one logs out and in another tab, and uses JavaScript Ajax calls that can add both This should not happen imo. Normal forms always use the token in the form. Ajax should use one or the other but not both. `X-CSRFToken` is mostly there if you are posting JSON and not submitting a normal form via Ajax. Btw with at least the Django dev version, we verify the origin as well in which case the tokens are not used at all :) -- Ticket URL: <https://code.djangoproject.com/ticket/33529#comment:8> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.7482e33bf8f3bf9994645a9d62b07278%40djangoproject.com.