Skip to content

Commit beb2038

Browse files
committed
MAGETWO-45593: Magento back office persistent XSS vulnerability on order comments
- Changed the unit test.
1 parent 9088bdc commit beb2038

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

app/code/Magento/Sales/Test/Unit/Helper/AdminTest.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,37 @@ public function escapeHtmlWithLinksDataProvider()
354354
'<a>some text in tags</a>',
355355
'<a>some text in tags</a>',
356356
'allowedTags' => ['a']
357-
]
357+
],
358+
'Not replacement with placeholders' => [
359+
"<a><script>alert(1)</script></a>",
360+
'<a>&lt;script&gt;alert(1)&lt;/script&gt;</a>',
361+
'allowedTags' => ['a']
362+
],
363+
'Normal usage, url escaped' => [
364+
'<a href=\"#\">Foo</a>',
365+
'<a href="#">Foo</a>',
366+
'allowedTags' => ['a']
367+
],
368+
'Normal usage, url not escaped' => [
369+
"<a href=http://example.com?foo=1&bar=2&baz[name]=BAZ>Foo</a>",
370+
'<a href="http://example.com?foo=1&amp;bar=2&amp;baz[name]=BAZ">Foo</a>',
371+
'allowedTags' => ['a']
372+
],
373+
'XSS test' => [
374+
"<a href=\"javascript&colon;alert(59)\">Foo</a>",
375+
'<a href="#">Foo</a>',
376+
'allowedTags' => ['a']
377+
],
378+
'Additional regex test' => [
379+
"<a href=\"http://example1.com\" href=\"http://example2.com\">Foo</a>",
380+
'<a href="http://example1.com">Foo</a>',
381+
'allowedTags' => ['a']
382+
],
383+
'Break of valid urls' => [
384+
"<a href=\"http://example.com?foo=text with space\">Foo</a>",
385+
'<a href="#">Foo</a>',
386+
'allowedTags' => ['a']
387+
],
358388
];
359389
}
360390
}

0 commit comments

Comments
 (0)