Skip to content

fix: sanitize claim_id to prevent XSS in claim page HTML response#19

Open
ArshLabs wants to merge 1 commit intoc2siorg:mainfrom
ArshLabs:fix/xss-claim-id-html-response
Open

fix: sanitize claim_id to prevent XSS in claim page HTML response#19
ArshLabs wants to merge 1 commit intoc2siorg:mainfrom
ArshLabs:fix/xss-claim-id-html-response

Conversation

@ArshLabs
Copy link
Copy Markdown

Problem

In lensmint-public-server/server.js, claim_id from the request URL is interpolated directly into HTML strings returned to the browser with no sanitization:

res.send(`...<p>{claim_id}</p>...`)

A malicious actor could craft a URL with a claim ID containing <script> tags or other HTML, resulting in XSS on anyone who visits the claim page.

Fix

Added a minimal escapeHtml() utility function and applied it to all claim_id interpolations inside HTML template literals. Also escaped error.message in the error page response.

claim_id from the request path was interpolated directly into an HTML
string returned by the server with no escaping. A malicious claim ID
could inject arbitrary HTML or JavaScript into the page.

Added escapeHtml() utility and applied it to all claim_id interpolations
in HTML template literals.
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