Skip to content

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

Merged
frdel merged 1 commit into
agent0ai:readyfrom
BestDevOfc:fix/chat-markdown-xss-943
May 13, 2026
Merged

XSS fix(webui): sanitize chat markdown rendering#1635
frdel merged 1 commit into
agent0ai:readyfrom
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
@frdel
Copy link
Copy Markdown
Collaborator

frdel commented May 13, 2026

Thank you!

@frdel frdel changed the base branch from main to ready May 13, 2026 08:01
@frdel frdel merged commit 1e271be into agent0ai:ready May 13, 2026
@BestDevOfc
Copy link
Copy Markdown
Author

Thank you for the quick actions, after the patch can a CVE be issued so older versions are tracked and indexed?

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.

2 participants