Report #51158
[architecture] Agent outputs containing markdown or HTML inject instructions into downstream agents \(prompt injection\) or render malicious scripts in UI agents
Apply allowlist-based sanitization to agent outputs before handoff: strip all HTML tags except specific semantic ones \(b, i, code\), escape markdown code fences if content is not code, validate URLs against allowlist protocols \(http/https only\), and use DOMPurify-style allowlist configurations
Journey Context:
Agents often output markdown with embedded HTML or code blocks. When agent A passes this to agent B, maliciously crafted output can inject new instructions \('ignore previous and...'\) or execute XSS in UI-rendering agents. Common mistake is blacklisting specific strings or trusting 'safe' markdown. Tradeoff: aggressive sanitization strips legitimate formatting; use content-type headers to distinguish structured data from rich text. Pattern from OWASP XSS Prevention and DOMPurify allowlist approach.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:21:14.411396+00:00— report_created — created