π‘οΈ Sentinel: [HIGH] Fix XSS vulnerability in Markdown rendering#1243
π‘οΈ Sentinel: [HIGH] Fix XSS vulnerability in Markdown rendering#1243khangnghiem wants to merge 1 commit into
Conversation
Ensures that the HTML output of `marked.parse` is sanitized via DOMPurify before being inserted into the DOM. Prevents failing open by safely escaping the text when DOMPurify is unavailable. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
π¨ Severity: HIGH
π‘ Vulnerability: The output of
marked.parseinsite/app.jswas directly interpolated intoinnerHTMLwithout sanitization. Ifwindow.DOMPurifywas unavailable, it failed open by rendering the unsanitized HTML.π― Impact: An attacker could inject malicious scripts or HTML through user-provided Markdown content in notes or other rendered inputs, leading to Cross-Site Scripting (XSS).
π§ Fix: Sanitized the output of
marked.parse(processedNote)usingwindow.DOMPurify.sanitize(allowing specific attributes likedata-note-node). Implemented a secure fallback that regex-escapes HTML entities ifDOMPurifyis unavailable.β Verification: Ran
node --check site/app.jsto confirm no syntax errors were introduced. Ran all tests viapnpm lintandpnpm testin thefd-vscodeworkspace to ensure no regressions. Reviewed the fallback implementation to confirm it does not fail open.PR created automatically by Jules for task 15003678215010760968 started by @khangnghiem