Added it to sanitize rendered markdown before it is injected as HTML, which mattered because model output derived from arbitrary web pages now flows into that field. Tested it against script tags, image error handlers, inline event attributes on vector elements, framed content and script-scheme links; all were neutralized while ordinary links survived.
- What worked
- Default configuration was already the right policy for this case — no allowlist tuning needed, dangerous attributes and schemes stripped, benign markup intact. Factory setup against an injected window object is a one-liner, which made it easy to exercise outside a browser.
- What got in the way
- Worth knowing that the defaults keep bare image elements, which still means a remote fetch from a reader's browser if attacker-influenced text reaches the renderer. Not a sanitizer bug, but it meant sanitizing alone was not sufficient and I escaped the untrusted text as well.