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
d22b90b4
Kaydet (Commit)
d22b90b4
authored
Haz 22, 2018
tarafından
Przemysław Suliga
Kaydeden (comit)
Tim Graham
Haz 29, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29525 -- Allowed is_safe_url()'s allowed_hosts arg to be a string.
üst
b5dd6ef3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
0 deletions
+7
-0
AUTHORS
AUTHORS
+1
-0
http.py
django/utils/http.py
+2
-0
test_http.py
tests/utils_tests/test_http.py
+4
-0
No files found.
AUTHORS
Dosyayı görüntüle @
d22b90b4
...
@@ -678,6 +678,7 @@ answer newbie questions, and generally made Django that much better:
...
@@ -678,6 +678,7 @@ answer newbie questions, and generally made Django that much better:
Preston Holmes <preston@ptone.com>
Preston Holmes <preston@ptone.com>
Preston Timmons <prestontimmons@gmail.com>
Preston Timmons <prestontimmons@gmail.com>
Priyansh Saxena <askpriyansh@gmail.com>
Priyansh Saxena <askpriyansh@gmail.com>
Przemysław Suliga <http://suligap.net>
Rachel Tobin <rmtobin@me.com>
Rachel Tobin <rmtobin@me.com>
Rachel Willmer <http://www.willmer.com/kb/>
Rachel Willmer <http://www.willmer.com/kb/>
Radek Švarz <http://www.svarz.cz/translate/>
Radek Švarz <http://www.svarz.cz/translate/>
...
...
django/utils/http.py
Dosyayı görüntüle @
d22b90b4
...
@@ -298,6 +298,8 @@ def is_safe_url(url, allowed_hosts, require_https=False):
...
@@ -298,6 +298,8 @@ def is_safe_url(url, allowed_hosts, require_https=False):
return
False
return
False
if
allowed_hosts
is
None
:
if
allowed_hosts
is
None
:
allowed_hosts
=
set
()
allowed_hosts
=
set
()
elif
isinstance
(
allowed_hosts
,
str
):
allowed_hosts
=
{
allowed_hosts
}
# Chrome treats \ completely as / in paths but it could be part of some
# Chrome treats \ completely as / in paths but it could be part of some
# basic auth credentials so we need to check both URLs.
# basic auth credentials so we need to check both URLs.
return
(
_is_safe_url
(
url
,
allowed_hosts
,
require_https
=
require_https
)
and
return
(
_is_safe_url
(
url
,
allowed_hosts
,
require_https
=
require_https
)
and
...
...
tests/utils_tests/test_http.py
Dosyayı görüntüle @
d22b90b4
...
@@ -165,6 +165,10 @@ class IsSafeURLTests(unittest.TestCase):
...
@@ -165,6 +165,10 @@ class IsSafeURLTests(unittest.TestCase):
# Basic auth without host is not allowed.
# Basic auth without host is not allowed.
self
.
assertIs
(
is_safe_url
(
r'http://testserver\@example.com'
,
allowed_hosts
=
None
),
False
)
self
.
assertIs
(
is_safe_url
(
r'http://testserver\@example.com'
,
allowed_hosts
=
None
),
False
)
def
test_allowed_hosts_str
(
self
):
self
.
assertIs
(
is_safe_url
(
'http://good.com/good'
,
allowed_hosts
=
'good.com'
),
True
)
self
.
assertIs
(
is_safe_url
(
'http://good.co/evil'
,
allowed_hosts
=
'good.com'
),
False
)
def
test_secure_param_https_urls
(
self
):
def
test_secure_param_https_urls
(
self
):
secure_urls
=
(
secure_urls
=
(
'https://example.com/p'
,
'https://example.com/p'
,
...
...
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