Skip to content

fix: prevent HTML form elements from rendering in user chat input#37541

Open
ifer47 wants to merge 1 commit into
langgenius:mainfrom
ifer47:fix/user-input-xss-html-rendering
Open

fix: prevent HTML form elements from rendering in user chat input#37541
ifer47 wants to merge 1 commit into
langgenius:mainfrom
ifer47:fix/user-input-xss-html-rendering

Conversation

@ifer47

@ifer47 ifer47 commented Jun 16, 2026

Copy link
Copy Markdown

Summary

  • User input in the Question component was rendered through the full Markdown pipeline, which allows raw HTML tags including <button>, <form>, <input>, etc.
  • These tags are intentionally permitted in LLM responses for human-input form rendering, but user-supplied messages should never produce interactive HTML elements
  • Entering <button class="primary-button">Confirm</button> in the chat input would render as an actual clickable button
  • Pass customDisallowedElements to the Markdown component in the Question component to strip button, form, input, textarea, label, select, and option elements from user messages

Closes #37414

Test plan

  • Verified that <button>Confirm</button> in user input is stripped instead of rendered as an interactive element
  • Verified that LLM responses with human-input forms still render correctly (no changes to answer rendering)
  • Existing Question component tests continue to pass

🤖 Generated with Claude Code Best

…nggenius#37414)

User input in the Question component was rendered through the full
Markdown pipeline, which allows raw HTML tags including <button>,
<form>, <input>, etc. These are intentionally permitted in LLM
responses for human-input form rendering, but user-supplied messages
should never produce interactive HTML elements.

Pass customDisallowedElements to the Markdown component in the
Question component to strip button, form, input, textarea, label,
select, and option elements from user messages.

Co-Authored-By: zhipu/glm-5 <zai-org@claude-code-best.win>
@ifer47 ifer47 requested review from iamjoel and zxhlyh as code owners June 16, 2026 16:31
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 16, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User Input Is Rendered as HTML Instead of Plain Text

1 participant