diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-07-10 20:30:12 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-07-31 16:12:23 +0200 |
| commit | efea1ef7e2190e3f77ca0651b5458297bc0f6a9f (patch) | |
| tree | 69b0236736ffabd9de6d5963ab8e33fcc01eca9b /tests/utils_tests/test_html.py | |
| parent | d0a82e26a74940bf0c78204933c3bdd6a283eb88 (diff) | |
[4.2.x] Fixed CVE-2024-41991 -- Prevented potential ReDoS in django.utils.html.urlize() and AdminURLFieldWidget.
Thanks Seokchan Yoon for the report.
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'tests/utils_tests/test_html.py')
| -rw-r--r-- | tests/utils_tests/test_html.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index c45e0dfac1..83ebe4334b 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -328,6 +328,15 @@ class TestUtilsHtml(SimpleTestCase): 'Search for <a href="http://google.com/?q=">google.com/?q=</a>!', ), ("foo@example.com", '<a href="mailto:foo@example.com">foo@example.com</a>'), + ( + "test@" + "한.글." * 15 + "aaa", + '<a href="mailto:test@' + + "xn--6q8b.xn--bj0b." * 15 + + 'aaa">' + + "test@" + + "한.글." * 15 + + "aaa</a>", + ), ) for value, output in tests: with self.subTest(value=value): @@ -336,6 +345,10 @@ class TestUtilsHtml(SimpleTestCase): def test_urlize_unchanged_inputs(self): tests = ( ("a" + "@a" * 50000) + "a", # simple_email_re catastrophic test + # Unicode domain catastrophic tests. + "a@" + "한.글." * 1_000_000 + "a", + "http://" + "한.글." * 1_000_000 + "com", + "www." + "한.글." * 1_000_000 + "com", ("a" + "." * 1000000) + "a", # trailing_punctuation catastrophic test "foo@", "@foo.com", |
