Update DOMPurify to version 3.0.10 in web UI

This commit is contained in:
Théophile Diot 2024-03-19 12:42:55 +00:00
parent e257ececf7
commit ab921f06e1
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
4 changed files with 10 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
/*! @license DOMPurify VERSION | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/VERSION/LICENSE */

View file

@ -162,6 +162,7 @@ function createDOMPurify(window = getGlobal()) {
ARIA_ATTR,
IS_SCRIPT_OR_DATA,
ATTR_WHITESPACE,
CUSTOM_ELEMENT,
} = EXPRESSIONS;
let { IS_ALLOWED_URI } = EXPRESSIONS;
@ -909,7 +910,10 @@ function createDOMPurify(window = getGlobal()) {
root.ownerDocument || root,
root,
// eslint-disable-next-line no-bitwise
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
NodeFilter.SHOW_ELEMENT |
NodeFilter.SHOW_COMMENT |
NodeFilter.SHOW_TEXT |
NodeFilter.SHOW_PROCESSING_INSTRUCTION,
null
);
};
@ -1189,7 +1193,7 @@ function createDOMPurify(window = getGlobal()) {
* @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
*/
const _isBasicCustomElement = function (tagName) {
return tagName !== 'annotation-xml' && tagName.indexOf('-') > 0;
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
};
/**

View file

@ -14,3 +14,4 @@ export const ATTR_WHITESPACE = seal(
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
);
export const DOCTYPE_NAME = seal(/^html$/i);
export const CUSTOM_ELEMENT = seal(/^[a-z][a-z\d]*(-[a-z\d]+)+$/i);