dompurify 2.5.3 → 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 -54
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.js +4 -54
- package/dist/purify.es.js.map +1 -1
- package/dist/purify.js +4 -54
- 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.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 (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
var stringTrim = unapply(String.prototype.trim);
|
|
117
117
|
var regExpTest = unapply(RegExp.prototype.test);
|
|
118
118
|
var typeErrorCreate = unconstruct(TypeError);
|
|
119
|
-
var numberIsNaN = unapply(Number.isNaN);
|
|
120
119
|
function unapply(func) {
|
|
121
120
|
return function (thisArg) {
|
|
122
121
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -288,7 +287,7 @@
|
|
|
288
287
|
* Version label, exposed for easier checks
|
|
289
288
|
* if DOMPurify is up to date or not
|
|
290
289
|
*/
|
|
291
|
-
DOMPurify.version = '2.5.
|
|
290
|
+
DOMPurify.version = '2.5.5';
|
|
292
291
|
|
|
293
292
|
/**
|
|
294
293
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -514,9 +513,6 @@
|
|
|
514
513
|
/* Keep a reference to config to pass to hooks */
|
|
515
514
|
var CONFIG = null;
|
|
516
515
|
|
|
517
|
-
/* Specify the maximum element nesting depth to prevent mXSS */
|
|
518
|
-
var MAX_NESTING_DEPTH = 255;
|
|
519
|
-
|
|
520
516
|
/* Ideally, do not touch anything below this line */
|
|
521
517
|
/* ______________________________________________ */
|
|
522
518
|
|
|
@@ -911,7 +907,7 @@
|
|
|
911
907
|
* @return {Boolean} true if clobbered, false if safe
|
|
912
908
|
*/
|
|
913
909
|
var _isClobbered = function _isClobbered(elm) {
|
|
914
|
-
return elm instanceof HTMLFormElement && (typeof elm.
|
|
910
|
+
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');
|
|
915
911
|
};
|
|
916
912
|
|
|
917
913
|
/**
|
|
@@ -1070,7 +1066,7 @@
|
|
|
1070
1066
|
// eslint-disable-next-line complexity
|
|
1071
1067
|
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1072
1068
|
/* Make sure attribute cannot clobber */
|
|
1073
|
-
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement
|
|
1069
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1074
1070
|
return false;
|
|
1075
1071
|
}
|
|
1076
1072
|
|
|
@@ -1259,32 +1255,9 @@
|
|
|
1259
1255
|
if (_sanitizeElements(shadowNode)) {
|
|
1260
1256
|
continue;
|
|
1261
1257
|
}
|
|
1262
|
-
var parentNode = getParentNode(shadowNode);
|
|
1263
|
-
|
|
1264
|
-
/* Set the nesting depth of an element */
|
|
1265
|
-
if (shadowNode.nodeType === 1) {
|
|
1266
|
-
if (parentNode && parentNode.__depth) {
|
|
1267
|
-
/*
|
|
1268
|
-
We want the depth of the node in the original tree, which can
|
|
1269
|
-
change when it's removed from its parent.
|
|
1270
|
-
*/
|
|
1271
|
-
shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1272
|
-
} else {
|
|
1273
|
-
shadowNode.__depth = 1;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
/*
|
|
1278
|
-
* Remove an element if nested too deeply to avoid mXSS
|
|
1279
|
-
* or if the __depth might have been tampered with
|
|
1280
|
-
*/
|
|
1281
|
-
if (shadowNode.__depth >= MAX_NESTING_DEPTH || numberIsNaN(shadowNode.__depth)) {
|
|
1282
|
-
_forceRemove(shadowNode);
|
|
1283
|
-
}
|
|
1284
1258
|
|
|
1285
1259
|
/* Deep shadow DOM detected */
|
|
1286
1260
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
1287
|
-
shadowNode.content.__depth = shadowNode.__depth;
|
|
1288
1261
|
_sanitizeShadowDOM(shadowNode.content);
|
|
1289
1262
|
}
|
|
1290
1263
|
|
|
@@ -1414,32 +1387,9 @@
|
|
|
1414
1387
|
if (_sanitizeElements(currentNode)) {
|
|
1415
1388
|
continue;
|
|
1416
1389
|
}
|
|
1417
|
-
var parentNode = getParentNode(currentNode);
|
|
1418
|
-
|
|
1419
|
-
/* Set the nesting depth of an element */
|
|
1420
|
-
if (currentNode.nodeType === 1) {
|
|
1421
|
-
if (parentNode && parentNode.__depth) {
|
|
1422
|
-
/*
|
|
1423
|
-
We want the depth of the node in the original tree, which can
|
|
1424
|
-
change when it's removed from its parent.
|
|
1425
|
-
*/
|
|
1426
|
-
currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1427
|
-
} else {
|
|
1428
|
-
currentNode.__depth = 1;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/*
|
|
1433
|
-
* Remove an element if nested too deeply to avoid mXSS
|
|
1434
|
-
* or if the __depth might have been tampered with
|
|
1435
|
-
*/
|
|
1436
|
-
if (currentNode.__depth >= MAX_NESTING_DEPTH || numberIsNaN(currentNode.__depth)) {
|
|
1437
|
-
_forceRemove(currentNode);
|
|
1438
|
-
}
|
|
1439
1390
|
|
|
1440
1391
|
/* Shadow DOM detected, sanitize it */
|
|
1441
1392
|
if (currentNode.content instanceof DocumentFragment) {
|
|
1442
|
-
currentNode.content.__depth = currentNode.__depth;
|
|
1443
1393
|
_sanitizeShadowDOM(currentNode.content);
|
|
1444
1394
|
}
|
|
1445
1395
|
|