There was an error while loading. Please reload this page.
1 parent c4093c4 commit dcf8902Copy full SHA for dcf8902
1 file changed
tests/test_security_math.py
@@ -0,0 +1,16 @@
1
+from unittest import TestCase
2
+
3
+from mistune import create_markdown
4
5
6
+class TestMathSecurity(TestCase):
7
+ def test_math_plugin_escapes_math_content(self):
8
+ md = create_markdown(escape=True, plugins=["math"])
9
10
+ inline_html = md("$<script>alert(1)</script>$\n")
11
+ block_html = md("$$\n<script>alert(1)</script>\n$$\n")
12
13
+ self.assertIn("<script>alert(1)</script>", inline_html)
14
+ self.assertIn("<script>alert(1)</script>", block_html)
15
+ self.assertNotIn("<script>", inline_html)
16
+ self.assertNotIn("<script>", block_html)
0 commit comments