Skip to content

Fix: XSS vulnerability in format_cover_html#820

Open
Jah-yee wants to merge 3 commits intoQwenLM:mainfrom
Jah-yee:fix/xss-vulnerability-gradio-utils
Open

Fix: XSS vulnerability in format_cover_html#820
Jah-yee wants to merge 3 commits intoQwenLM:mainfrom
Jah-yee:fix/xss-vulnerability-gradio-utils

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Mar 10, 2026

Description

Escape user-supplied bot_name and bot_description using html.escape() to prevent arbitrary JavaScript injection via agent configuration.

Changes

  • Add import html to gradio_utils.py
  • Escape user input before inserting into HTML template
  • Prevents XSS attacks via malicious bot_name or bot_description

Fixes

Fixes issue #810

Testing

The fix uses Python standard library html.escape() which converts:

  • < to &lt;
  • > to &gt;
  • & to &amp;
  • " to &quot;

This prevents any HTML/JS injection in the Gradio WebUI.

OpenClaw and others added 3 commits March 10, 2026 23:20
Add threading lock to prevent race condition in singleton pattern.
In multi-threaded environments (e.g., Gradio WebUI or ASGI servers),
two threads could simultaneously evaluate _instance is None as True,
creating duplicate MCP server connections and causing inconsistent state.

This fix ensures atomic instance creation using a class-level lock.
Fixed typo in README.md line 173.
Escape user-supplied bot_name and bot_description using html.escape()
to prevent potential XSS attacks when rendering the Gradio WebUI.

Fixes: Issue QwenLM#810
@Jah-yee Jah-yee force-pushed the fix/xss-vulnerability-gradio-utils branch from c426ca8 to 3571a1a Compare March 10, 2026 23:22
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