Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix XSS vulnerabilities in event previews#901

Closed
kevinaboos wants to merge 1 commit into
mainfrom
sentinel/fix-xss-event-previews-175853728165591768
Closed

πŸ›‘οΈ Sentinel: [HIGH] Fix XSS vulnerabilities in event previews#901
kevinaboos wants to merge 1 commit into
mainfrom
sentinel/fix-xss-event-previews-175853728165591768

Conversation

@kevinaboos
Copy link
Copy Markdown
Member

🚨 Severity: HIGH
πŸ’‘ Vulnerability: User-controlled fields in event previews (such as room aliases, custom guest access rules, and custom join rules) were injected directly into the HTML preview strings without escaping, creating a Cross-Site Scripting (XSS) vulnerability.
🎯 Impact: An attacker could inject malicious HTML or disrupt the UI layout of users viewing the event previews, potentially executing arbitrary actions within the client context.
πŸ”§ Fix: Wrapped the user-controlled inputs with htmlize::escape_text inside text_preview_of_other_state in src/event_preview.rs whenever format_as_html is true. Used Cow::Owned(htmlize::escape_text(custom.as_str()).into_owned()) to maintain type compatibility in match arms.
βœ… Verification: Ran cargo check and cargo test event_preview to ensure the escaping logic compiles correctly and resolves the type mismatch errors.


PR created automatically by Jules for task 175853728165591768 started by @kevinaboos

When `format_as_html` is true in `text_preview_of_other_state`,
various user-controlled fields such as room aliases, canonical alias,
guest access custom strings, and join rules custom strings were being
rendered without HTML escaping. This commit adds `htmlize::escape_text`
to securely sanitize these values before rendering.

Co-authored-by: kevinaboos <1139460+kevinaboos@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.

@kevinaboos kevinaboos closed this Jun 3, 2026
@kevinaboos kevinaboos deleted the sentinel/fix-xss-event-previews-175853728165591768 branch June 3, 2026 04:56
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