CVE-2022-39279 (JavaScript, published 2022-10-06T20:15Z)
Description: value: discourse-chat is a plugin for the Discourse message board which adds chat functionality. In versions prior to 0.9 some places render a chat channel's name and description in an unsafe way, allowing staff members to cause an cross site scripting (XSS) attack by inserting unsafe HTML into them. Version 0.9 has addressed this issue. Users are advised to upgrade. There are no known workarounds for this issue.
Severity: nan (CVSS v3 base score: 5.4)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/discourse/discourse-chat
Files changed:
assets/javascripts/discourse/components/chat-channel-archive-modal-inner.js
assets/javascripts/discourse/components/chat-channel-delete-modal-inner.js
assets/javascripts/discourse/components/chat-message-move-to-channel-modal-inner.js
assets/javascripts/discourse/initializers/chat-sidebar.js
assets/javascripts/discourse/models/chat-channel.js
assets/javascripts/discourse/templates/components/chat-channel-about-view.hbs
assets/javascripts/discourse/templates/components/chat-channel-card.hbs
assets/javascripts/discourse/templates/components/chat-channel-title.hbs
Commit message: SECURITY: Ensure channel name and description are always escaped. (#1280)



Vulnerable code:
import { escapeExpression } from "discourse/lib/utilities";
        channelTitle: escapeExpression(this.chatChannel.title),
import { escapeExpression } from "discourse/lib/utilities";
      escapeExpression(channelNameConfirmation).toLowerCase() !==
        this.escapedTitle.toLowerCase()
        name: this.escapedTitle,

  @discourseComputed()
  escapedTitle() {
    return escapeExpression(this.chatChannel.title);
  },
import { escapeExpression } from "discourse/lib/utilities";
        channelTitle: escapeExpression(this.sourceChannel.title),
                return escapeExpression(this.channel.title);
              return escapeExpression(this.channel.title);
        {{replace-emoji channel.title}}
        {{replace-emoji channel.title}}
        {{replace-emoji channel.description}}
        {{replace-emoji channel.title}}

Fixed code:
        channelTitle: this.chatChannel.escapedTitle,
      channelNameConfirmation.toLowerCase() !==
        this.chatChannel.title.toLowerCase()
        name: this.chatChannel.escapedTitle,
        channelTitle: this.sourceChannel.escapedTitle,
                return this.channel.escapedTitle;
              return this.channel.escapedTitle;
import { escapeExpression } from "discourse/lib/utilities";
  @computed("title")
  get escapedTitle() {
    return escapeExpression(this.title);
  }

  @computed("description")
  get escapedDescription() {
    return escapeExpression(this.description);
  }

        {{replace-emoji channel.escapedTitle}}
        {{replace-emoji channel.escapedTitle}}
        {{replace-emoji channel.escapedDescription}}
        {{replace-emoji channel.escapedTitle}}