Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 895339 Details for
Bug 1097505
CVE-2014-3730 Django: insufficient URL validation could lead to redirects
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fix for 1.4 versions
is_safe_url_1_4.diff (text/plain), 5.16 KB, created by
Murray McAllister
on 2014-05-14 03:33:31 UTC
(
hide
)
Description:
fix for 1.4 versions
Filename:
MIME Type:
Creator:
Murray McAllister
Created:
2014-05-14 03:33:31 UTC
Size:
5.16 KB
patch
obsolete
>diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py >index 6d7029b..2b72cd4 100644 >--- a/django/contrib/auth/tests/views.py >+++ b/django/contrib/auth/tests/views.py >@@ -307,8 +307,10 @@ class LoginTest(AuthViewsTestCase): > > # Those URLs should not pass the security check > for bad_url in ('http://example.com', >+ 'http:///example.com', > 'https://example.com', > 'ftp://exampel.com', >+ '///example.com', > '//example.com', > 'javascript:alert("XSS")'): > >@@ -330,8 +332,8 @@ class LoginTest(AuthViewsTestCase): > '/view/?param=https://example.com', > '/view?param=ftp://exampel.com', > 'view/?param=//example.com', >- 'https:///', >- 'HTTPS:///', >+ 'https://testserver/', >+ 'HTTPS://testserver/', > '//testserver/', > '/url%20with%20spaces/'): # see ticket #12534 > safe_url = '%(url)s?%(next)s=%(good_url)s' % { >@@ -467,8 +469,10 @@ class LogoutTest(AuthViewsTestCase): > > # Those URLs should not pass the security check > for bad_url in ('http://example.com', >+ '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' % { >@@ -488,8 +492,8 @@ class LogoutTest(AuthViewsTestCase): > '/view/?param=https://example.com', > '/view?param=ftp://exampel.com', > 'view/?param=//example.com', >- 'https:///', >- 'HTTPS:///', >+ 'https://testserver/', >+ 'HTTPS://testserver/', > '//testserver/', > '/url%20with%20spaces/'): # see ticket #12534 > safe_url = '%(url)s?%(next)s=%(good_url)s' % { >diff --git a/django/utils/http.py b/django/utils/http.py >index 21c84dc..2d40489 100644 >--- a/django/utils/http.py >+++ b/django/utils/http.py >@@ -234,6 +234,18 @@ def is_safe_url(url, host=None): > """ > if not url: > return False >+ # Chrome treats \ completely as / >+ url = url.replace('\\', '/') >+ # Chrome considers any URL with more than two slashes to be absolute, but >+ # urlaprse is not so flexible. Treat any url with three slashes as unsafe. >+ if url.startswith('///'): >+ return False > url_info = urlparse.urlparse(url) >+ # Forbid URLs like http:///example.com - with a scheme, but without a hostname. >+ # In that URL, example.com is not the hostname but, a path component. However, >+ # Chrome will still consider example.com to be the hostname, so we must not >+ # allow this syntax. >+ if not url_info[1] and url_info[0]: >+ return False > return (not url_info[1] or url_info[1] == host) and \ > (not url_info[0] or url_info[0] in ['http', 'https']) >diff --git a/tests/regressiontests/utils/http.py b/tests/regressiontests/utils/http.py >index 16c7daa..c50524e 100644 >--- a/tests/regressiontests/utils/http.py >+++ b/tests/regressiontests/utils/http.py >@@ -122,3 +122,33 @@ class TestUtilsHttp(unittest.TestCase): > for n, b36 in [(0, '0'), (1, '1'), (42, '16'), (818469960, 'django')]: > self.assertEqual(http.int_to_base36(n), b36) > self.assertEqual(http.base36_to_int(b36), n) >+ >+ def test_is_safe_url(self): >+ for bad_url in ('http://example.com', >+ 'http:///example.com', >+ 'https://example.com', >+ 'ftp://exampel.com', >+ r'\\example.com', >+ r'\\\example.com', >+ r'/\\/example.com', >+ r'\\\example.com', >+ r'\\example.com', >+ r'\\//example.com', >+ r'/\/example.com', >+ r'\/example.com', >+ r'/\example.com', >+ 'http:///example.com', >+ 'http:/\//example.com', >+ 'http:\/example.com', >+ 'http:/\example.com', >+ 'javascript:alert("XSS")'): >+ 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', >+ '/view/?param=https://example.com', >+ '/view?param=ftp://exampel.com', >+ 'view/?param=//example.com', >+ 'https://testserver/', >+ 'HTTPS://testserver/', >+ '//testserver/', >+ '/url%20with%20spaces/'): >+ self.assertTrue(http.is_safe_url(good_url, host='testserver'), "%s should be allowed" % good_url)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1097505
:
895338
| 895339 |
895340
|
895342