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 895340 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.5 versions
is_safe_url_1_5.diff (text/plain), 5.19 KB, created by
Murray McAllister
on 2014-05-14 03:34:05 UTC
(
hide
)
Description:
fix for 1.5 versions
Filename:
MIME Type:
Creator:
Murray McAllister
Created:
2014-05-14 03:34:05 UTC
Size:
5.19 KB
patch
obsolete
>diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py >index e39dc0e..ba2b48a 100644 >--- a/django/contrib/auth/tests/views.py >+++ b/django/contrib/auth/tests/views.py >@@ -326,8 +326,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")'): > >@@ -349,8 +351,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' % { >@@ -521,8 +523,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' % { >@@ -542,8 +546,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 f376b1c..67912f7 100644 >--- a/django/utils/http.py >+++ b/django/utils/http.py >@@ -237,6 +237,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 = urllib_parse.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.netloc and url_info.scheme: >+ return False > return (not url_info.netloc or url_info.netloc == host) and \ > (not url_info.scheme or url_info.scheme in ['http', 'https']) >diff --git a/tests/regressiontests/utils/http.py b/tests/regressiontests/utils/http.py >index 6d3bc02..77bb522 100644 >--- a/tests/regressiontests/utils/http.py >+++ b/tests/regressiontests/utils/http.py >@@ -135,6 +135,35 @@ class TestUtilsHttp(unittest.TestCase): > 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) > > class ETagProcessingTests(unittest.TestCase): > def testParsing(self):
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