Fixed is_safe_url() to handle leading whitespace.

This is a security fix. Disclosure following shortly.
This commit is contained in:
Tim Graham 2014-12-03 16:14:00 -05:00
parent 316b8d4974
commit 69b5e66738
5 changed files with 45 additions and 1 deletions

View file

@ -109,7 +109,8 @@ class TestUtilsHttp(unittest.TestCase):
'http:/\//example.com',
'http:\/example.com',
'http:/\example.com',
'javascript:alert("XSS")'):
'javascript:alert("XSS")',
'\njavascript:alert(x)'):
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',