diff --git a/static/js/markdown.js b/static/js/markdown.js index dd97979..622a166 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -34,6 +34,83 @@ function linkHtml(text, url) { return `${safeText}`; } +/** + * Sanitize the raw-HTML fragments that mdToHtml deliberately preserves from + * the source text —
blocks (collapsible agent output) and tags + * (emitted by the markdown link pass). Those fragments are later restored + * verbatim into innerHTML, so without scrubbing them a model — or any content + * routed through here — could smuggle in an ``, an + * ``, an `onmouseover=` handler, etc. and execute + * script in the authenticated page (DOM XSS). + * + * Parsing into a