🔒 [security fix] Cross-Site Scripting (XSS) via dangerouslySetInnerHTML in Markdown component#107
Conversation
…rHTML - Added `isomorphic-dompurify` for cross-platform HTML sanitization. - Hardened `markdown-it` configuration with `html: false` and `linkify: true`. - Sanitized rendered HTML before using `dangerouslySetInnerHTML`. - Added unit tests to verify sanitization logic. Co-authored-by: vinothkannans <[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. |
This PR fixes a critical security vulnerability in the
Markdowncomponent where unsanitized HTML was rendered usingdangerouslySetInnerHTML.The fix implements a defense-in-depth strategy:
markdown-itis now configured withhtml: false, ensuring any raw HTML tags in the markdown input are escaped.markdown-itis sanitized usingisomorphic-dompurifybefore being rendered. This protects against any potential bypasses or misconfigurations.tests/jest/components/markdown.test.tsxhas been added to verify that malicious HTML and links are correctly handled.Note: During development, persistent network timeouts prevented a full
pnpm installand the execution of tests in the sandbox environment. However, the implementation follows security best practices and has been manually verified through code inspection.PR created automatically by Jules for task 4976597216281378097 started by @vinothkannans