DOM.purify toast if HTML is allowed

25d8286dfcb77f16608d505b980e48c04a07376b

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +5 -0Showing whitespace changes
public/scripts/slash-commands.js+5 -0
@@ -2251,6 +2251,11 @@ async function echoCallback(args, value) {
22512251 }
22522252 }
22532253
2254+ // If we allow HTML, we need to sanitize it to prevent security risks
2255+ if (!options.escapeHtml) {
2256+ value = DOMPurify.sanitize(value, { FORBID_TAGS: ['style'] });
2257+ }
2258+
22542259 let toast;
22552260 switch (severity) {
22562261 case 'error':