Skip to content

Commit 7806004

Browse files
authored
Merge pull request #1082 from cure53/main
Getting 3.x branch ready for 3.2.5 release
2 parents ec29e65 + f14c22f commit 7806004

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+397
-290
lines changed

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [16.x, 17.x, 18.x, 19.x, 20.x, 21.x]
21+
node-version: [18.x, 19.x, 20.x, 21.x, 22.x, 23.x]
2222

2323
steps:
2424
- name: Checkout
@@ -39,7 +39,9 @@ jobs:
3939
with:
4040
run: npm run test:ci
4141
env:
42-
TEST_BROWSERSTACK: ${{ startsWith(matrix.node-version, '21') }}
42+
TEST_BROWSERSTACK: ${{ startsWith(matrix.node-version, '22') }}
4343
TEST_PROBE_ONLY: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/2.x' }}
4444
BS_USERNAME: ${{ secrets.BS_USERNAME }}
4545
BS_ACCESSKEY: ${{ secrets.BS_ACCESSKEY }}
46+
- name: Verify TypeScript
47+
run: npm run verify-typescript

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

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

7-
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.2.4**.
7+
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.2.5**.
88

99
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.
1010

1111
**Note that [DOMPurify v2.5.8](https://github.com/cure53/DOMPurify/releases/tag/2.5.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).**
1212

13-
Our automated tests cover [24 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.
13+
Our automated tests cover [28 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 v18.x, v19.x, v20.x, v21.x, v12.x and v23.x, running DOMPurify on [jsdom](https://github.com/jsdom/jsdom). Older Node versions are known to work as well, but hey... no guarantees.
1414

1515
DOMPurify is written by security people who have vast background in web attacks and XSS. Fear not. For more details please also read about our [Security Goals & Threat Model](https://github.com/cure53/DOMPurify/wiki/Security-Goals-&-Threat-Model). Please, read it. Like, really.
1616

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dompurify",
3-
"version": "3.2.4",
3+
"version": "3.2.5",
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.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// <reference types="trusted-types" />
2-
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
1+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
2+
3+
import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib';
34

45
/**
56
* Configuration to control DOMPurify behavior.
@@ -433,8 +434,7 @@ interface UponSanitizeAttributeHookEvent {
433434
type WindowLike = Pick<typeof globalThis, 'DocumentFragment' | 'HTMLTemplateElement' | 'Node' | 'Element' | 'NodeFilter' | 'NamedNodeMap' | 'HTMLFormElement' | 'DOMParser'> & {
434435
document?: Document;
435436
MozNamedAttrMap?: typeof window.NamedNodeMap;
436-
trustedTypes?: typeof window.trustedTypes;
437-
};
437+
} & Pick<TrustedTypesWindow, 'trustedTypes'>;
438438

439439
export { type Config, type DOMPurify, type DocumentFragmentHook, type ElementHook, type HookName, type NodeHook, type RemovedAttribute, type RemovedElement, type UponSanitizeAttributeHook, type UponSanitizeAttributeHookEvent, type UponSanitizeElementHook, type UponSanitizeElementHookEvent, type WindowLike };
440440

dist/purify.cjs.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.es.d.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// <reference types="trusted-types" />
2-
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
1+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
2+
3+
import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib';
34

45
/**
56
* Configuration to control DOMPurify behavior.
@@ -433,7 +434,6 @@ interface UponSanitizeAttributeHookEvent {
433434
type WindowLike = Pick<typeof globalThis, 'DocumentFragment' | 'HTMLTemplateElement' | 'Node' | 'Element' | 'NodeFilter' | 'NamedNodeMap' | 'HTMLFormElement' | 'DOMParser'> & {
434435
document?: Document;
435436
MozNamedAttrMap?: typeof window.NamedNodeMap;
436-
trustedTypes?: typeof window.trustedTypes;
437-
};
437+
} & Pick<TrustedTypesWindow, 'trustedTypes'>;
438438

439439
export { type Config, type DOMPurify, type DocumentFragmentHook, type ElementHook, type HookName, type NodeHook, type RemovedAttribute, type RemovedElement, type UponSanitizeAttributeHook, type UponSanitizeAttributeHookEvent, type UponSanitizeElementHook, type UponSanitizeElementHookEvent, type WindowLike, _default as default };

dist/purify.es.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
1+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
22

33
const {
44
entries,
@@ -58,6 +58,9 @@ const typeErrorCreate = unconstruct(TypeError);
5858
*/
5959
function unapply(func) {
6060
return function (thisArg) {
61+
if (thisArg instanceof RegExp) {
62+
thisArg.lastIndex = 0;
63+
}
6164
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6265
args[_key - 1] = arguments[_key];
6366
}
@@ -296,7 +299,7 @@ const _createHooksMap = function _createHooksMap() {
296299
function createDOMPurify() {
297300
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
298301
const DOMPurify = root => createDOMPurify(root);
299-
DOMPurify.version = '3.2.4';
302+
DOMPurify.version = '3.2.5';
300303
DOMPurify.removed = [];
301304
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
302305
// Not running in a browser, provide a factory function
@@ -901,7 +904,7 @@ function createDOMPurify() {
901904
allowedTags: ALLOWED_TAGS
902905
});
903906
/* Detect mXSS attempts abusing namespace confusion */
904-
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
907+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
905908
_forceRemove(currentNode);
906909
return true;
907910
}

dist/purify.es.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)