Skip to content

Fix/issue 2343 dom x ss search#2349

Merged
janavipandole merged 6 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2343-dom-xSS-search
Jun 20, 2026
Merged

Fix/issue 2343 dom x ss search#2349
janavipandole merged 6 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2343-dom-xSS-search

Conversation

@Prateek2007-cmd

Copy link
Copy Markdown
Contributor

Description

Resolves Issue #2343 (Severe DOM-based XSS in Search History).

A static analysis of the frontend codebase uncovered a critical DOM-based Cross-Site Scripting (XSS) vulnerability in shop.html. The "Recent Searches" UI component was extracting unsanitized user input from localStorage and evaluating it directly via .innerHTML, while simultaneously injecting it into an inline onclick handler. This allowed arbitrary JavaScript execution if a malicious payload entered the search history.

This PR remediates the vulnerability by shifting from string-based DOM injection to secure DOM Node API manipulation.

Changes Made

  • XSS Prevention: Eliminated the .innerHTML map-and-join pattern. Replaced it with document.createElement and .textContent assignment to guarantee strict HTML entity escaping.
  • Event Listener Modernization: Stripped the vulnerable onclick='...' string injection and implemented secure event binding via .addEventListener("click", ...).

Type of Change

  • Critical Security Fix

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@Prateek2007-cmd is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

@janavipandole janavipandole merged commit da22fa8 into janavipandole:main Jun 20, 2026
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants