dompurify 3.1.5 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/purify.cjs.js +15 -16
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.mjs +15 -16
- package/dist/purify.es.mjs.map +1 -1
- package/dist/purify.js +15 -16
- package/dist/purify.js.map +1 -1
- package/dist/purify.min.js +2 -2
- package/dist/purify.min.js.map +1 -1
- package/package.json +2 -1
package/dist/purify.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.1.
|
|
1
|
+
/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
const text = freeze(['#text']);
|
|
204
204
|
|
|
205
205
|
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
206
|
-
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
206
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
207
207
|
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
208
208
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
209
209
|
|
|
@@ -215,11 +215,9 @@
|
|
|
215
215
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
216
216
|
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
217
217
|
);
|
|
218
|
-
|
|
219
218
|
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
220
219
|
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
221
220
|
);
|
|
222
|
-
|
|
223
221
|
const DOCTYPE_NAME = seal(/^html$/i);
|
|
224
222
|
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
225
223
|
|
|
@@ -254,7 +252,6 @@
|
|
|
254
252
|
documentFragment: 11,
|
|
255
253
|
notation: 12 // Deprecated
|
|
256
254
|
};
|
|
257
|
-
|
|
258
255
|
const getGlobal = function getGlobal() {
|
|
259
256
|
return typeof window === 'undefined' ? null : window;
|
|
260
257
|
};
|
|
@@ -306,7 +303,7 @@
|
|
|
306
303
|
* Version label, exposed for easier checks
|
|
307
304
|
* if DOMPurify is up to date or not
|
|
308
305
|
*/
|
|
309
|
-
DOMPurify.version = '3.1.
|
|
306
|
+
DOMPurify.version = '3.1.7';
|
|
310
307
|
|
|
311
308
|
/**
|
|
312
309
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -337,6 +334,7 @@
|
|
|
337
334
|
} = window;
|
|
338
335
|
const ElementPrototype = Element.prototype;
|
|
339
336
|
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
337
|
+
const remove = lookupGetter(ElementPrototype, 'remove');
|
|
340
338
|
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
341
339
|
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
342
340
|
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
@@ -725,7 +723,7 @@
|
|
|
725
723
|
CONFIG = cfg;
|
|
726
724
|
};
|
|
727
725
|
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
728
|
-
const HTML_INTEGRATION_POINTS = addToSet({}, ['
|
|
726
|
+
const HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
|
|
729
727
|
|
|
730
728
|
// Certain elements are allowed in both SVG and HTML
|
|
731
729
|
// namespace. We need to specify them explicitly
|
|
@@ -837,9 +835,9 @@
|
|
|
837
835
|
});
|
|
838
836
|
try {
|
|
839
837
|
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
840
|
-
node.
|
|
838
|
+
getParentNode(node).removeChild(node);
|
|
841
839
|
} catch (_) {
|
|
842
|
-
|
|
840
|
+
remove(node);
|
|
843
841
|
}
|
|
844
842
|
};
|
|
845
843
|
|
|
@@ -1016,7 +1014,7 @@
|
|
|
1016
1014
|
return true;
|
|
1017
1015
|
}
|
|
1018
1016
|
|
|
1019
|
-
/* Remove any
|
|
1017
|
+
/* Remove any occurrence of processing instructions */
|
|
1020
1018
|
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
1021
1019
|
_forceRemove(currentNode);
|
|
1022
1020
|
return true;
|
|
@@ -1185,6 +1183,7 @@
|
|
|
1185
1183
|
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
1186
1184
|
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
1187
1185
|
value = hookEvent.attrValue;
|
|
1186
|
+
|
|
1188
1187
|
/* Did the hooks approve of the attribute? */
|
|
1189
1188
|
if (hookEvent.forceKeepAttr) {
|
|
1190
1189
|
continue;
|
|
@@ -1204,12 +1203,6 @@
|
|
|
1204
1203
|
continue;
|
|
1205
1204
|
}
|
|
1206
1205
|
|
|
1207
|
-
/* Work around a security issue with comments inside attributes */
|
|
1208
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1209
|
-
_removeAttribute(name, currentNode);
|
|
1210
|
-
continue;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1206
|
/* Sanitize attribute content to be template-safe */
|
|
1214
1207
|
if (SAFE_FOR_TEMPLATES) {
|
|
1215
1208
|
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
@@ -1234,6 +1227,12 @@
|
|
|
1234
1227
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1235
1228
|
}
|
|
1236
1229
|
|
|
1230
|
+
/* Work around a security issue with comments inside attributes */
|
|
1231
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1232
|
+
_removeAttribute(name, currentNode);
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1237
1236
|
/* Handle attributes that require Trusted Types */
|
|
1238
1237
|
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
1239
1238
|
if (namespaceURI) ; else {
|