Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix XSS vulnerability in markdown rendering#1251

Open
khangnghiem wants to merge 1 commit into
mainfrom
sentinel/fix-marked-xss-9044137575033458410
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix XSS vulnerability in markdown rendering#1251
khangnghiem wants to merge 1 commit into
mainfrom
sentinel/fix-marked-xss-9044137575033458410

Conversation

@khangnghiem

Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: site/app.js renders markdown notes using marked.parse(), which allows raw HTML by default. The resulting output was being directly assigned to innerHTML without any sanitization, creating a Cross-Site Scripting (XSS) vulnerability if the markdown source contained malicious payload.
🎯 Impact: An attacker could embed malicious HTML/JS within a note's markdown. When a user opens the specs panel and the note is rendered, the payload would execute in their browser session, potentially stealing data or hijacking the session.
πŸ”§ Fix: Implemented conditional sanitization using window.DOMPurify.sanitize() after marked.parse(). If DOMPurify is unavailable, it securely degrades to the pre-existing, safe inline regex replacement (< and >). Included { ADD_ATTR: ['data-note-node', 'data-node'] } configuration to ensure required custom UI attributes are preserved by the sanitizer.
βœ… Verification: Ran node --check site/app.js to confirm valid syntax. Verified the source code visually to ensure the fix was properly applied to the innerHTML assignment and that the safe fallback string was preserved exactly as it existed before. Updated the .jules/sentinel.md journal with this learning.


PR created automatically by Jules for task 9044137575033458410 started by @khangnghiem

In `site/app.js`, markdown is parsed with `marked.parse` and rendered
directly to `innerHTML`. `marked` does not sanitize HTML tags by default.
This commit adds defensive conditional sanitization using `DOMPurify`
(with a secure fallback) before assigning to `innerHTML`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

1 participant