Chore: remove pre tags from DOMPurify config (#68512)

This commit is contained in:
Kristian Bremberg 2023-05-16 22:53:37 +02:00 committed by GitHub
parent 25c55d74f1
commit 4ccaf801d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,13 +33,13 @@ const sanitizeTextPanelWhitelist = new xss.FilterXSS({
/**
* Return a sanitized string that is going to be rendered in the browser to prevent XSS attacks.
* Note that sanitized tags will be removed, such as "<script>".
* We don't allow form, pre, or input elements.
* We don't allow form or input elements.
*/
export function sanitize(unsanitizedString: string): string {
try {
return DOMPurify.sanitize(unsanitizedString, {
USE_PROFILES: { html: true },
FORBID_TAGS: ['form', 'input', 'pre'],
FORBID_TAGS: ['form', 'input'],
});
} catch (error) {
console.error('String could not be sanitized', unsanitizedString);