fix(editor): Render sanitized HTML content in toast messages (#12139)

This commit is contained in:
Csaba Tuncsik
2024-12-11 10:11:51 +01:00
committed by GitHub
parent ed359586c8
commit 0468945c99
12 changed files with 71 additions and 56 deletions

View File

@@ -18,8 +18,8 @@ export function sanitizeHtml(dirtyHtml: string) {
}
if (ALLOWED_HTML_ATTRIBUTES.includes(name) || name.startsWith('data-')) {
// href is allowed but we need to sanitize certain protocols
if (name === 'href' && !value.match(/^https?:\/\//gm)) {
// href is allowed but we allow only https and relative URLs
if (name === 'href' && !value.match(/^https?:\/\//gm) && !value.startsWith('/')) {
return '';
}
return `${name}="${escapeAttrValue(value)}"`;