Skip to content

Commit

Permalink
test: Fixed additional Edge 17 and MSIE11 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Dec 17, 2020
1 parent 1446372 commit d1cf8c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
20 changes: 14 additions & 6 deletions test/fixtures/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,8 @@ module.exports = [
"",
"<svg></svg><p></p><title>&lt;a id=\"</title><img src=\"x\">\"&gt;",
"<svg><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></svg>"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
]
}, {
"title": "Tests against mXSS behavior with MathML in Chrome 77 and alike",
Expand All @@ -1040,7 +1041,8 @@ module.exports = [
"<svg></svg><p></p><title>&lt;template&gt;&lt;style&gt;</title><img src=\"x\">",
"<svg></svg><p></p><img src=\"x\">",
"<svg><title><template></template></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><template></template></title></svg>"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><template></template></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
]
}, {
"title": "Tests against mXSS behavior with MathML Templates in Chrome 77 and alike",
Expand Down Expand Up @@ -1112,21 +1114,24 @@ module.exports = [
"payload": "<form><math><mtext></form><form><mglyph><style><img src=x onerror=alert(1)>",
"expected": [
"<form></form>",
"<form><math><mtext><form></form></mtext></math></form>"
"<form><math><mtext><form></form></mtext></math></form>",
"<form><math></math></form>"
]
}, {
"title": "Tests against nesting-based mXSS behavior 2/5",
"payload": "<math><mtext><table><mglyph><style><math href=javascript:alert(1)>CLICKME</math>",
"expected": [
"",
"<math><mtext><table></table></mtext></math>"
"<math><mtext><table></table></mtext></math>",
"<math></math>"
]
}, {
"title": "Tests against nesting-based mXSS behavior 3/5",
"payload": "<math><mtext><table><mglyph><style><!--</style><img title=\"--&gt;&lt;img src=1 onerror=alert(1)&gt;\">",
"expected": [
"",
"<math><mtext><table></table></mtext></math>"
"<math><mtext><table></table></mtext></math>",
"<math></math>"
]
}, {
"title": "Tests against nesting-based mXSS behavior 4/5",
Expand All @@ -1135,20 +1140,23 @@ module.exports = [
"",
"<form></form>",
"<form><math><mtext><form></form></mtext></math></form>",
"<form><math></math></form>"
]
}, {
"title": "Tests against nesting-based mXSS behavior 5/5",
"payload": "<math><mtext><table><mglyph><svg><mtext><style><path id=\"</style><img onerror=alert(1) src>\">",
"expected": [
"",
"<math><mtext><table></table></mtext></math>"
"<math><mtext><table></table></mtext></math>",
"<math></math>"
]
}, {
"title": "Tests against additonal problems regarding HTML inside MathML 1/2",
"payload": "<math><mtext><h1><a><h6></a></h6><mglyph><svg><mtext><style><a title=\"</style><img src onerror='alert(1)'>\"></style></h1>",
"expected": [
"",
"<math><mtext><h1><a></a><h6><a></a></h6></h1></mtext></math>",
"<math></math>"
]
}, {
"title": "Tests against additonal problems regarding HTML inside MathML 2/2",
Expand Down
11 changes: 9 additions & 2 deletions test/test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -1487,11 +1487,18 @@ module.exports = function (DOMPurify, window, tests, xssTests) {
},
{
test: '<math><mi><canvas></canvas><textarea></textarea></mi></math>',
expected: ['<math><mi><canvas></canvas><textarea></textarea></mi></math>', "<math></math>"]
expected: [
'<math><mi><canvas></canvas><textarea></textarea></mi></math>',
"<math></math>"
]
},
{
test: '<svg><math></math><title><math></math></title></svg>',
expected: ['<svg><title><math></math></title></svg>', "<svg xmlns=\"http://www.w3.org/2000/svg\" />"]
expected: [
'<svg><title><math></math></title></svg>',
"<svg xmlns=\"http://www.w3.org/2000/svg\" />",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><math></math></title></svg>"
]
},
{
test: '<math><svg></svg><mi><svg></svg></mi></math>',
Expand Down

0 comments on commit d1cf8c6

Please sign in to comment.