Skip to content

Chat AI bubble uses unsanitized innerHTML #505

Closed

Description

@diksha78dev

chat.js renderTextContent sets innerHTML for Elara messages. Sanitize (e.g. DOMPurify allowlist strong, em, br) or build DOM nodes to reduce XSS risk from AI/proxy responses.


Assign to me: @devanshi14malhotra

Activity

  1. vaanni47 commented on May 14, 2026

    @vaanni47

    pls assign this to me under gssoc

    I’ll be fortifying our security by refactoring the renderTextContent function in chat.js to eliminate the risks associated with setting raw innerHTML. To mitigate potential XSS vulnerabilities from AI or proxy responses, I plan to implement a strict sanitization layer using a library like DOMPurify with a minimal allowlist for safe tags like strong, em, and br.

  2. aishwaryagangaraj-web commented on May 15, 2026

    @aishwaryagangaraj-web
    Contributor

    Hi @diksha78dev, I went through the issue and understand the XSS risk in chat.js due to unsafe innerHTML usage.

    I would like to contribute by refactoring the renderTextContent function. My approach would be:

    Replace unsafe innerHTML usage with DOMPurify sanitization (allowing only safe tags like strong, em, br)
    Or refactor to use DOM-based rendering to fully avoid HTML injection risks

    I will start implementing this and raise a PR soon. Please let me know if I can proceed.

  3. diksha78dev commented on May 15, 2026

    @diksha78dev
    ContributorAuthor

    @aishwaryagangaraj-web I have asked for the issue assignment to me
    You can explore the codebase and raise new issues

  4. aishwaryagangaraj-web commented on May 15, 2026

    @aishwaryagangaraj-web
    Contributor

    Got it, thanks for the clarification. I’ll look for another open issue and contribute there.

  5. added
    level:advancedGSSoC'26 advanced level PR/issue
    GSSoC'26For all issues/PRs related to GSSoC'2026 open source event
    NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source event
    level:intermediateGSSoC'26 intermediate level PR/issue
    and removed
    level:advancedGSSoC'26 advanced level PR/issue
    on May 15, 2026
  6. added a commit that references this issue on May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GSSoC'26For all issues/PRs related to GSSoC'2026 open source eventNSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source eventlevel310 pointslevel:intermediateGSSoC'26 intermediate level PR/issue

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions