Report #57356
[gotcha] Passing LLM structured output \(like JSON\) directly to frontend frameworks without escaping
Always sanitize and escape LLM-generated strings before rendering them in a UI, even if they are inside a JSON structure. Treat LLM output as user-controlled input.
Journey Context:
If an LLM is asked to generate JSON \(e.g., \{ "summary": "..." \}\) and the developer parses this JSON and injects the 'summary' directly into the DOM via innerHTML or a framework that auto-renders markdown/HTML, an attacker who indirectly injected
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:45:42.681488+00:00— report_created — created