diff options
| author | Florian Apolloner <florian@apolloner.eu> | 2021-11-29 11:52:03 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-12-07 06:56:06 +0100 |
| commit | 22bd17488159601bf0741b70ae7932bffea8eced (patch) | |
| tree | 4071770d041ca672e79cc9e87a33016b60703db9 /tests/urlpatterns/tests.py | |
| parent | cfb780dafe29e2243d9b48d0783b729b315341bb (diff) | |
[3.1.x] Fixed #30530, CVE-2021-44420 -- Fixed potential bypass of an upstream access control based on URL paths.
Thanks Sjoerd Job Postmus and TengMA(@te3t123) for reports.
Backport of d4dcd5b9dd9e462fec8220e33e3e6c822b7e88a6 from main.
Diffstat (limited to 'tests/urlpatterns/tests.py')
| -rw-r--r-- | tests/urlpatterns/tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/urlpatterns/tests.py b/tests/urlpatterns/tests.py index 54b7e09813..98866f0b79 100644 --- a/tests/urlpatterns/tests.py +++ b/tests/urlpatterns/tests.py @@ -147,6 +147,19 @@ class SimplifiedURLTests(SimpleTestCase): with self.assertRaisesMessage(ImproperlyConfigured, msg): path('space/<int: num>', empty_view) + def test_path_trailing_newlines(self): + tests = [ + '/articles/2003/\n', + '/articles/2010/\n', + '/en/foo/\n', + '/included_urls/extra/\n', + '/regex/1/\n', + '/users/1/\n', + ] + for url in tests: + with self.subTest(url=url), self.assertRaises(Resolver404): + resolve(url) + @override_settings(ROOT_URLCONF='urlpatterns.converter_urls') class ConverterTests(SimpleTestCase): |
