dompurify 2.5.2 → 2.5.4
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 +28 -8
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.js +28 -8
- package/dist/purify.es.js.map +1 -1
- package/dist/purify.js +28 -8
- 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.4 | (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.4/LICENSE */
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
@@ -110,6 +110,10 @@ 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
|
+
}
|
|
113
117
|
function unapply(func) {
|
|
114
118
|
return function (thisArg) {
|
|
115
119
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -281,7 +285,7 @@ function createDOMPurify() {
|
|
|
281
285
|
* Version label, exposed for easier checks
|
|
282
286
|
* if DOMPurify is up to date or not
|
|
283
287
|
*/
|
|
284
|
-
DOMPurify.version = '2.5.
|
|
288
|
+
DOMPurify.version = '2.5.4';
|
|
285
289
|
|
|
286
290
|
/**
|
|
287
291
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -1063,7 +1067,7 @@ function createDOMPurify() {
|
|
|
1063
1067
|
// eslint-disable-next-line complexity
|
|
1064
1068
|
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1065
1069
|
/* Make sure attribute cannot clobber */
|
|
1066
|
-
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1070
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement || value === '__depth' || value === '__removalCount')) {
|
|
1067
1071
|
return false;
|
|
1068
1072
|
}
|
|
1069
1073
|
|
|
@@ -1165,6 +1169,12 @@ function createDOMPurify() {
|
|
|
1165
1169
|
continue;
|
|
1166
1170
|
}
|
|
1167
1171
|
|
|
1172
|
+
/* Work around a security issue with comments inside attributes */
|
|
1173
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1174
|
+
_removeAttribute(name, currentNode);
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1168
1178
|
/* Sanitize attribute content to be template-safe */
|
|
1169
1179
|
if (SAFE_FOR_TEMPLATES) {
|
|
1170
1180
|
value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
|
|
@@ -1215,7 +1225,11 @@ function createDOMPurify() {
|
|
|
1215
1225
|
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
1216
1226
|
currentNode.setAttribute(name, value);
|
|
1217
1227
|
}
|
|
1218
|
-
|
|
1228
|
+
if (_isClobbered(currentNode)) {
|
|
1229
|
+
_forceRemove(currentNode);
|
|
1230
|
+
} else {
|
|
1231
|
+
arrayPop(DOMPurify.removed);
|
|
1232
|
+
}
|
|
1219
1233
|
} catch (_) {}
|
|
1220
1234
|
}
|
|
1221
1235
|
|
|
@@ -1257,8 +1271,11 @@ function createDOMPurify() {
|
|
|
1257
1271
|
}
|
|
1258
1272
|
}
|
|
1259
1273
|
|
|
1260
|
-
/*
|
|
1261
|
-
|
|
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)) {
|
|
1262
1279
|
_forceRemove(shadowNode);
|
|
1263
1280
|
}
|
|
1264
1281
|
|
|
@@ -1409,8 +1426,11 @@ function createDOMPurify() {
|
|
|
1409
1426
|
}
|
|
1410
1427
|
}
|
|
1411
1428
|
|
|
1412
|
-
/*
|
|
1413
|
-
|
|
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)) {
|
|
1414
1434
|
_forceRemove(currentNode);
|
|
1415
1435
|
}
|
|
1416
1436
|
|