fix: DOM XSS hardening and safer GitHub Pages artifact - #14
Draft
cursor[bot] wants to merge 2 commits into
Draft
cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
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>
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
This change set addresses high-severity correctness and security issues found in the static tool site and its Pages deployment workflow.
Bug and impact
DOM XSS (user-facing breakage / account takeover class in browser context)
Markdown preview, text diff, and regex match output wrote user-controlled strings into
innerHTMLwithout 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.GitHub Pages artifact scope (information disclosure / unnecessary blast radius)
The deploy workflow uploaded the entire checkout directory (
.) as the Pages artifact, which can include.gitand other non-site files, increasing risk of leaking repository metadata and bloating the published bundle.Root cause
renderMD(),textDiff(), andtestRegex()interpolated raw user text into HTML strings assigned toinnerHTML.upload-pages-artifactwas pointed at the repository root instead of a minimal static bundle.Fix and validation
escapeHtml()and applied it beforeinnerHTMLwrites in the affected tools; Markdown pipeline now escapes first, then applies the existing lightweight markdown transforms.index.htmlinto_site/and uploads_siteas 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 panelsfix(ci): ship only index.html in GitHub Pages artifact