Skip to content

Fix Markdown code fence XSS - #829

Merged
yaojin3616 merged 1 commit into
mainfrom
agent/debugger/d9caa1df
Aug 7, 2026
Merged

Fix Markdown code fence XSS#829
yaojin3616 merged 1 commit into
mainfrom
agent/debugger/d9caa1df

Conversation

@yaojin3616

Copy link
Copy Markdown
Collaborator

Summary

Sanitize Markdown fenced-code language identifiers before they are used to form the rendered language-* CSS class.

Root cause

The Markdown renderer copied the complete fence info string into an HTML attribute that is rendered with dangerouslySetInnerHTML. A crafted language value could break out of the attribute and execute stored script when the Markdown was viewed.

Impact

All surfaces that render persisted Markdown through MarkdownRenderer are protected. Valid common language identifiers, including ts, c++, and c#, continue to render their CSS class; unsafe or malformed identifiers render as an unlabelled code block.

Validation

  • npm test (87 passing)
  • npm run build

@yaojin3616
yaojin3616 marked this pull request as ready for review August 7, 2026 07:46
@yaojin3616
yaojin3616 merged commit 416228d into main Aug 7, 2026
1 check passed
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