Skip to content

🛡️ Sentinel: [HIGH] Fix XSS vulnerability in citation add modal#24

Open
aicoder2009 wants to merge 2 commits intomainfrom
fix-xss-citation-modal-9143635708794283471
Open

🛡️ Sentinel: [HIGH] Fix XSS vulnerability in citation add modal#24
aicoder2009 wants to merge 2 commits intomainfrom
fix-xss-citation-modal-9143635708794283471

Conversation

@aicoder2009
Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: Cross-Site Scripting (XSS) was possible because dangerouslySetInnerHTML was rendering dynamically generated HTML without sanitizing it first in the CitationAddModal.
🎯 Impact: If an attacker crafted a malicious URL, DOI, or manual citation that returned malicious script tags in the generated HTML, it would execute in the user's browser, potentially leading to session hijacking, data theft, or unauthorized actions.
🔧 Fix: Imported DOMPurify from isomorphic-dompurify and used DOMPurify.sanitize(generatedCitation.html) to strip any potentially dangerous script tags before it is rendered to the DOM, effectively preventing the XSS payload from executing. This matches the patterns already used in other components like SortableCitation.
Verification:

  1. Ran pnpm lint and pnpm test:run - all pass.
  2. Verified that DOMPurify.sanitize() is correctly applied in dangerouslySetInnerHTML.

PR created automatically by Jules for task 9143635708794283471 started by @aicoder2009

Sanitized the generated citation HTML in `src/components/wiki/citation-add-modal.tsx`
using `isomorphic-dompurify` before passing it to `dangerouslySetInnerHTML`.
This prevents a Cross-Site Scripting (XSS) vulnerability.

Co-authored-by: aicoder2009 <[email protected]>
Copilot AI review requested due to automatic review settings April 27, 2026 06:40
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opencitation Ready Ready Preview, Comment May 1, 2026 6:27pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a high-severity XSS risk in the wiki “Add Citation” modal by sanitizing dynamically generated citation HTML before rendering it via dangerouslySetInnerHTML, aligning the modal’s behavior with existing sanitization patterns used elsewhere in the app.

Changes:

  • Add isomorphic-dompurify usage to sanitize generatedCitation.html before rendering in CitationAddModal.
  • Update .jules/sentinel.md to document the vulnerability and the prevention approach.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/components/wiki/citation-add-modal.tsx Sanitizes the citation preview HTML with DOMPurify before injecting into the DOM.
.jules/sentinel.md Updates internal security log entry describing the issue and prevention guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aicoder2009 aicoder2009 closed this May 1, 2026
@aicoder2009 aicoder2009 reopened this May 1, 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