Engrain by ByteRush

AIF.02.01 Mid-levelCore — asked often

Model output is untrusted: XSS and injection via rendering

Comes up in: Web fundamentals, AI system design, Frontend system design

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • OWASP Improper Output Handling (LLM10 in the 2026 edition, LLM05 in 2025 — number via <Fact>)
  • markdown → HTML with raw HTML disabled
  • sanitising (DOMPurify)
  • link safety (javascript: URLs, lookalike domains, rel)
  • images as exfiltration channels (markdown image URLs carrying data)
  • CSP for AI pages

Words you will know

improper output handlingdata exfiltrationsanitisation

What you will practise

  • break and then secure a naive markdown renderer

Interview questions this answers

  • Why is rendering LLM output with innerHTML dangerous?
  • How can a markdown image in model output leak user data?