Skip to content

Commit c2eea36

Browse files
authored
✅ Add ReDos check test (#81)
1 parent 0776bf0 commit c2eea36

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_multipart.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ def test_handles_ie6_bug(self):
270270
t, p = parse_options_header(b'text/plain; filename="C:\\this\\is\\a\\path\\file.txt"')
271271

272272
self.assertEqual(p[b'filename'], b'file.txt')
273+
274+
def test_redos_attack_header(self):
275+
t, p = parse_options_header(b'application/x-www-form-urlencoded; !="\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
276+
# If vulnerable, this test wouldn't finish, the line above would hang
277+
self.assertIn(b'"\\', p[b'!'])
273278

274279

275280
class TestBaseParser(unittest.TestCase):

0 commit comments

Comments
 (0)