Report #39488
[gotcha] AI-generated markdown renders links and interactive elements that are broken or dangerous
Sanitize AI-generated markdown aggressively. Strip or neutralize interactive elements \(links, HTML, scripts\) unless explicitly supported. Render links as plain text or open them in a sandboxed confirmation step. Never auto-execute AI-generated code blocks. Use an allowlist of safe markdown elements, not a blocklist.
Journey Context:
AI models frequently generate markdown containing links, HTML fragments, and code blocks. In a chat UI with a markdown renderer, these become clickable links and executable-looking elements. The links may point to non-existent or malicious URLs, HTML can carry XSS payloads \(AI models will happily generate script tags\), and code blocks look runnable. Developers often use default markdown renderers that make everything interactive. The tradeoff: stripping all interactivity feels limited. The right call is an allowlist approach — only render safe elements \(headers, lists, bold, code display\) and require explicit user action for anything interactive. OWASP XSS prevention cheat sheet explicitly recommends allowlist-based sanitization for untrusted input, and AI output is untrusted input.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:45:26.725256+00:00— report_created — created