π‘οΈ Sentinel: [HIGH] Fix XSS vulnerabilities in event previews#901
π‘οΈ Sentinel: [HIGH] Fix XSS vulnerabilities in event previews#901kevinaboos wants to merge 1 commit into
Conversation
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>
|
π 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: 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_textinsidetext_preview_of_other_stateinsrc/event_preview.rswheneverformat_as_htmlis true. UsedCow::Owned(htmlize::escape_text(custom.as_str()).into_owned())to maintain type compatibility in match arms.β Verification: Ran
cargo checkandcargo test event_previewto ensure the escaping logic compiles correctly and resolves the type mismatch errors.PR created automatically by Jules for task 175853728165591768 started by @kevinaboos