Skip to content

Commit ec1346a

Browse files
authoredJan 5, 2024
Merge pull request #899 from cure53/main
Update 3.x to be in sync with main
2 parents aa2c561 + b3b441e commit ec1346a

15 files changed

+42
-30
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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.0.7**.
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.0.8**.
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

‎bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DOMPurify",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
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

+3-3
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! @license DOMPurify 3.0.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.7/LICENSE */
1+
/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
22

33
const {
44
entries,
@@ -139,7 +139,7 @@ function clone(object) {
139139
if (getOwnPropertyDescriptor(object, property) !== undefined) {
140140
if (Array.isArray(value)) {
141141
newObject[property] = cleanArray(value);
142-
} else if (typeof value === 'object' && value.constructor === Object) {
142+
} else if (value && typeof value === 'object' && value.constructor === Object) {
143143
newObject[property] = clone(value);
144144
} else {
145145
newObject[property] = value;
@@ -278,7 +278,7 @@ function createDOMPurify() {
278278
* Version label, exposed for easier checks
279279
* if DOMPurify is up to date or not
280280
*/
281-
DOMPurify.version = '3.0.7';
281+
DOMPurify.version = '3.0.8';
282282

283283
/**
284284
* Array of elements that DOMPurify removed during sanitation.

‎dist/purify.es.mjs.map

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

‎dist/purify.js

+3-3
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-8
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
"test:ci": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run test:jsdom && npm run test:karma -- --log-level error --reporters dots --single-run --shouldTestOnBrowserStack=\"${TEST_BROWSERSTACK}\" --shouldProbeOnly=\"${TEST_PROBE_ONLY}\"",
1818
"test": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run lint && npm run test:jsdom && npm run test:karma -- --browsers Chrome"
1919
},
20-
"exports": {
21-
".": {
22-
"require": "./dist/purify.cjs.js",
23-
"import": "./dist/purify.es.mjs"
24-
},
25-
"./package.json": "./package.json"
26-
},
2720
"main": "./dist/purify.cjs.js",
2821
"module": "./dist/purify.es.mjs",
2922
"browser": "./dist/purify.js",
@@ -105,7 +98,7 @@
10598
},
10699
"name": "dompurify",
107100
"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.",
108-
"version": "3.0.7",
101+
"version": "3.0.8",
109102
"directories": {
110103
"test": "test"
111104
},

‎src/utils.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ function clone(object) {
136136
if (getOwnPropertyDescriptor(object, property) !== undefined) {
137137
if (Array.isArray(value)) {
138138
newObject[property] = cleanArray(value);
139-
} else if (typeof value === 'object' && value.constructor === Object) {
139+
} else if (
140+
value &&
141+
typeof value === 'object' &&
142+
value.constructor === Object
143+
) {
140144
newObject[property] = clone(value);
141145
} else {
142146
newObject[property] = value;

‎test/test-suite.js

+15
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,21 @@
804804
);
805805
}
806806
);
807+
QUnit.test(
808+
'CUSTOM_ELEMENT_HANDLING config values of null do not throw a TypeError.',
809+
function (assert) {
810+
DOMPurify.sanitize('', {
811+
CUSTOM_ELEMENT_HANDLING: {
812+
tagNameCheck: null,
813+
attributeNameCheck: null,
814+
allowCustomizedBuiltInElements: null,
815+
},
816+
});
817+
818+
// Don't see a great way to assert NOT throws...
819+
assert.ok(true);
820+
}
821+
);
807822
QUnit.test('Test dirty being an array', function (assert) {
808823
assert.equal(
809824
DOMPurify.sanitize(['<a>123<b>456</b></a>']),

‎website/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>DOMPurify 3.0.7 "High Noon"</title>
5+
<title>DOMPurify 3.0.8 "Higher Noon"</title>
66
<script src="../dist/purify.min.js"></script>
77
<!-- we don't actually need it - just to demo and test the $(html) sanitation -->
88
<script src="//code.jquery.com/jquery-3.2.0.min.js"></script>
@@ -23,7 +23,7 @@
2323
</script>
2424
</head>
2525
<body>
26-
<h4>DOMPurify 3.0.7 "High Noon"</h4>
26+
<h4>DOMPurify 3.0.8 "Higher Noon"</h4>
2727
<p>
2828
<a href="http://badge.fury.io/js/dompurify" rel="nofollow"><img alt="npm version" src="https://badge.fury.io/js/dompurify.svg"></a>
2929
<a target="_blank" rel="noopener noreferrer" href="https://github.com/cure53/DOMPurify/workflows/Build%20and%20Test/badge.svg?branch=main"><img src="https://github.com/cure53/DOMPurify/workflows/Build%20and%20Test/badge.svg?branch=main" alt="Build and Test"></a>

0 commit comments

Comments
 (0)
Please sign in to comment.