Skip to content

fix: replace innerHTML with textContent and fix NotificationDropdown spread order - #814

Open
saurabhhhcodes wants to merge 2 commits into
Aditya948351:masterfrom
saurabhhhcodes:fix/DevPath-Web-batch-1
Open

fix: replace innerHTML with textContent and fix NotificationDropdown spread order#814
saurabhhhcodes wants to merge 2 commits into
Aditya948351:masterfrom
saurabhhhcodes:fix/DevPath-Web-batch-1

Conversation

@saurabhhhcodes

Copy link
Copy Markdown
Contributor

Fixes

1. innerHTML to textContent (wiki/page.tsx)

Bug: button.innerHTML = "Copy" and button.innerHTML = "Copied!" directly manipulate DOM in a React component — this causes hydration mismatches and is an XSS vector even for innocuous text.

Fix: Replace innerHTML assignments with textContent, which safely sets text without parsing HTML.

2. Notification Spread Override (NotificationDropdown.tsx)

Bug: { id: doc.id, ...doc.data() } can silently override the Firestore document id if doc.data() happens to contain an id field (e.g., a user-visible notification ID).

Fix: Place id: doc.id after the spread so doc.data() fields cannot clobber the canonical document identifier.

Saurabh Kumar Bajpai added 2 commits July 19, 2026 22:45
…spread order

- wiki/page.tsx: use textContent instead of innerHTML for the copy button
  to avoid XSS vectors, hydration mismatches, and DOM manipulation
  anti-patterns in React
- NotificationDropdown.tsx: place id after the spread so doc.data() fields
  cannot override the Firestore document id
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