Skip to content

Fix XSS vulnerability in activity card rendering - #3

Merged
pmca31 merged 4 commits into
accelerate-with-copilotfrom
copilot/sub-pr-2
Feb 10, 2026
Merged

Fix XSS vulnerability in activity card rendering#3
pmca31 merged 4 commits into
accelerate-with-copilotfrom
copilot/sub-pr-2

Conversation

Copilot AI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Addresses XSS vulnerability where activity names, descriptions, and participant emails were interpolated directly into HTML via innerHTML, allowing potential script injection.

Changes

Replaced innerHTML with DOM API methods

  • Used createElement(), textContent, and createTextNode() to construct activity cards
  • Eliminated all template literal HTML string interpolation
  • User-controlled data now rendered as text nodes, preventing HTML/JS execution

Removed data attributes in favor of closures

  • Event handlers now capture activity/email data via closures instead of storing in DOM attributes
  • Eliminates potential attribute injection vectors

Enhanced accessibility

  • Added role="button", aria-label, and tabindex="0" to delete icons
  • Implemented keyboard support (Enter/Space) for delete actions

Example

Before:

activityCard.innerHTML = `
  <h4>${name}</h4>
  <p>${details.description}</p>
  <span data-email="${email}">🗑️</span>
`;

After:

const title = document.createElement("h4");
title.textContent = name;
activityCard.appendChild(title);

const description = document.createElement("p");
description.textContent = details.description;
activityCard.appendChild(description);

Screenshot

UI after XSS fix

CodeQL: 0 alerts


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 10, 2026 16:59
Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from review on "Accelerate with copilot" PR Fix XSS vulnerability in activity card rendering Feb 10, 2026
Copilot AI requested a review from pmca31 February 10, 2026 17:03
@pmca31
pmca31 marked this pull request as ready for review February 10, 2026 17:04
@pmca31
pmca31 merged commit 157cd33 into accelerate-with-copilot Feb 10, 2026
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.

2 participants