Skip to content

Commit

Permalink
fix: Started to set new MAX_NESTING_DEPTH limits as well
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Apr 26, 2024
1 parent 2076d1b commit 8589191
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion dist/purify.es.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.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ function createDOMPurify(window = getGlobal()) {
let CONFIG = null;

/* Specify the maximum element nesting depth to prevent mXSS */
const MAX_NESTING_DEPTH = 500;
const MAX_NESTING_DEPTH = 255;

/* Ideally, do not touch anything below this line */
/* ______________________________________________ */
Expand Down
4 changes: 2 additions & 2 deletions test/test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -2112,8 +2112,8 @@
clean = DOMPurify.sanitize(dirty);
assert.contains(clean, expected);

dirty = `<template>${`<div>`.repeat(502)}${`</div>`.repeat(502)}<img>`;
expected = `<template>${`<div>`.repeat(498)}${`</div>`.repeat(498)}<img>`;
dirty = `<div><template>${`<div>`.repeat(502)}${`</div>`.repeat(502)}<img>`;
expected = `<div><template>${`<div>`.repeat(498)}${`</div>`.repeat(498)}<img></template></div>`;
clean = DOMPurify.sanitize(dirty);
assert.contains(clean, expected);

Expand Down

0 comments on commit 8589191

Please sign in to comment.