Skip to content

Secure-by-default hardening: default preset should escape raw HTML (html:false) like upstream JS markdown-it #413

Description

@plotarmordev

Behavior-change / secure-defaults proposal (not a hidden-vuln claim)

Please consider making the DEFAULT preset mirror upstream JS markdown-it (html:false) with opt-in raw HTML, as an ecosystem-consistency hardening step. CVE-2025-7969 is the recent precedent for markdown/HTML raw-injection-by-default class risk.

Status quo: markdown-it-py 4.2.0 MarkdownIt() defaults html=True (raw HTML passes through unescaped); upstream JS markdown-it 15.0.0 'default' preset is html:false (escapes). Consequence below is the exploit chain through the DEFAULT render API:

from markdown_it import MarkdownIt
MarkdownIt().render('<script>alert(1)</script>')  # -> raw <script> in output (executes); JS escapes to &lt;script&gt;

All extant markdown-it-py advisories (GHSA-jrwr-5x3p-hvc3, GHSA-vrjv-mxr7-vjf8, PYSEC-2023-23/24) are DoS; none cover this default. Ask: either switch the default to html:false (breaking change; deprecate html:true default) or clearly document + harden guidance (set html=False / sanitize for untrusted input). Framed as behavior-change request so it is not closable as WAI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions