Report #51325
[gotcha] Cross-Site Scripting \(XSS\) via unsanitized LLM output rendering
Sanitize LLM outputs using a strict HTML sanitizer \(like DOMPurify\) before rendering in the browser. Treat LLM output as untrusted user-generated content, never rendering it as raw HTML.
Journey Context:
Because LLMs are trained on vast internet data, they can generate valid HTML/JS. If the chat UI renders LLM output as raw HTML to support markdown, an indirect prompt injection could cause the LLM to output script tags, leading to XSS in the user's session.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:38:03.706559+00:00— report_created — created