mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed is_safe_url() to handle leading whitespace.
This is a security fix. Disclosure following shortly.
This commit is contained in:
@@ -31,6 +31,20 @@ development server now does the same. Django's development server is not
|
||||
recommended for production use, but matching the behavior of common production
|
||||
servers reduces the surface area for behavior changes during deployment.
|
||||
|
||||
Mitigated possible XSS attack via user-supplied redirect URLs
|
||||
=============================================================
|
||||
|
||||
Django relies on user input in some cases (e.g.
|
||||
:func:`django.contrib.auth.views.login` and :doc:`i18n </topics/i18n/index>`)
|
||||
to redirect the user to an "on success" URL. The security checks for these
|
||||
redirects (namely ``django.util.http.is_safe_url()``) didn't strip leading
|
||||
whitespace on the tested URL and as such considered URLs like
|
||||
``\njavascript:...`` safe. If a developer relied on ``is_safe_url()`` to
|
||||
provide safe redirect targets and put such a URL into a link, they could suffer
|
||||
from a XSS attack. This bug doesn't affect Django currently, since we only put
|
||||
this URL into the ``Location`` response header and browsers seem to ignore
|
||||
JavaScript there.
|
||||
|
||||
Bugfixes
|
||||
========
|
||||
|
||||
|
||||
@@ -29,3 +29,17 @@ containing underscores from incoming requests by default. Django's built-in
|
||||
development server now does the same. Django's development server is not
|
||||
recommended for production use, but matching the behavior of common production
|
||||
servers reduces the surface area for behavior changes during deployment.
|
||||
|
||||
Mitigated possible XSS attack via user-supplied redirect URLs
|
||||
=============================================================
|
||||
|
||||
Django relies on user input in some cases (e.g.
|
||||
:func:`django.contrib.auth.views.login` and :doc:`i18n </topics/i18n/index>`)
|
||||
to redirect the user to an "on success" URL. The security checks for these
|
||||
redirects (namely ``django.util.http.is_safe_url()``) didn't strip leading
|
||||
whitespace on the tested URL and as such considered URLs like
|
||||
``\njavascript:...`` safe. If a developer relied on ``is_safe_url()`` to
|
||||
provide safe redirect targets and put such a URL into a link, they could suffer
|
||||
from a XSS attack. This bug doesn't affect Django currently, since we only put
|
||||
this URL into the ``Location`` response header and browsers seem to ignore
|
||||
JavaScript there.
|
||||
|
||||
@@ -30,6 +30,20 @@ development server now does the same. Django's development server is not
|
||||
recommended for production use, but matching the behavior of common production
|
||||
servers reduces the surface area for behavior changes during deployment.
|
||||
|
||||
Mitigated possible XSS attack via user-supplied redirect URLs
|
||||
=============================================================
|
||||
|
||||
Django relies on user input in some cases (e.g.
|
||||
:func:`django.contrib.auth.views.login` and :doc:`i18n </topics/i18n/index>`)
|
||||
to redirect the user to an "on success" URL. The security checks for these
|
||||
redirects (namely ``django.util.http.is_safe_url()``) didn't strip leading
|
||||
whitespace on the tested URL and as such considered URLs like
|
||||
``\njavascript:...`` safe. If a developer relied on ``is_safe_url()`` to
|
||||
provide safe redirect targets and put such a URL into a link, they could suffer
|
||||
from a XSS attack. This bug doesn't affect Django currently, since we only put
|
||||
this URL into the ``Location`` response header and browsers seem to ignore
|
||||
JavaScript there.
|
||||
|
||||
Bugfixes
|
||||
========
|
||||
|
||||
|
||||
Reference in New Issue
Block a user