Skip to content

Commit 5b2e317

Browse files
authored
Merge pull request #945 from cure53/main
Getting 3.x branch ready for 3.1.2 release
2 parents 7a0a984 + 74664db commit 5b2e317

16 files changed

+67
-52
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
88

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 **v3.1.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 **v3.1.2**.
1010

1111
DOMPurify is written in JavaScript and works in all modern browsers (Safari (10+), Opera (15+), Edge, Firefox and Chrome - as well as almost anything else using Blink, Gecko or WebKit). It doesn't break on MSIE or other legacy browsers. It simply does nothing.
1212

13-
**Note that [DOMPurify v2.5.1](https://github.com/cure53/DOMPurify/releases/tag/2.5.1) is the latest version supporting MSIE. For important security updates compatible with MSIE, please use the [2.x branch](https://github.com/cure53/DOMPurify/tree/2.x).**
13+
**Note that [DOMPurify v2.5.2](https://github.com/cure53/DOMPurify/releases/tag/2.5.2) is the latest version supporting MSIE. For important security updates compatible with MSIE, please use the [2.x branch](https://github.com/cure53/DOMPurify/tree/2.x).**
1414

1515
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 v16.x, v17.x, v18.x and v19.x, running DOMPurify on [jsdom](https://github.com/jsdom/jsdom). Older Node versions are known to work as well, but hey... no guarantees.
1616

@@ -424,7 +424,7 @@ Feature releases will not be announced to this list.
424424
425425
Many people helped and help DOMPurify become what it is and need to be acknowledged here!
426426
427-
[dcramer 💸](https://github.com/dcramer), [JGraph 💸](https://github.com/jgraph), [baekilda 💸](https://github.com/baekilda), [Healthchecks 💸](https://github.com/healthchecks), [Sentry 💸](https://github.com/getsentry), [jarrodldavis 💸](https://github.com/jarrodldavis), [CynegeticIO](https://github.com/CynegeticIO), [ssi02014 ❤️](https://github.com/ssi02014), [kevin_mizu](https://twitter.com/kevin_mizu), [GrantGryczan](https://github.com/GrantGryczan), [Lowdefy](https://twitter.com/lowdefy), [granlem](https://twitter.com/MaximeVeit), [oreoshake](https://github.com/oreoshake), [tdeekens ❤️](https://github.com/tdeekens), [peernohell ❤️](https://github.com/peernohell), [is2ei](https://github.com/is2ei), [SoheilKhodayari](https://github.com/SoheilKhodayari), [franktopel](https://github.com/franktopel), [NateScarlet](https://github.com/NateScarlet), [neilj](https://github.com/neilj), [fhemberger](https://github.com/fhemberger), [Joris-van-der-Wel](https://github.com/Joris-van-der-Wel), [ydaniv](https://github.com/ydaniv), [terjanq](https://twitter.com/terjanq), [filedescriptor](https://github.com/filedescriptor), [ConradIrwin](https://github.com/ConradIrwin), [gibson042](https://github.com/gibson042), [choumx](https://github.com/choumx), [0xSobky](https://github.com/0xSobky), [styfle](https://github.com/styfle), [koto](https://github.com/koto), [tlau88](https://github.com/tlau88), [strugee](https://github.com/strugee), [oparoz](https://github.com/oparoz), [mathiasbynens](https://github.com/mathiasbynens), [edg2s](https://github.com/edg2s), [dnkolegov](https://github.com/dnkolegov), [dhardtke](https://github.com/dhardtke), [wirehead](https://github.com/wirehead), [thorn0](https://github.com/thorn0), [styu](https://github.com/styu), [mozfreddyb](https://github.com/mozfreddyb), [mikesamuel](https://github.com/mikesamuel), [jorangreef](https://github.com/jorangreef), [jimmyhchan](https://github.com/jimmyhchan), [jameydeorio](https://github.com/jameydeorio), [jameskraus](https://github.com/jameskraus), [hyderali](https://github.com/hyderali), [hansottowirtz](https://github.com/hansottowirtz), [hackvertor](https://github.com/hackvertor), [freddyb](https://github.com/freddyb), [flavorjones](https://github.com/flavorjones), [djfarrelly](https://github.com/djfarrelly), [devd](https://github.com/devd), [camerondunford](https://github.com/camerondunford), [buu700](https://github.com/buu700), [buildog](https://github.com/buildog), [alabiaga](https://github.com/alabiaga), [Vector919](https://github.com/Vector919), [Robbert](https://github.com/Robbert), [GreLI](https://github.com/GreLI), [FuzzySockets](https://github.com/FuzzySockets), [ArtemBernatskyy](https://github.com/ArtemBernatskyy), [@garethheyes](https://twitter.com/garethheyes), [@shafigullin](https://twitter.com/shafigullin), [@mmrupp](https://twitter.com/mmrupp), [@irsdl](https://twitter.com/irsdl),[ShikariSenpai](https://github.com/ShikariSenpai), [ansjdnakjdnajkd](https://github.com/ansjdnakjdnajkd), [@asutherland](https://twitter.com/asutherland), [@mathias](https://twitter.com/mathias), [@cgvwzq](https://twitter.com/cgvwzq), [@robbertatwork](https://twitter.com/robbertatwork), [@giutro](https://twitter.com/giutro), [@CmdEngineer\_](https://twitter.com/CmdEngineer_), [@avr4mit](https://twitter.com/avr4mit) and especially [@securitymb ❤️](https://twitter.com/securitymb) & [@masatokinugawa ❤️](https://twitter.com/masatokinugawa)
427+
[icesfont ❤️](https://github.com/icesfont) [dcramer 💸](https://github.com/dcramer), [JGraph 💸](https://github.com/jgraph), [baekilda 💸](https://github.com/baekilda), [Healthchecks 💸](https://github.com/healthchecks), [Sentry 💸](https://github.com/getsentry), [jarrodldavis 💸](https://github.com/jarrodldavis), [CynegeticIO](https://github.com/CynegeticIO), [ssi02014 ❤️](https://github.com/ssi02014), [kevin_mizu](https://twitter.com/kevin_mizu), [GrantGryczan](https://github.com/GrantGryczan), [Lowdefy](https://twitter.com/lowdefy), [granlem](https://twitter.com/MaximeVeit), [oreoshake](https://github.com/oreoshake), [tdeekens ❤️](https://github.com/tdeekens), [peernohell ❤️](https://github.com/peernohell), [is2ei](https://github.com/is2ei), [SoheilKhodayari](https://github.com/SoheilKhodayari), [franktopel](https://github.com/franktopel), [NateScarlet](https://github.com/NateScarlet), [neilj](https://github.com/neilj), [fhemberger](https://github.com/fhemberger), [Joris-van-der-Wel](https://github.com/Joris-van-der-Wel), [ydaniv](https://github.com/ydaniv), [terjanq](https://twitter.com/terjanq), [filedescriptor](https://github.com/filedescriptor), [ConradIrwin](https://github.com/ConradIrwin), [gibson042](https://github.com/gibson042), [choumx](https://github.com/choumx), [0xSobky](https://github.com/0xSobky), [styfle](https://github.com/styfle), [koto](https://github.com/koto), [tlau88](https://github.com/tlau88), [strugee](https://github.com/strugee), [oparoz](https://github.com/oparoz), [mathiasbynens](https://github.com/mathiasbynens), [edg2s](https://github.com/edg2s), [dnkolegov](https://github.com/dnkolegov), [dhardtke](https://github.com/dhardtke), [wirehead](https://github.com/wirehead), [thorn0](https://github.com/thorn0), [styu](https://github.com/styu), [mozfreddyb](https://github.com/mozfreddyb), [mikesamuel](https://github.com/mikesamuel), [jorangreef](https://github.com/jorangreef), [jimmyhchan](https://github.com/jimmyhchan), [jameydeorio](https://github.com/jameydeorio), [jameskraus](https://github.com/jameskraus), [hyderali](https://github.com/hyderali), [hansottowirtz](https://github.com/hansottowirtz), [hackvertor](https://github.com/hackvertor), [freddyb](https://github.com/freddyb), [flavorjones](https://github.com/flavorjones), [djfarrelly](https://github.com/djfarrelly), [devd](https://github.com/devd), [camerondunford](https://github.com/camerondunford), [buu700](https://github.com/buu700), [buildog](https://github.com/buildog), [alabiaga](https://github.com/alabiaga), [Vector919](https://github.com/Vector919), [Robbert](https://github.com/Robbert), [GreLI](https://github.com/GreLI), [FuzzySockets](https://github.com/FuzzySockets), [ArtemBernatskyy](https://github.com/ArtemBernatskyy), [@garethheyes](https://twitter.com/garethheyes), [@shafigullin](https://twitter.com/shafigullin), [@mmrupp](https://twitter.com/mmrupp), [@irsdl](https://twitter.com/irsdl),[ShikariSenpai](https://github.com/ShikariSenpai), [ansjdnakjdnajkd](https://github.com/ansjdnakjdnajkd), [@asutherland](https://twitter.com/asutherland), [@mathias](https://twitter.com/mathias), [@cgvwzq](https://twitter.com/cgvwzq), [@robbertatwork](https://twitter.com/robbertatwork), [@giutro](https://twitter.com/giutro), [@CmdEngineer\_](https://twitter.com/CmdEngineer_), [@avr4mit](https://twitter.com/avr4mit) and especially [@securitymb ❤️](https://twitter.com/securitymb) & [@masatokinugawa ❤️](https://twitter.com/masatokinugawa)
428428
429429
## Testing powered by
430430

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DOMPurify",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"homepage": "https://github.com/cure53/DOMPurify",
55
"author": "Cure53 <info@cure53.de>",
66
"description": "A DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG",

dist/purify.cjs.js

+9-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.cjs.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.es.mjs

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! @license DOMPurify 3.1.1 | (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.1/LICENSE */
1+
/*! @license DOMPurify 3.1.2 | (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.2/LICENSE */
22

33
const {
44
entries,
@@ -282,7 +282,7 @@ function createDOMPurify() {
282282
* Version label, exposed for easier checks
283283
* if DOMPurify is up to date or not
284284
*/
285-
DOMPurify.version = '3.1.1';
285+
DOMPurify.version = '3.1.2';
286286

287287
/**
288288
* Array of elements that DOMPurify removed during sanitation.
@@ -704,7 +704,7 @@ function createDOMPurify() {
704704
CONFIG = cfg;
705705
};
706706
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
707-
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
707+
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
708708

709709
// Certain elements are allowed in both SVG and HTML
710710
// namespace. We need to specify them explicitly
@@ -1264,15 +1264,16 @@ function createDOMPurify() {
12641264
if (_sanitizeElements(shadowNode)) {
12651265
continue;
12661266
}
1267+
const parentNode = getParentNode(shadowNode);
12671268

12681269
/* Set the nesting depth of an element */
12691270
if (shadowNode.nodeType === 1) {
1270-
if (shadowNode.parentNode && shadowNode.parentNode.__depth) {
1271+
if (parentNode && parentNode.__depth) {
12711272
/*
12721273
We want the depth of the node in the original tree, which can
12731274
change when it's removed from its parent.
12741275
*/
1275-
shadowNode.__depth = (shadowNode.__removalCount || 0) + shadowNode.parentNode.__depth + 1;
1276+
shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
12761277
} else {
12771278
shadowNode.__depth = 1;
12781279
}
@@ -1401,15 +1402,16 @@ function createDOMPurify() {
14011402
if (_sanitizeElements(currentNode)) {
14021403
continue;
14031404
}
1405+
const parentNode = getParentNode(currentNode);
14041406

14051407
/* Set the nesting depth of an element */
14061408
if (currentNode.nodeType === 1) {
1407-
if (currentNode.parentNode && currentNode.parentNode.__depth) {
1409+
if (parentNode && parentNode.__depth) {
14081410
/*
14091411
We want the depth of the node in the original tree, which can
14101412
change when it's removed from its parent.
14111413
*/
1412-
currentNode.__depth = (currentNode.__removalCount || 0) + currentNode.parentNode.__depth + 1;
1414+
currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
14131415
} else {
14141416
currentNode.__depth = 1;
14151417
}

dist/purify.es.mjs.map

+1-1
Large diffs are not rendered by default.

dist/purify.js

+9-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
},
9999
"name": "dompurify",
100100
"description": "DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. It's written in JavaScript and works in all modern browsers (Safari, Opera (15+), Internet Explorer (10+), Firefox and Chrome - as well as almost anything else using Blink or WebKit). DOMPurify is written by security people who have vast background in web attacks and XSS. Fear not.",
101-
"version": "3.1.1",
101+
"version": "3.1.2",
102102
"directories": {
103103
"test": "test"
104104
},

src/purify.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,6 @@ function createDOMPurify(window = getGlobal()) {
643643

644644
const HTML_INTEGRATION_POINTS = addToSet({}, [
645645
'foreignobject',
646-
'desc',
647-
'title',
648646
'annotation-xml',
649647
]);
650648

@@ -1379,17 +1377,17 @@ function createDOMPurify(window = getGlobal()) {
13791377
continue;
13801378
}
13811379

1380+
const parentNode = getParentNode(shadowNode);
1381+
13821382
/* Set the nesting depth of an element */
13831383
if (shadowNode.nodeType === 1) {
1384-
if (shadowNode.parentNode && shadowNode.parentNode.__depth) {
1384+
if (parentNode && parentNode.__depth) {
13851385
/*
13861386
We want the depth of the node in the original tree, which can
13871387
change when it's removed from its parent.
13881388
*/
13891389
shadowNode.__depth =
1390-
(shadowNode.__removalCount || 0) +
1391-
shadowNode.parentNode.__depth +
1392-
1;
1390+
(shadowNode.__removalCount || 0) + parentNode.__depth + 1;
13931391
} else {
13941392
shadowNode.__depth = 1;
13951393
}
@@ -1527,17 +1525,17 @@ function createDOMPurify(window = getGlobal()) {
15271525
continue;
15281526
}
15291527

1528+
const parentNode = getParentNode(currentNode);
1529+
15301530
/* Set the nesting depth of an element */
15311531
if (currentNode.nodeType === 1) {
1532-
if (currentNode.parentNode && currentNode.parentNode.__depth) {
1532+
if (parentNode && parentNode.__depth) {
15331533
/*
15341534
We want the depth of the node in the original tree, which can
15351535
change when it's removed from its parent.
15361536
*/
15371537
currentNode.__depth =
1538-
(currentNode.__removalCount || 0) +
1539-
currentNode.parentNode.__depth +
1540-
1;
1538+
(currentNode.__removalCount || 0) + parentNode.__depth + 1;
15411539
} else {
15421540
currentNode.__depth = 1;
15431541
}

0 commit comments

Comments
 (0)