Skip to content

fix(webui): prevent agent HTML/CSS from polluting the main UI - #278

Open
ktz03 wants to merge 1 commit into
TencentCloudADP:mainfrom
ktz03:fix/isolate-agent-html-css
Open

fix(webui): prevent agent HTML/CSS from polluting the main UI#278
ktz03 wants to merge 1 commit into
TencentCloudADP:mainfrom
ktz03:fix/isolate-agent-html-css

Conversation

@ktz03

@ktz03 ktz03 commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • Stop agent-generated <style> / stylesheet <link> from being injected into the app document via SafeMarkdown (rehypeRaw).
  • Sanitize SVG report HTML with DOMPurify (forbid style/link/script).
  • Full HTML reports already render in a sandboxed iframe; this closes the markdown/raw-HTML path that was leaking CSS into the shell.

Fixes #242

Testing plan

  • Render a normal markdown assistant message (unchanged).
  • Stream/generate HTML containing <style>body{display:none}</style> in a chat message and confirm the main UI is not restyled.
  • Open an HTML report message and confirm iframe preview still works.
  • Open an SVG report and confirm it still renders without injecting page-level CSS.

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.

css样式污染

1 participant