Skip to content

fix: DOM XSS hardening and safer GitHub Pages artifact - #14

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-correctness-bugs-42be
Draft

cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-correctness-bugs-42be

Conversation

@cursor

@cursor cursor Bot commented May 19, 2026

Copy link
Copy Markdown

Summary

This change set addresses high-severity correctness and security issues found in the static tool site and its Pages deployment workflow.

Bug and impact

  1. DOM XSS (user-facing breakage / account takeover class in browser context)
    Markdown preview, text diff, and regex match output wrote user-controlled strings into innerHTML without escaping. A concrete trigger is pasting e.g. <img src=x onerror=alert(1)> into Markdown, diff text, or a regex match substring, which previously executed script in the same origin as the page.

  2. GitHub Pages artifact scope (information disclosure / unnecessary blast radius)
    The deploy workflow uploaded the entire checkout directory (.) as the Pages artifact, which can include .git and other non-site files, increasing risk of leaking repository metadata and bloating the published bundle.

Root cause

  • renderMD(), textDiff(), and testRegex() interpolated raw user text into HTML strings assigned to innerHTML.
  • upload-pages-artifact was pointed at the repository root instead of a minimal static bundle.

Fix and validation

  • Added escapeHtml() and applied it before innerHTML writes in the affected tools; Markdown pipeline now escapes first, then applies the existing lightweight markdown transforms.
  • Workflow now copies only index.html into _site/ and uploads _site as the artifact.

Validation: Manual reasoning on trigger scenarios above; repository has no JS test harness. Please smoke-test Markdown preview, text diff, and regex tools in the browser after deploy.

Commits

  • fix(security): escape user-controlled HTML in tool panels
  • fix(ci): ship only index.html in GitHub Pages artifact
Open in Web View Automation 

cursoragent and others added 2 commits May 19, 2026 11:11
Prevent DOM XSS via Markdown preview, line diff output, and regex match
rendering by adding escapeHtml() and applying it before innerHTML writes.

Co-authored-by: Muki182 <Muki182@users.noreply.github.com>
Avoid bundling the checkout workspace (including .git) into the Pages
upload, reducing accidental metadata exposure and deploy size.

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