Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
69b5e667
Kaydet (Commit)
69b5e667
authored
Ara 03, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed is_safe_url() to handle leading whitespace.
This is a security fix. Disclosure following shortly.
üst
316b8d49
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
1 deletion
+45
-1
http.py
django/utils/http.py
+1
-0
1.4.18.txt
docs/releases/1.4.18.txt
+14
-0
1.6.10.txt
docs/releases/1.6.10.txt
+14
-0
1.7.3.txt
docs/releases/1.7.3.txt
+14
-0
test_http.py
tests/utils_tests/test_http.py
+2
-1
No files found.
django/utils/http.py
Dosyayı görüntüle @
69b5e667
...
@@ -267,6 +267,7 @@ def is_safe_url(url, host=None):
...
@@ -267,6 +267,7 @@ def is_safe_url(url, host=None):
"""
"""
if
not
url
:
if
not
url
:
return
False
return
False
url
=
url
.
strip
()
# Chrome treats \ completely as /
# Chrome treats \ completely as /
url
=
url
.
replace
(
'
\\
'
,
'/'
)
url
=
url
.
replace
(
'
\\
'
,
'/'
)
# Chrome considers any URL with more than two slashes to be absolute, but
# Chrome considers any URL with more than two slashes to be absolute, but
...
...
docs/releases/1.4.18.txt
Dosyayı görüntüle @
69b5e667
...
@@ -31,6 +31,20 @@ development server now does the same. Django's development server is not
...
@@ -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
recommended for production use, but matching the behavior of common production
servers reduces the surface area for behavior changes during deployment.
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
Bugfixes
========
========
...
...
docs/releases/1.6.10.txt
Dosyayı görüntüle @
69b5e667
...
@@ -29,3 +29,17 @@ containing underscores from incoming requests by default. Django's built-in
...
@@ -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
development server now does the same. Django's development server is not
recommended for production use, but matching the behavior of common production
recommended for production use, but matching the behavior of common production
servers reduces the surface area for behavior changes during deployment.
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.
docs/releases/1.7.3.txt
Dosyayı görüntüle @
69b5e667
...
@@ -30,6 +30,20 @@ development server now does the same. Django's development server is not
...
@@ -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
recommended for production use, but matching the behavior of common production
servers reduces the surface area for behavior changes during deployment.
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
Bugfixes
========
========
...
...
tests/utils_tests/test_http.py
Dosyayı görüntüle @
69b5e667
...
@@ -109,7 +109,8 @@ class TestUtilsHttp(unittest.TestCase):
...
@@ -109,7 +109,8 @@ class TestUtilsHttp(unittest.TestCase):
'http:/
\
//example.com'
,
'http:/
\
//example.com'
,
'http:
\
/example.com'
,
'http:
\
/example.com'
,
'http:/
\
example.com'
,
'http:/
\
example.com'
,
'javascript:alert("XSS")'
):
'javascript:alert("XSS")'
,
'
\n
javascript:alert(x)'
):
self
.
assertFalse
(
http
.
is_safe_url
(
bad_url
,
host
=
'testserver'
),
"
%
s should be blocked"
%
bad_url
)
self
.
assertFalse
(
http
.
is_safe_url
(
bad_url
,
host
=
'testserver'
),
"
%
s should be blocked"
%
bad_url
)
for
good_url
in
(
'/view/?param=http://example.com'
,
for
good_url
in
(
'/view/?param=http://example.com'
,
'/view/?param=https://example.com'
,
'/view/?param=https://example.com'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment