Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: Attempting to fix a MathML-based mXSS pattern
  • Loading branch information
cure53 committed Sep 17, 2020
1 parent c025bc8 commit ce22c8c
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 9 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
Expand Up @@ -673,7 +673,7 @@ function createDOMPurify(window = getGlobal()) {
/* Take care of an mXSS pattern using p, br inside svg, math */
if (
(tagName === 'svg' || tagName === 'math') &&
currentNode.querySelectorAll('p, br').length !== 0
currentNode.querySelectorAll('p, br, form').length !== 0
) {
_forceRemove(currentNode);
return true;
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/expect.js
Expand Up @@ -1074,6 +1074,12 @@ module.exports = [
"<svg><b><style><b></b></style></b></svg>",
"<svg></svg><b><style><b title='</style><img>'&gt;</b>"
]
}, {
"title": "Tests against nesting-based mXSS behavior 1/1",
"payload": "<form><math><mtext></form><form><mglyph><style><img>",
"expected": [
"<form></form>"
]
}, {
"title": "Tests against proper handling of leading whitespaces",
"payload": " ",
Expand Down

0 comments on commit ce22c8c

Please sign in to comment.