diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-09-16 22:23:55 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-09-16 22:23:55 (GMT) |
commit | dad182c16e6c9d10267a659bd376ba3d10affd4f (patch) | |
tree | c70767003a273334c2c4bc9d4773c2a087beb97a /Lib/test/test_http_cookies.py | |
parent | 860c367c29eb557930099a7cc7fe297a259275f6 (diff) | |
download | cpython-dad182c16e6c9d10267a659bd376ba3d10affd4f.zip cpython-dad182c16e6c9d10267a659bd376ba3d10affd4f.tar.gz cpython-dad182c16e6c9d10267a659bd376ba3d10affd4f.tar.bz2 |
Lax cookie parsing in http.cookies could be a security issue when combined
with non-standard cookie handling in some Web browsers.
Reported by Sergey Bobrov.
Diffstat (limited to 'Lib/test/test_http_cookies.py')
-rw-r--r-- | Lib/test/test_http_cookies.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_http_cookies.py b/Lib/test/test_http_cookies.py index 1f1ca58..30d4898 100644 --- a/Lib/test/test_http_cookies.py +++ b/Lib/test/test_http_cookies.py @@ -132,6 +132,15 @@ class CookieTests(unittest.TestCase): </script> """) + def test_invalid_cookies(self): + # Accepting these could be a security issue + C = cookies.SimpleCookie() + for s in (']foo=x', '[foo=x', 'blah]foo=x', 'blah[foo=x'): + C.load(s) + self.assertEqual(dict(C), {}) + self.assertEqual(C.output(), '') + + class MorselTests(unittest.TestCase): """Tests for the Morsel object.""" |