== **What are Fetch Metadata Request Headers?**
Fetch metadata request headers are a relatively new security feature used
to protect against cross-origin request attacks like CSRF. Browsers that
support them provide request origin information to the web server inside
headers with every request. This information includes what site is making
the request, the mode or type of the request, and the destination of the
request. The information provided in the fetch metadata request headers
can be used to create a resource isolation policy that protects web
application users from cross-origin attacks.
== **Proposed Changes to Django**
New checks should be added to the CSRF middleware. Currently the
middleware will check the referer header as one method of determining
request validity. When the fetch metadata request headers are set, these
should be used for resource isolation checks instead. Otherwise, the
policy will fallback on validating with the referer header.
If the fetch metadata headers are set, this resource isolation policy is
followed:
Same-site and browser-initiated requests are allowed
Top level navigation (HTTP GET) is allowed
Developer defined endpoints that are meant to serve cross-site traffic are
allowed
Reject all other requests
After this policy is followed CSRF processing will continue as normal.
**Please provide me some feedback on this implementation plan and let me
know if you would like to see this new security feature in Django.**
--
Ticket URL: <https://code.djangoproject.com/ticket/31823>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => meggles711
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31823#comment:1>
* stage: Unreviewed => Someday/Maybe
Comment:
Fetch metadata request headers are still on an [https://w3c.github.io
/webappsec-fetch-metadata/#sec-fetch-site-header early and experimental
stage] and may change at any moment. Moreover browsers don't support them
(e.g. Firefox and Safari). We can reconsider this ticket when the
specification becomes more mature and stable.
--
Ticket URL: <https://code.djangoproject.com/ticket/31823#comment:2>