@@ -29,7 +29,7 @@ def test_render_xss(self):
2929 xssStr = '<noscript><p title="</noscript><img src=x onerror=alert() onmouseover=alert()>">'
3030
3131 # Check for issue #2779 and others
32- response = self .client .get (url , {'target' : 'test' , 'format' : 'raw' , 'cacheTimeout' : xssStr , 'from' : xssStr })
32+ response = self .client .get (url , {'target' : 'test' , 'format' : 'raw' , 'cacheTimeout' : xssStr , 'from' : xssStr , 'until' : xssStr })
3333 self .assertXSS (response , status_code = 400 , msg_prefix = 'XSS detected: ' )
3434
3535
@@ -38,5 +38,14 @@ def test_render_xss(self):
3838 url = reverse ('metrics_find' )
3939 xssStr = '<noscript><p title="</noscript><img src=x onerror=alert() onmouseover=alert()>">'
4040
41- response = self .client .get (url , {'query' : 'test' , 'local' : xssStr , 'from' : xssStr , 'tz' : xssStr })
41+ response = self .client .get (url , {'query' : 'test' , 'local' : xssStr , 'from' : xssStr , 'until' : xssStr , ' tz' : xssStr })
4242 self .assertXSS (response , status_code = 400 , msg_prefix = 'XSS detected: ' )
43+
44+ def test_find_xss_script_tag (self ):
45+ """Test that <script> tags in from/until parameters are properly escaped (issue #2870)"""
46+ url = reverse ('metrics_find' )
47+ xssStr = "<script>alert('XSS')</script>"
48+
49+ for param in ('from' , 'until' ):
50+ response = self .client .get (url , {'query' : 'test' , param : xssStr })
51+ self .assertXSS (response , status_code = 400 , msg_prefix = 'XSS detected in %s: ' % param )
0 commit comments