Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cure53/DOMPurify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.1.3
Choose a base ref
...
head repository: cure53/DOMPurify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.1.4
Choose a head ref

Commits on Jul 11, 2023

  1. Merge pull request #835 from cure53/main

    Preparing 3.0.5 release
    cure53 authored Jul 11, 2023
    Copy the full SHA
    c96c9df View commit details

Commits on Sep 28, 2023

  1. Merge pull request #860 from cure53/main

    Merged main into 3.x branch for 3.0.6 release preparation
    cure53 authored Sep 28, 2023
    Copy the full SHA
    1b864e7 View commit details

Commits on Dec 6, 2023

  1. Merge pull request #885 from cure53/main

    Update 3.x to be in sync with main
    cure53 authored Dec 6, 2023
    Copy the full SHA
    db73dd7 View commit details

Commits on Jan 3, 2024

  1. Merge pull request #893 from cure53/main

    Getting 3.x branch ready for 3.0.7 release
    cure53 authored Jan 3, 2024
    Copy the full SHA
    aa2c561 View commit details

Commits on Jan 5, 2024

  1. Merge pull request #899 from cure53/main

    Update 3.x to be in sync with main
    cure53 authored Jan 5, 2024
    Copy the full SHA
    ec1346a View commit details

Commits on Feb 20, 2024

  1. Merge pull request #913 from cure53/main

     Getting 3.x branch ready for 3.0.9 release
    cure53 authored Feb 20, 2024
    Copy the full SHA
    699b1c9 View commit details

Commits on Mar 19, 2024

  1. Merge pull request #917 from cure53/main

     Getting 3.x branch ready for 3.0.10 release
    cure53 authored Mar 19, 2024
    Copy the full SHA
    f2b637f View commit details

Commits on Mar 21, 2024

  1. Merge pull request #921 from cure53/main

    Getting 3.x branch ready for 3.0.11 release
    cure53 authored Mar 21, 2024
    Copy the full SHA
    a9fd4ae View commit details

Commits on Apr 6, 2024

  1. Merge pull request #934 from cure53/main

    Getting 3.x branch ready for 3.1.0 release
    cure53 authored Apr 6, 2024
    Copy the full SHA
    1c32a11 View commit details

Commits on Apr 7, 2024

  1. Merge pull request #936 from cure53/main

    docs: Updated the year in LICENSE file
    cure53 authored Apr 7, 2024
    Copy the full SHA
    db19269 View commit details

Commits on Apr 25, 2024

  1. Merge pull request #943 from cure53/main

    Merging fixes covering nesting-based mXSS into 3.x branch
    cure53 authored Apr 25, 2024
    Copy the full SHA
    6ea80cd View commit details

Commits on Apr 26, 2024

  1. Merge pull request #944 from cure53/main

     Getting 3.x branch ready for 3.1.1 release
    cure53 authored Apr 26, 2024
    Copy the full SHA
    7a0a984 View commit details

Commits on Apr 30, 2024

  1. Merge pull request #945 from cure53/main

    Getting 3.x branch ready for 3.1.2 release
    cure53 authored Apr 30, 2024
    Copy the full SHA
    5b2e317 View commit details

Commits on May 15, 2024

  1. documentation

    MortenHofft authored May 15, 2024
    Copy the full SHA
    952f309 View commit details

Commits on May 17, 2024

  1. Add popover attributes to allow list

    Gigabyte5671 committed May 17, 2024
    Copy the full SHA
    28c1828 View commit details

Commits on May 18, 2024

  1. Merge pull request #956 from MortenHofft/patch-1

    Documentation
    cure53 authored May 18, 2024
    Copy the full SHA
    96bf0d4 View commit details
  2. Merge pull request #957 from Gigabyte5671/popover-api

    Allow Popover API attributes
    cure53 authored May 18, 2024
    Copy the full SHA
    a34860b View commit details
  3. fix: Added MSIE number check fix to main as well

    test: Experimentally added 2.x to branches for BS test on
    cure53 committed May 18, 2024
    Copy the full SHA
    1223487 View commit details
  4. test: Experimentally changed TEST_PROBE_ONLY to not cover 2.x

    cure53 committed May 18, 2024
    Copy the full SHA
    4486f91 View commit details

Commits on May 19, 2024

  1. chore: Preparing 3.1.4 release

    cure53 committed May 19, 2024
    Copy the full SHA
    3ddb7f2 View commit details

Commits on May 20, 2024

  1. Merge pull request #960 from cure53/main

    Getting 3.x branch ready for 3.1.4 release
    cure53 authored May 20, 2024
    Copy the full SHA
    7517e9c View commit details
Showing with 45 additions and 31 deletions.
  1. +2 −1 .github/workflows/build-and-test.yml
  2. +3 −3 README.md
  3. +1 −1 bower.json
  4. +7 −4 dist/purify.cjs.js
  5. +1 −1 dist/purify.cjs.js.map
  6. +7 −4 dist/purify.es.mjs
  7. +1 −1 dist/purify.es.mjs.map
  8. +7 −4 dist/purify.js
  9. +1 −1 dist/purify.js.map
  10. +2 −2 dist/purify.min.js
  11. +1 −1 dist/purify.min.js.map
  12. +2 −2 package-lock.json
  13. +1 −1 package.json
  14. +3 −0 src/attrs.js
  15. +4 −3 src/utils.js
  16. +2 −2 website/index.html
3 changes: 2 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ on:
branches:
- main
- 3.x
- 2.x
pull_request:

jobs:
@@ -39,6 +40,6 @@ jobs:
run: npm run test:ci
env:
TEST_BROWSERSTACK: ${{ startsWith(matrix.node-version, '21') }}
TEST_PROBE_ONLY: ${{ github.ref != 'refs/heads/main' }}
TEST_PROBE_ONLY: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/2.x' }}
BS_USERNAME: ${{ secrets.BS_USERNAME }}
BS_ACCESSKEY: ${{ secrets.BS_ACCESSKEY }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@

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

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.3](https://github.com/cure53/DOMPurify/releases/tag/2.5.3) 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).**
**Note that [DOMPurify v2.5.4](https://github.com/cure53/DOMPurify/releases/tag/2.5.4) 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 [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.

@@ -45,7 +45,7 @@ const clean = DOMPurify.sanitize(dirty);
Or maybe this, if you love working with Angular or alike:

```js
import * as DOMPurify from 'dompurify';
import DOMPurify from 'dompurify';

const clean = DOMPurify.sanitize('<b>hello there</b>');
```
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.1.3",
"version": "3.1.4",
"homepage": "https://github.com/cure53/DOMPurify",
"author": "Cure53 <info@cure53.de>",
"description": "A DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG",
11 changes: 7 additions & 4 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.

11 changes: 7 additions & 4 deletions dist/purify.es.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @license DOMPurify 3.1.3 | (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.3/LICENSE */
/*! @license DOMPurify 3.1.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.1.4/LICENSE */

const {
entries,
@@ -48,7 +48,10 @@ const stringTrim = unapply(String.prototype.trim);
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
const regExpTest = unapply(RegExp.prototype.test);
const typeErrorCreate = unconstruct(TypeError);
const numberIsNaN = unapply(Number.isNaN);
function numberIsNaN(x) {
// eslint-disable-next-line unicorn/prefer-number-properties
return typeof x === 'number' && isNaN(x);
}

/**
* Creates a new function that calls the given function with a specified thisArg and arguments.
@@ -197,7 +200,7 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
const text = freeze(['#text']);

const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
@@ -301,7 +304,7 @@ function createDOMPurify() {
* Version label, exposed for easier checks
* if DOMPurify is up to date or not
*/
DOMPurify.version = '3.1.3';
DOMPurify.version = '3.1.4';

/**
* Array of elements that DOMPurify removed during sanitation.
2 changes: 1 addition & 1 deletion dist/purify.es.mjs.map

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions dist/purify.js
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.

4 changes: 2 additions & 2 deletions package-lock.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@
},
"name": "dompurify",
"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.",
"version": "3.1.3",
"version": "3.1.4",
"directories": {
"test": "test"
},
3 changes: 3 additions & 0 deletions src/attrs.js
Original file line number Diff line number Diff line change
@@ -74,6 +74,9 @@ export const html = freeze([
'pattern',
'placeholder',
'playsinline',
'popover',
'popovertarget',
'popovertargetaction',
'poster',
'preload',
'pubdate',
7 changes: 4 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -52,7 +52,10 @@ const regExpTest = unapply(RegExp.prototype.test);

const typeErrorCreate = unconstruct(TypeError);

const numberIsNaN = unapply(Number.isNaN);
export function numberIsNaN(x) {
// eslint-disable-next-line unicorn/prefer-number-properties
return typeof x === 'number' && isNaN(x);
}

/**
* Creates a new function that calls the given function with a specified thisArg and arguments.
@@ -217,8 +220,6 @@ export {
stringToLowerCase,
stringToString,
stringTrim,
// Number
numberIsNaN,
// Errors
typeErrorCreate,
// Other
4 changes: 2 additions & 2 deletions website/index.html
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>DOMPurify 3.1.3 "Octopus"</title>
<title>DOMPurify 3.1.4 "Magpie"</title>
<script src="../dist/purify.min.js"></script>
<!-- we don't actually need it - just to demo and test the $(html) sanitation -->
<script src="//code.jquery.com/jquery-3.2.0.min.js"></script>
@@ -23,7 +23,7 @@
</script>
</head>
<body>
<h4>DOMPurify 3.1.3 "Octopus"</h4>
<h4>DOMPurify 3.1.4 "Magpie"</h4>
<p>
<a href="http://badge.fury.io/js/dompurify" rel="nofollow"><img alt="npm version" src="https://badge.fury.io/js/dompurify.svg"></a>
<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>