Report #84383
[gotcha] LLM outputs unescaped user-supplied HTML/JS leading to Cross-Site Scripting \(XSS\) in chat UI
Sanitize and escape LLM outputs before rendering in the browser; treat LLM outputs as untrusted user input for XSS prevention; use Content Security Policy \(CSP\) headers.
Journey Context:
Developers often render LLM markdown outputs directly in the DOM using dangerouslySetInnerHTML or equivalent. If the LLM is tricked \(via prompt injection\) into outputting malicious HTML/JS \(e.g.,
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:13:44.895640+00:00— report_created — created