Skip to content

🛡️ Sentinel: [HIGH] Fix XSS vulnerability in CitationAddModal#40

Open
aicoder2009 wants to merge 2 commits intomainfrom
sentinel/xss-citation-add-modal-5693787970315068428
Open

🛡️ Sentinel: [HIGH] Fix XSS vulnerability in CitationAddModal#40
aicoder2009 wants to merge 2 commits intomainfrom
sentinel/xss-citation-add-modal-5693787970315068428

Conversation

@aicoder2009
Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: The CitationAddModal component in src/components/wiki/citation-add-modal.tsx was rendering generatedCitation.html directly into a React <p> element using the dangerouslySetInnerHTML prop without prior validation or sanitization.
🎯 Impact: If a citation generator or external lookup API returned a maliciously crafted payload containing script tags or inline event handlers, an attacker could execute arbitrary JavaScript within a user's session, leading to potential Cross-Site Scripting (XSS).
🔧 Fix: Imported isomorphic-dompurify (already an existing dependency) and wrapped generatedCitation.html with DOMPurify.sanitize() prior to rendering. This guarantees that potentially harmful HTML is stripped while preserving expected presentation tags.
✅ Verification: Executed pnpm lint, pnpm test, and pnpm build to confirm the change mitigates the issue and causes no regressions or typing errors. Verified that package.json lockfiles and workspace were clean from scratchpad files.


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

- Added `DOMPurify.sanitize()` using `isomorphic-dompurify` to `dangerouslySetInnerHTML` in `src/components/wiki/citation-add-modal.tsx`.
- This mitigates a potential Cross-Site Scripting (XSS) vulnerability where dynamically generated citations were rendered without sanitization.

Co-authored-by: aicoder2009 <127642633+aicoder2009@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 13:04
@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 29, 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:14pm

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

Mitigates an XSS risk in CitationAddModal by sanitizing generated citation HTML before rendering it in the preview.

Changes:

  • Add isomorphic-dompurify import to the modal component.
  • Sanitize generatedCitation.html with DOMPurify.sanitize() before passing it to dangerouslySetInnerHTML.

💡 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