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
ae353516
Kaydet (Commit)
ae353516
authored
Agu 13, 2013
tarafından
Jacob Kaplan-Moss
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed is_safe_url() to reject URLs that use a scheme other than HTTP/S.
This is a security fix; disclosure to follow shortly.
üst
09a5f5aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
test_views.py
django/contrib/auth/tests/test_views.py
+6
-2
http.py
django/utils/http.py
+4
-3
No files found.
django/contrib/auth/tests/test_views.py
Dosyayı görüntüle @
ae353516
...
...
@@ -446,7 +446,8 @@ class LoginTest(AuthViewsTestCase):
for
bad_url
in
(
'http://example.com'
,
'https://example.com'
,
'ftp://exampel.com'
,
'//example.com'
):
'//example.com'
,
'javascript:alert("XSS")'
):
nasty_url
=
'
%(url)
s?
%(next)
s=
%(bad_url)
s'
%
{
'url'
:
login_url
,
...
...
@@ -467,6 +468,7 @@ class LoginTest(AuthViewsTestCase):
'/view?param=ftp://exampel.com'
,
'view/?param=//example.com'
,
'https:///'
,
'HTTPS:///'
,
'//testserver/'
,
'/url
%20
with
%20
spaces/'
):
# see ticket #12534
safe_url
=
'
%(url)
s?
%(next)
s=
%(good_url)
s'
%
{
...
...
@@ -661,7 +663,8 @@ class LogoutTest(AuthViewsTestCase):
for
bad_url
in
(
'http://example.com'
,
'https://example.com'
,
'ftp://exampel.com'
,
'//example.com'
):
'//example.com'
,
'javascript:alert("XSS")'
):
nasty_url
=
'
%(url)
s?
%(next)
s=
%(bad_url)
s'
%
{
'url'
:
logout_url
,
'next'
:
REDIRECT_FIELD_NAME
,
...
...
@@ -680,6 +683,7 @@ class LogoutTest(AuthViewsTestCase):
'/view?param=ftp://exampel.com'
,
'view/?param=//example.com'
,
'https:///'
,
'HTTPS:///'
,
'//testserver/'
,
'/url
%20
with
%20
spaces/'
):
# see ticket #12534
safe_url
=
'
%(url)
s?
%(next)
s=
%(good_url)
s'
%
{
...
...
django/utils/http.py
Dosyayı görüntüle @
ae353516
...
...
@@ -252,11 +252,12 @@ def same_origin(url1, url2):
def
is_safe_url
(
url
,
host
=
None
):
"""
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
a different host).
a different host
and uses a safe scheme
).
Always returns ``False`` on an empty url.
"""
if
not
url
:
return
False
netloc
=
urllib_parse
.
urlparse
(
url
)[
1
]
return
not
netloc
or
netloc
==
host
url_info
=
urllib_parse
.
urlparse
(
url
)
return
(
not
url_info
.
netloc
or
url_info
.
netloc
==
host
)
and
\
(
not
url_info
.
scheme
or
url_info
.
scheme
in
[
'http'
,
'https'
])
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