changeset 5763:97208f67798f

remove support for javascript: URLs in the rst parser (dangerous, XSS)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 21 Feb 2011 22:19:57 +0100
parents b1b82826f8b8
children 67ddd66d5428
files MoinMoin/parser/text_rst.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_rst.py	Thu Jan 20 13:34:33 2011 +0100
+++ b/MoinMoin/parser/text_rst.py	Mon Feb 21 22:19:57 2011 +0100
@@ -391,6 +391,9 @@
                 # for images with targets).
                 if not [i for i in node.children if i.__class__ == docutils.nodes.image]:
                     node['classes'].append('interwiki')
+            elif prefix == 'javascript':
+                # is someone trying to do XSS with javascript?
+                node['refuri'] = 'javascript:alert("it does not work")'
             elif prefix != '':
                 # Some link scheme (http, file, https, mailto, etc.), add class
                 # information if the reference doesn't have a child image (don't