Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
620b18b
fix: Added an experimental fix for an mXSS detection regex
cure53 Feb 17, 2025
f65a084
test: Added more modern browsers to the Karma launchers list
cure53 Feb 17, 2025
2a1123a
test: Changed latest Safari version from 18.2 to 18.1
cure53 Feb 17, 2025
c287c50
chore(package.json): add `dist/purify.js` and `dist/purify.min.js` to…
reey Feb 19, 2025
6769460
Merge pull request #1065 from reey/main
cure53 Feb 22, 2025
9f859d3
See #1067
cure53 Feb 24, 2025
966dcd8
Update README.md
cure53 Feb 24, 2025
560badb
Fix typo.
KanhaKanhaiya Mar 4, 2025
e9035b1
Merge pull request #1069 from KanhaKanhaiya/patch-1
cure53 Mar 5, 2025
ebfed90
Added script to verify various TypeScript configurations.
reduckted Mar 12, 2025
7997e6b
Improved display of verification results.
reduckted Mar 15, 2025
b4dec78
Merge pull request #1075 from reduckted/feature/verify-typescript
cure53 Mar 16, 2025
768ce79
fix(trusted-types): Use 'trusted-types/lib'
Mar 6, 2025
1794199
use ESM type imports in source, remove patch function
Mar 17, 2025
17337e5
Merge pull request #1073 from donmccurdy/fix/trusted-types-lib
cure53 Mar 18, 2025
a54590c
Fix sourcemaps.
reduckted Mar 24, 2025
2e5fd64
Merge pull request #1078 from reduckted/fix-sourcemaps
cure53 Mar 24, 2025
49882dc
test: Added Node 23.x to tested runtimes, removed Node 17.x
cure53 Mar 31, 2025
72c00db
Merge branch 'main' of github.com:cure53/DOMPurify
cure53 Mar 31, 2025
b428788
Update README.md
cure53 Mar 31, 2025
e62e3ef
fix: Using ALLOWED_URI_REGEXP with the 'g' flag leads to incorrect re…
hhk-png Mar 31, 2025
59e8664
Merge branch 'cure53:main' into main
hhk-png Apr 1, 2025
fce40b5
chore: for lint
hhk-png Apr 1, 2025
c69d7a8
Merge pull request #1080 from hhk-png/main
cure53 Apr 1, 2025
f14c22f
chore: Preparing 3.2.5 release
cure53 Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

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

steps:
- name: Checkout
Expand All @@ -39,7 +39,9 @@ jobs:
with:
run: npm run test:ci
env:
TEST_BROWSERSTACK: ${{ startsWith(matrix.node-version, '21') }}
TEST_BROWSERSTACK: ${{ startsWith(matrix.node-version, '22') }}
TEST_PROBE_ONLY: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/2.x' }}
BS_USERNAME: ${{ secrets.BS_USERNAME }}
BS_ACCESSKEY: ${{ secrets.BS_ACCESSKEY }}
- name: Verify TypeScript
run: npm run verify-typescript
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

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

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**.
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**.

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.

**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).**

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

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.

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dompurify",
"version": "3.2.4",
"version": "3.2.5",
"homepage": "https://github.com/cure53/DOMPurify",
"author": "Cure53 <[email protected]>",
"description": "A DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG",
Expand Down
8 changes: 4 additions & 4 deletions dist/purify.cjs.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="trusted-types" />
/*! @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 */
/*! @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 */

import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib';

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

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 };

Expand Down
9 changes: 6 additions & 3 deletions dist/purify.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.cjs.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/purify.es.d.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="trusted-types" />
/*! @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 */
/*! @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 */

import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib';

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

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 };
9 changes: 6 additions & 3 deletions dist/purify.es.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @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 */
/*! @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 */

const {
entries,
Expand Down Expand Up @@ -58,6 +58,9 @@ const typeErrorCreate = unconstruct(TypeError);
*/
function unapply(func) {
return function (thisArg) {
if (thisArg instanceof RegExp) {
thisArg.lastIndex = 0;
}
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
Expand Down Expand Up @@ -296,7 +299,7 @@ const _createHooksMap = function _createHooksMap() {
function createDOMPurify() {
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
const DOMPurify = root => createDOMPurify(root);
DOMPurify.version = '3.2.4';
DOMPurify.version = '3.2.5';
DOMPurify.removed = [];
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
// Not running in a browser, provide a factory function
Expand Down Expand Up @@ -901,7 +904,7 @@ function createDOMPurify() {
allowedTags: ALLOWED_TAGS
});
/* Detect mXSS attempts abusing namespace confusion */
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
_forceRemove(currentNode);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/purify.es.mjs.map

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions dist/purify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/purify.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/purify.min.js.map

Large diffs are not rendered by default.

Loading
Loading