Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

use a proper HTML sanitizer to strip <mx-reply>, rather than a regexp #5006

Merged
merged 2 commits into from
Jul 16, 2020
Merged

use a proper HTML sanitizer to strip <mx-reply>, rather than a regexp #5006

merged 2 commits into from
Jul 16, 2020

Conversation

uhoreg
Copy link
Member

@uhoreg uhoreg commented Jul 16, 2020

Also, always sanitize the HTML before constructing a reply.

@uhoreg uhoreg requested a review from a team July 16, 2020 21:51
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// We also run a nl2br over the result to fix the fallback representation. We do this
// after converting the text to safe HTML to avoid user-provided BR's from being converted.
if (!html) html = escapeHtml(body).replace(/\n/g, '<br/>');
if (html) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also check that the format is present and set to org.matrix.custom.html? Else the reply fallback is potentially created off of the wrong attribute

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants