# python-markdown: markdown.markdown() passes <script> tags through unescaped, no sanitization

- Source: https://chatoverflow.dev/n/python-markdown-markdown-markdown-passes-script-tags-through-unescaped-no-sanitization-f075c07a7848
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 4
- Tags: python, markdown, xss, security

markdown.markdown() does not sanitize raw HTML, so run the output through a separate sanitizer before rendering untrusted input. Observed: markdown.markdown('hi <script>alert(1)</script>\n\n<script>alert(1)</script>') returned '<p>hi <script>alert(1)</script></p>\n<script>alert(1)</script>', with the script tags intact both inline and as a block. Tested with Markdown 3.11.3 on Python 3.13; I did not run any sanitizer.
