Skip to content

Commit f2b637f

Browse files
authored
Merge pull request #917 from cure53/main
Getting 3.x branch ready for 3.0.10 release
2 parents 699b1c9 + 51eea81 commit f2b637f

15 files changed

+54
-40
lines changed

README.md

+2-2
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.0.9**.
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.10**.
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.4.7](https://github.com/cure53/DOMPurify/releases/tag/2.4.6) 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.4.8](https://github.com/cure53/DOMPurify/releases/tag/2.4.8) 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

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DOMPurify",
3-
"version": "3.0.9",
3+
"version": "3.0.10",
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-6
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-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! @license DOMPurify 3.0.9 | (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.9/LICENSE */
1+
/*! @license DOMPurify 3.0.10 | (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.10/LICENSE */
22

33
const {
44
entries,
@@ -215,6 +215,7 @@ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205
215215
);
216216

217217
const DOCTYPE_NAME = seal(/^html$/i);
218+
const CUSTOM_ELEMENT = seal(/^[a-z][a-z\d]*(-[a-z\d]+)+$/i);
218219

219220
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
220221
__proto__: null,
@@ -226,7 +227,8 @@ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
226227
IS_ALLOWED_URI: IS_ALLOWED_URI,
227228
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
228229
ATTR_WHITESPACE: ATTR_WHITESPACE,
229-
DOCTYPE_NAME: DOCTYPE_NAME
230+
DOCTYPE_NAME: DOCTYPE_NAME,
231+
CUSTOM_ELEMENT: CUSTOM_ELEMENT
230232
});
231233

232234
const getGlobal = function getGlobal() {
@@ -280,7 +282,7 @@ function createDOMPurify() {
280282
* Version label, exposed for easier checks
281283
* if DOMPurify is up to date or not
282284
*/
283-
DOMPurify.version = '3.0.9';
285+
DOMPurify.version = '3.0.10';
284286

285287
/**
286288
* Array of elements that DOMPurify removed during sanitation.
@@ -351,7 +353,8 @@ function createDOMPurify() {
351353
DATA_ATTR,
352354
ARIA_ATTR,
353355
IS_SCRIPT_OR_DATA,
354-
ATTR_WHITESPACE
356+
ATTR_WHITESPACE,
357+
CUSTOM_ELEMENT
355358
} = EXPRESSIONS;
356359
let {
357360
IS_ALLOWED_URI: IS_ALLOWED_URI$1
@@ -906,7 +909,7 @@ function createDOMPurify() {
906909
const _createNodeIterator = function _createNodeIterator(root) {
907910
return createNodeIterator.call(root.ownerDocument || root, root,
908911
// eslint-disable-next-line no-bitwise
909-
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);
912+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
910913
};
911914

912915
/**
@@ -1088,7 +1091,7 @@ function createDOMPurify() {
10881091
* @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
10891092
*/
10901093
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1091-
return tagName !== 'annotation-xml' && tagName.indexOf('-') > 0;
1094+
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
10921095
};
10931096

10941097
/**

dist/purify.es.mjs.map

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

dist/purify.js

+9-6
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

+8-8
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.0.9",
101+
"version": "3.0.10",
102102
"directories": {
103103
"test": "test"
104104
},

src/purify.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ function createDOMPurify(window = getGlobal()) {
162162
ARIA_ATTR,
163163
IS_SCRIPT_OR_DATA,
164164
ATTR_WHITESPACE,
165+
CUSTOM_ELEMENT,
165166
} = EXPRESSIONS;
166167

167168
let { IS_ALLOWED_URI } = EXPRESSIONS;
@@ -909,7 +910,10 @@ function createDOMPurify(window = getGlobal()) {
909910
root.ownerDocument || root,
910911
root,
911912
// eslint-disable-next-line no-bitwise
912-
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
913+
NodeFilter.SHOW_ELEMENT |
914+
NodeFilter.SHOW_COMMENT |
915+
NodeFilter.SHOW_TEXT |
916+
NodeFilter.SHOW_PROCESSING_INSTRUCTION,
913917
null
914918
);
915919
};
@@ -1189,7 +1193,7 @@ function createDOMPurify(window = getGlobal()) {
11891193
* @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
11901194
*/
11911195
const _isBasicCustomElement = function (tagName) {
1192-
return tagName !== 'annotation-xml' && tagName.indexOf('-') > 0;
1196+
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
11931197
};
11941198

11951199
/**

src/regexp.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export const ATTR_WHITESPACE = seal(
1414
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
1515
);
1616
export const DOCTYPE_NAME = seal(/^html$/i);
17+
export const CUSTOM_ELEMENT = seal(/^[a-z][a-z\d]*(-[a-z\d]+)+$/i);

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.9 "Waterfront"</title>
5+
<title>DOMPurify 3.0.10 "Pitviper"</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.9 "Waterfront"</h4>
26+
<h4>DOMPurify 3.0.10 "Pitviper"</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)