dompurify 2.5.4 → 2.5.5
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 +2 -2
- package/dist/purify.cjs.js +4 -57
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.js +4 -57
- package/dist/purify.es.js.map +1 -1
- package/dist/purify.js +4 -57
- 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 +1 -1
package/dist/purify.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 2.5.
|
|
1
|
+
/*! @license DOMPurify 2.5.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.5/LICENSE */
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
@@ -110,10 +110,6 @@ var stringIndexOf = unapply(String.prototype.indexOf);
|
|
|
110
110
|
var stringTrim = unapply(String.prototype.trim);
|
|
111
111
|
var regExpTest = unapply(RegExp.prototype.test);
|
|
112
112
|
var typeErrorCreate = unconstruct(TypeError);
|
|
113
|
-
function numberIsNaN(x) {
|
|
114
|
-
// eslint-disable-next-line unicorn/prefer-number-properties
|
|
115
|
-
return typeof x === 'number' && isNaN(x);
|
|
116
|
-
}
|
|
117
113
|
function unapply(func) {
|
|
118
114
|
return function (thisArg) {
|
|
119
115
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -285,7 +281,7 @@ function createDOMPurify() {
|
|
|
285
281
|
* Version label, exposed for easier checks
|
|
286
282
|
* if DOMPurify is up to date or not
|
|
287
283
|
*/
|
|
288
|
-
DOMPurify.version = '2.5.
|
|
284
|
+
DOMPurify.version = '2.5.5';
|
|
289
285
|
|
|
290
286
|
/**
|
|
291
287
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -511,9 +507,6 @@ function createDOMPurify() {
|
|
|
511
507
|
/* Keep a reference to config to pass to hooks */
|
|
512
508
|
var CONFIG = null;
|
|
513
509
|
|
|
514
|
-
/* Specify the maximum element nesting depth to prevent mXSS */
|
|
515
|
-
var MAX_NESTING_DEPTH = 255;
|
|
516
|
-
|
|
517
510
|
/* Ideally, do not touch anything below this line */
|
|
518
511
|
/* ______________________________________________ */
|
|
519
512
|
|
|
@@ -908,7 +901,7 @@ function createDOMPurify() {
|
|
|
908
901
|
* @return {Boolean} true if clobbered, false if safe
|
|
909
902
|
*/
|
|
910
903
|
var _isClobbered = function _isClobbered(elm) {
|
|
911
|
-
return elm instanceof HTMLFormElement && (typeof elm.
|
|
904
|
+
return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
|
|
912
905
|
};
|
|
913
906
|
|
|
914
907
|
/**
|
|
@@ -1067,7 +1060,7 @@ function createDOMPurify() {
|
|
|
1067
1060
|
// eslint-disable-next-line complexity
|
|
1068
1061
|
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1069
1062
|
/* Make sure attribute cannot clobber */
|
|
1070
|
-
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement
|
|
1063
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1071
1064
|
return false;
|
|
1072
1065
|
}
|
|
1073
1066
|
|
|
@@ -1256,32 +1249,9 @@ function createDOMPurify() {
|
|
|
1256
1249
|
if (_sanitizeElements(shadowNode)) {
|
|
1257
1250
|
continue;
|
|
1258
1251
|
}
|
|
1259
|
-
var parentNode = getParentNode(shadowNode);
|
|
1260
|
-
|
|
1261
|
-
/* Set the nesting depth of an element */
|
|
1262
|
-
if (shadowNode.nodeType === 1) {
|
|
1263
|
-
if (parentNode && parentNode.__depth) {
|
|
1264
|
-
/*
|
|
1265
|
-
We want the depth of the node in the original tree, which can
|
|
1266
|
-
change when it's removed from its parent.
|
|
1267
|
-
*/
|
|
1268
|
-
shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1269
|
-
} else {
|
|
1270
|
-
shadowNode.__depth = 1;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
/*
|
|
1275
|
-
* Remove an element if nested too deeply to avoid mXSS
|
|
1276
|
-
* or if the __depth might have been tampered with
|
|
1277
|
-
*/
|
|
1278
|
-
if (shadowNode.__depth >= MAX_NESTING_DEPTH || numberIsNaN(shadowNode.__depth)) {
|
|
1279
|
-
_forceRemove(shadowNode);
|
|
1280
|
-
}
|
|
1281
1252
|
|
|
1282
1253
|
/* Deep shadow DOM detected */
|
|
1283
1254
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
1284
|
-
shadowNode.content.__depth = shadowNode.__depth;
|
|
1285
1255
|
_sanitizeShadowDOM(shadowNode.content);
|
|
1286
1256
|
}
|
|
1287
1257
|
|
|
@@ -1411,32 +1381,9 @@ function createDOMPurify() {
|
|
|
1411
1381
|
if (_sanitizeElements(currentNode)) {
|
|
1412
1382
|
continue;
|
|
1413
1383
|
}
|
|
1414
|
-
var parentNode = getParentNode(currentNode);
|
|
1415
|
-
|
|
1416
|
-
/* Set the nesting depth of an element */
|
|
1417
|
-
if (currentNode.nodeType === 1) {
|
|
1418
|
-
if (parentNode && parentNode.__depth) {
|
|
1419
|
-
/*
|
|
1420
|
-
We want the depth of the node in the original tree, which can
|
|
1421
|
-
change when it's removed from its parent.
|
|
1422
|
-
*/
|
|
1423
|
-
currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1424
|
-
} else {
|
|
1425
|
-
currentNode.__depth = 1;
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
/*
|
|
1430
|
-
* Remove an element if nested too deeply to avoid mXSS
|
|
1431
|
-
* or if the __depth might have been tampered with
|
|
1432
|
-
*/
|
|
1433
|
-
if (currentNode.__depth >= MAX_NESTING_DEPTH || numberIsNaN(currentNode.__depth)) {
|
|
1434
|
-
_forceRemove(currentNode);
|
|
1435
|
-
}
|
|
1436
1384
|
|
|
1437
1385
|
/* Shadow DOM detected, sanitize it */
|
|
1438
1386
|
if (currentNode.content instanceof DocumentFragment) {
|
|
1439
|
-
currentNode.content.__depth = currentNode.__depth;
|
|
1440
1387
|
_sanitizeShadowDOM(currentNode.content);
|
|
1441
1388
|
}
|
|
1442
1389
|
|