Skip to content

XSS fix(webui): sanitize chat markdown rendering#1635

Open
BestDevOfc wants to merge 1 commit into
agent0ai:mainfrom
BestDevOfc:fix/chat-markdown-xss-943
Open

XSS fix(webui): sanitize chat markdown rendering#1635
BestDevOfc wants to merge 1 commit into
agent0ai:mainfrom
BestDevOfc:fix/chat-markdown-xss-943

Conversation

@BestDevOfc
Copy link
Copy Markdown

@BestDevOfc BestDevOfc commented May 12, 2026

Summary

Screenshot 2026-05-12 at 5 24 17 PM

Root cause

Chat messages render Markdown with marked.parse(...) and then inject the resulting HTML into the DOM. This change applies the existing sanitizeHtml(...) helper to rendered chat Markdown before path-link decoration and innerHTML assignment.

The sanitizer keeps the default behavior unchanged for existing safe-markdown users. The chat renderer opts into the existing chat-specific rendering needs:

  • preserves the custom <latex> tag when KaTeX rendering is enabled
  • allows base64 bitmap image data URLs for Agent Zero chat image attachments
  • continues stripping event handlers, javascript: URLs, scripts, SVG, and other unsafe content

@BestDevOfc BestDevOfc changed the title fix(webui): sanitize chat markdown rendering XSS fix(webui): sanitize chat markdown rendering May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant