🛡️ Sentinel: [HIGH] Fix XSS vulnerability in CitationAddModal#40
🛡️ Sentinel: [HIGH] Fix XSS vulnerability in CitationAddModal#40aicoder2009 wants to merge 2 commits intomainfrom
Conversation
- 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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Mitigates an XSS risk in CitationAddModal by sanitizing generated citation HTML before rendering it in the preview.
Changes:
- Add
isomorphic-dompurifyimport to the modal component. - Sanitize
generatedCitation.htmlwithDOMPurify.sanitize()before passing it todangerouslySetInnerHTML.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🚨 Severity: HIGH
💡 Vulnerability: The
CitationAddModalcomponent insrc/components/wiki/citation-add-modal.tsxwas renderinggeneratedCitation.htmldirectly into a React<p>element using thedangerouslySetInnerHTMLprop 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 wrappedgeneratedCitation.htmlwithDOMPurify.sanitize()prior to rendering. This guarantees that potentially harmful HTML is stripped while preserving expected presentation tags.✅ Verification: Executed
pnpm lint,pnpm test, andpnpm buildto confirm the change mitigates the issue and causes no regressions or typing errors. Verified thatpackage.jsonlockfiles and workspace were clean from scratchpad files.PR created automatically by Jules for task 5693787970315068428 started by @aicoder2009