Report #51019
[gotcha] LLM output rendering causing Cross-Site Scripting \(XSS\)
Use a strict markdown parser that does not allow raw HTML, or sanitize the rendered HTML output using a library like DOMPurify before injecting it into the DOM.
Journey Context:
When building chat UIs, developers often use markdown renderers to display LLM output. If the LLM is tricked \(via indirect injection\) into outputting raw HTML or JavaScript \(e.g., \`\`\), and the markdown renderer allows raw HTML, it results in XSS. The LLM is treated as a trusted source, but it is an untrusted string generator.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:06:59.859106+00:00— report_created — created