1.1.4.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ==========================
  2. Django 1.1.4 release notes
  3. ==========================
  4. Welcome to Django 1.1.4!
  5. This is the fourth "bugfix" release in the Django 1.1 series,
  6. improving the stability and performance of the Django 1.1 codebase.
  7. With one exception, Django 1.1.4 maintains backwards compatibility
  8. with Django 1.1.3. It also contains a number of fixes and other
  9. improvements. Django 1.1.4 is a recommended upgrade for any
  10. development or deployment currently using or targeting Django 1.1.
  11. For full details on the new features, backwards incompatibilities, and
  12. deprecated features in the 1.1 branch, see the :doc:`/releases/1.1`.
  13. Backwards incompatible changes
  14. ==============================
  15. CSRF exception for AJAX requests
  16. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17. Django includes a CSRF-protection mechanism, which makes use of a
  18. token inserted into outgoing forms. Middleware then checks for the
  19. token's presence on form submission, and validates it.
  20. Prior to Django 1.2.5, our CSRF protection made an exception for AJAX
  21. requests, on the following basis:
  22. * Many AJAX toolkits add an X-Requested-With header when using
  23. XMLHttpRequest.
  24. * Browsers have strict same-origin policies regarding
  25. XMLHttpRequest.
  26. * In the context of a browser, the only way that a custom header
  27. of this nature can be added is with XMLHttpRequest.
  28. Therefore, for ease of use, we did not apply CSRF checks to requests
  29. that appeared to be AJAX on the basis of the X-Requested-With header.
  30. The Ruby on Rails web framework had a similar exemption.
  31. Recently, engineers at Google made members of the Ruby on Rails
  32. development team aware of a combination of browser plugins and
  33. redirects which can allow an attacker to provide custom HTTP headers
  34. on a request to any website. This can allow a forged request to appear
  35. to be an AJAX request, thereby defeating CSRF protection which trusts
  36. the same-origin nature of AJAX requests.
  37. Michael Koziarski of the Rails team brought this to our attention, and
  38. we were able to produce a proof-of-concept demonstrating the same
  39. vulnerability in Django's CSRF handling.
  40. To remedy this, Django will now apply full CSRF validation to all
  41. requests, regardless of apparent AJAX origin. This is technically
  42. backwards-incompatible, but the security risks have been judged to
  43. outweigh the compatibility concerns in this case.
  44. Additionally, Django will now accept the CSRF token in the custom HTTP
  45. header X-CSRFTOKEN, as well as in the form submission itself, for ease
  46. of use with popular JavaScript toolkits which allow insertion of
  47. custom headers into all AJAX requests.
  48. Please see the :ref:`CSRF docs for example jQuery code <csrf-ajax>`
  49. that demonstrates this technique, ensuring that you are looking at the
  50. documentation for your version of Django, as the exact code necessary
  51. is different for some older versions of Django.