summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-02-25 09:40:54 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-03-06 09:42:06 +0100
commit8dbb44d34271637099258391dfc79df33951b841 (patch)
tree6df62d9bbab9103546569fe368dd61a05f6211d3 /tests
parentd7dc1f6db046b671fef12e74b900043a8497a5c8 (diff)
[5.1.x] Fixed CVE-2025-26699 -- Mitigated potential DoS in wordwrap template filter.
Thanks sw0rd1ight for the report. Backport of 55d89e25f4115c5674cdd9b9bcba2bb2bb6d820b from main.
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/filter_tests/test_wordwrap.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/template_tests/filter_tests/test_wordwrap.py b/tests/template_tests/filter_tests/test_wordwrap.py
index 88fbd274da..4afa1dd234 100644
--- a/tests/template_tests/filter_tests/test_wordwrap.py
+++ b/tests/template_tests/filter_tests/test_wordwrap.py
@@ -78,3 +78,14 @@ class FunctionTests(SimpleTestCase):
"this is a long\nparagraph of\ntext that\nreally needs\nto be wrapped\n"
"I'm afraid",
)
+
+ def test_wrap_long_text(self):
+ long_text = (
+ "this is a long paragraph of text that really needs"
+ " to be wrapped I'm afraid " * 20_000
+ )
+ self.assertIn(
+ "this is a\nlong\nparagraph\nof text\nthat\nreally\nneeds to\nbe wrapped\n"
+ "I'm afraid",
+ wordwrap(long_text, 10),
+ )