🛡️ Sentinel: [HIGH] Fix XSS vulnerability in Markdown rendering - #6
Conversation
The `ContentMarkdown` component parsed markdown using `marked` and directly injected the HTML into the DOM via `innerHTML` without sanitization. This allows `<script>` or `javascript:` links to execute arbitrary JavaScript (XSS). This change imports `DOMPurify` from `isomorphic-dompurify` and uses it to sanitize the parsed HTML before it is returned and set to `innerHTML`. Co-authored-by: ddqd <[email protected]>
|
👋 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. |
🚨 Severity: HIGH
💡 Vulnerability: The
ContentMarkdowncomponent parsed markdown usingmarkedand directly injected the HTML into the DOM viainnerHTMLwithout sanitization. This allows<script>orjavascript:links to execute arbitrary JavaScript (XSS).🎯 Impact: Attackers could inject malicious scripts into markdown content that is rendered by the
ContentMarkdowncomponent, potentially leading to unauthorized actions, data theft, or other malicious activities.🔧 Fix: Imported
DOMPurifyfromisomorphic-dompurifyand used it to sanitize the parsed HTML before it is returned and set toinnerHTML.✅ Verification: Ran
bun run build --cwd packages/webto ensure the project builds successfully and the fix is correctly integrated.PR created automatically by Jules for task 9604236094746019714 started by @ddqd