File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,21 @@ describe('svg+text utils', function() {
105
105
assertAnchorLink ( node , 'mailto:support@plot.ly' ) ;
106
106
} ) ;
107
107
108
+ it ( 'wrap XSS attacks in href' , function ( ) {
109
+ var textCases = [
110
+ '<a href="XSS\" onmouseover="alert(1)\" style="font-size:300px">Subtitle</a>' ,
111
+ '<a href="XSS" onmouseover="alert(1)" style="font-size:300px">Subtitle</a>'
112
+ ] ;
113
+
114
+ textCases . forEach ( function ( textCase ) {
115
+ var node = mockTextSVGElement ( textCase ) ;
116
+
117
+ expect ( node . text ( ) ) . toEqual ( 'Subtitle' ) ;
118
+ assertAnchorAttrs ( node ) ;
119
+ assertAnchorLink ( node , 'XSS onmouseover=alert(1) style=font-size:300px' ) ;
120
+ } ) ;
121
+ } ) ;
122
+
108
123
it ( 'should keep query parameters in href' , function ( ) {
109
124
var textCases = [
110
125
'<a href="https://abc.com/myFeature.jsp?name=abc&pwd=def">abc.com?shared-key</a>' ,
You can’t perform that action at this time.
0 commit comments