fix(gui): escape bot_name and bot_description to prevent XSS#844
Open
abdelhadi703 wants to merge 1 commit intoQwenLM:mainfrom
Open
fix(gui): escape bot_name and bot_description to prevent XSS#844abdelhadi703 wants to merge 1 commit intoQwenLM:mainfrom
abdelhadi703 wants to merge 1 commit intoQwenLM:mainfrom
Conversation
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
7d89b03 to
b288a7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent XSS attacks via unsanitized
bot_nameandbot_descriptionin the Gradio WebUI.Problem:
bot_nameandbot_descriptionare interpolated directly into HTML informat_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:import htmlbot_nameandbot_descriptionwithhtml.escape()Security
html.escape) — no new dependenciesContribution by abdelhadisalmaoui0909@outlook.fr