dompurify 2.5.1 → 2.5.2
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 +9 -7
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.js +9 -7
- package/dist/purify.es.js.map +1 -1
- package/dist/purify.js +9 -7
- 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/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
|
|
8
8
|
|
|
9
|
-
It's also very simple to use and get started with. DOMPurify was [started in February 2014](https://github.com/cure53/DOMPurify/commit/a630922616927373485e0e787ab19e73e3691b2b) and, meanwhile, has reached version 3.1.
|
|
9
|
+
It's also very simple to use and get started with. DOMPurify was [started in February 2014](https://github.com/cure53/DOMPurify/commit/a630922616927373485e0e787ab19e73e3691b2b) and, meanwhile, has reached version 3.1.2.
|
|
10
10
|
|
|
11
11
|
DOMPurify is written in JavaScript and works in all modern browsers (Safari (10+), Opera (15+), Internet Explorer (10+), Edge, Firefox and Chrome - as well as almost anything else using Blink or WebKit). It doesn't break on MSIE6 or other legacy browsers. It either uses [a fall-back](#what-about-older-browsers-like-msie8) or simply does nothing.
|
|
12
12
|
|
|
13
|
-
**Note that DOMPurify v2.5.
|
|
13
|
+
**Note that DOMPurify v2.5.2 is the latest version supporting MSIE. For important security updates compatible with MSIE, please use the 2.x branch.**
|
|
14
14
|
|
|
15
15
|
Our automated tests cover [19 different browsers](https://github.com/cure53/DOMPurify/blob/main/test/karma.custom-launchers.config.js#L5) right now, more to come. We also cover Node.js v14.x, v16.x, v17.x and v18.x, running DOMPurify on [jsdom](https://github.com/jsdom/jsdom). Older Node versions are known to work as well, but hey... no guarantees.
|
|
16
16
|
|
package/dist/purify.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 2.5.
|
|
1
|
+
/*! @license DOMPurify 2.5.2 | (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.2/LICENSE */
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -283,7 +283,7 @@ function createDOMPurify() {
|
|
|
283
283
|
* Version label, exposed for easier checks
|
|
284
284
|
* if DOMPurify is up to date or not
|
|
285
285
|
*/
|
|
286
|
-
DOMPurify.version = '2.5.
|
|
286
|
+
DOMPurify.version = '2.5.2';
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -673,7 +673,7 @@ function createDOMPurify() {
|
|
|
673
673
|
CONFIG = cfg;
|
|
674
674
|
};
|
|
675
675
|
var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
676
|
-
var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', '
|
|
676
|
+
var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
|
|
677
677
|
|
|
678
678
|
// Certain elements are allowed in both SVG and HTML
|
|
679
679
|
// namespace. We need to specify them explicitly
|
|
@@ -1244,15 +1244,16 @@ function createDOMPurify() {
|
|
|
1244
1244
|
if (_sanitizeElements(shadowNode)) {
|
|
1245
1245
|
continue;
|
|
1246
1246
|
}
|
|
1247
|
+
var parentNode = getParentNode(shadowNode);
|
|
1247
1248
|
|
|
1248
1249
|
/* Set the nesting depth of an element */
|
|
1249
1250
|
if (shadowNode.nodeType === 1) {
|
|
1250
|
-
if (
|
|
1251
|
+
if (parentNode && parentNode.__depth) {
|
|
1251
1252
|
/*
|
|
1252
1253
|
We want the depth of the node in the original tree, which can
|
|
1253
1254
|
change when it's removed from its parent.
|
|
1254
1255
|
*/
|
|
1255
|
-
shadowNode.__depth = (shadowNode.__removalCount || 0) +
|
|
1256
|
+
shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1256
1257
|
} else {
|
|
1257
1258
|
shadowNode.__depth = 1;
|
|
1258
1259
|
}
|
|
@@ -1395,15 +1396,16 @@ function createDOMPurify() {
|
|
|
1395
1396
|
if (_sanitizeElements(currentNode)) {
|
|
1396
1397
|
continue;
|
|
1397
1398
|
}
|
|
1399
|
+
var parentNode = getParentNode(currentNode);
|
|
1398
1400
|
|
|
1399
1401
|
/* Set the nesting depth of an element */
|
|
1400
1402
|
if (currentNode.nodeType === 1) {
|
|
1401
|
-
if (
|
|
1403
|
+
if (parentNode && parentNode.__depth) {
|
|
1402
1404
|
/*
|
|
1403
1405
|
We want the depth of the node in the original tree, which can
|
|
1404
1406
|
change when it's removed from its parent.
|
|
1405
1407
|
*/
|
|
1406
|
-
currentNode.__depth = (currentNode.__removalCount || 0) +
|
|
1408
|
+
currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
|
|
1407
1409
|
} else {
|
|
1408
1410
|
currentNode.__depth = 1;
|
|
1409
1411
|
}
|