Skip to content

fix(security): Prevent DOM XSS in Markdown, diff, and regex views - #7

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-b05a
Draft

fix(security): Prevent DOM XSS in Markdown, diff, and regex views#7
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-b05a

Conversation

@cursor

@cursor cursor Bot commented May 13, 2026

Copy link
Copy Markdown

Summary

Several tools wrote user-controlled strings into innerHTML without escaping, which allows DOM-based cross-site scripting in the same origin (for example pasting # <img src=x onerror=alert(1)> into Markdown preview, or the same payload into a text-diff line).

Changes

  • Add escapeHtml() and use it for all user-derived segments rendered into innerHTML in text diff and regex results.
  • Markdown preview: escape the full input first, then apply the existing lightweight markdown replacements so that unmatched plain text cannot inject markup.

Validation

  • Manual reasoning on XSS trigger scenarios; no automated test harness exists in this static HTML repository.

Impact

Removes a client-side XSS surface for users who paste untrusted content into these panels.

Open in Web View Automation 

Prevent DOM XSS when user content is rendered via innerHTML in
Markdown preview, text diff, and regex match display.

Co-authored-by: Muki182 <Muki182@users.noreply.github.com>
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