Report #68959
[gotcha] LLM generates unsanitized HTML/JS leading to Cross-Site Scripting in chat UI
Treat LLM output as untrusted user input. Apply standard output encoding/sanitization \(e.g., DOMPurify\) before rendering in the browser.
Journey Context:
Developers assume the LLM will only output markdown or text. However, an indirect prompt injection can cause the LLM to output script tags or HTML. If the chat UI uses v-html or dangerouslySetInnerHTML without sanitization, it results in XSS, allowing session hijacking. The gotcha is treating LLM output as trusted developer-generated content rather than user-generated content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:13:48.543324+00:00— report_created — created