diff --git a/src/channels/web/static/app.js b/src/channels/web/static/app.js
index 7ca9a25b..de1f83b6 100644
--- a/src/channels/web/static/app.js
+++ b/src/channels/web/static/app.js
@@ -676,26 +676,20 @@ function renderMarkdown(text) {
return escapeHtml(text);
}
-// Strip dangerous HTML elements and attributes from rendered markdown.
-// This prevents XSS from tool output or prompt injection in LLM responses.
+// Sanitize rendered HTML using DOMPurify to prevent XSS from tool output
+// or prompt injection in LLM responses. DOMPurify is a DOM-based sanitizer
+// that handles all known bypass vectors (SVG onload, newline-split event
+// handlers, mutation XSS, etc.) unlike the regex approach it replaces.
function sanitizeRenderedHtml(html) {
- html = html.replace(/
+