SECURITY: escape quotes in tag description when rendering (#19731)

Co-authored-by: Daniel Waterworth <me@danielwaterworth.com>
This commit is contained in:
Alan Guo Xiang Tan 2023-01-05 08:51:16 +08:00 committed by GitHub
parent 9470ae7190
commit 66ab2d71ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import User from "discourse/models/user";
import { escapeExpression } from "discourse/lib/utilities";
import getURL from "discourse-common/lib/get-url";
import { helperContext } from "discourse-common/lib/helpers";
import { escape } from "pretty-text/sanitizer";
let _renderer = defaultRenderTag;
@ -44,7 +45,7 @@ export function defaultRenderTag(tag, params) {
href +
" data-tag-name=" +
tag +
(params.description ? ' title="' + params.description + '" ' : "") +
(params.description ? ' title="' + escape(params.description) + '" ' : "") +
" class='" +
classes.join(" ") +
"'>" +