Skip to content

fix(gui): escape bot_name and bot_description to prevent XSS#844

Open
abdelhadi703 wants to merge 1 commit intoQwenLM:mainfrom
abdelhadi703:fix/xss-sanitize-bot-info
Open

fix(gui): escape bot_name and bot_description to prevent XSS#844
abdelhadi703 wants to merge 1 commit intoQwenLM:mainfrom
abdelhadi703:fix/xss-sanitize-bot-info

Conversation

@abdelhadi703
Copy link
Copy Markdown

Summary

Prevent XSS attacks via unsanitized bot_name and bot_description in the Gradio WebUI.

Problem: bot_name and bot_description are interpolated directly into HTML in format_cover_html() without escaping, allowing a malicious user to inject JavaScript (e.g. <img src=x onerror=alert(document.cookie)>).

Fix: Apply html.escape() to both fields before HTML interpolation.

Changes

  • qwen_agent/gui/gradio_utils.py:
    • Add import html
    • Escape bot_name and bot_description with html.escape()

Security

  • Prevents stored XSS via bot configuration
  • Uses Python stdlib (html.escape) — no new dependencies

Contribution by abdelhadisalmaoui0909@outlook.fr

bot_name and bot_description are interpolated directly into HTML without
escaping, allowing a malicious user to inject JavaScript via a crafted
bot configuration (e.g. <img src=x onerror=alert(...)>).

Add html.escape() to both fields in format_cover_html().

Fixes QwenLM#810
@abdelhadi703 abdelhadi703 force-pushed the fix/xss-sanitize-bot-info branch from 7d89b03 to b288a7b Compare March 25, 2026 13:23
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