Fix formatting

This commit is contained in:
Christopher Broderick 2025-05-16 20:46:18 +01:00
parent 8c11758496
commit 2bba70f3cc
2 changed files with 5 additions and 3 deletions

View File

@ -49,7 +49,7 @@ def get_markdown(text):
# Search for markdown that creates a clickable link and remove the undesirable ones
pattern = re.compile(r"(\[[\s\S]*?\])\(([\w]*?):([\s\S]*?)\)", flags=re.MULTILINE)
rerun_scheme_check = True # Used to decided to re-check the text after each parse
rerun_scheme_check = True # Used to decided to re-check the text after each parse
while rerun_scheme_check:
has_illegal_scheme = False
for m in re.finditer(pattern, text):

View File

@ -49,12 +49,14 @@ class MarkDown(SimpleTestCase):
output_value = get_markdown(input_value)
self.assertEqual(output_value, expected_value)
def test_multiline_markdown_link_with_correct_and_incorrect_protocol_twice_declared(self):
def test_multiline_markdown_link_with_correct_and_incorrect_protocol_twice_declared(
self,
):
expected_value = '<p>This<a href="http://alert.javascript.test">XSS</a></p>\n<p>FAKE IT TILL YOU MAKE IT: <a href="alert(document.domain);">TEST</a></p>'
input_value = "This[XSS](http://alert.javascript.test)\n\nFAKE IT TILL YOU MAKE IT: [TEST](javascript:javascript:alert(document.domain);)"
output_value = get_markdown(input_value)
self.assertEqual(output_value, expected_value)
def test_markdown_link_with__multiple_incorrect_protocols(self):
expected_value = '<p>First one:<a href="alert(document.domain);">XSS1</a> ...try again: <a href="alert(document.domain);">XSS2</a></p>'
input_value = "First one:[XSS1](javascript:alert(document.domain);) ...try again: [XSS2](javascript:javascript:alert(document.domain);)"