From 5196a63710f4efce0e46961f0f2e7d321bf72d96 Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Fri, 5 Feb 2010 14:52:07 +0100 Subject: Fix embarrasing XSS holes. --- tmpl/line_reference.tt2 | 6 +++--- tmpl/search_result.tt2 | 38 +++++++++++++++++++------------------- webroot/.static/js/lxrng-funcs.js | 6 +++--- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tmpl/line_reference.tt2 b/tmpl/line_reference.tt2 index f68296c..e535f49 100644 --- a/tmpl/line_reference.tt2 +++ b/tmpl/line_reference.tt2 @@ -1,4 +1,4 @@ - - [% file %], line [% line %] + + [% file | html %], line [% line | html %] diff --git a/tmpl/search_result.tt2 b/tmpl/search_result.tt2 index afc36f4..7e5fdc0 100644 --- a/tmpl/search_result.tt2 +++ b/tmpl/search_result.tt2 @@ -8,17 +8,17 @@ [% END %] [% IF search_type == "code" or (code_res and code_res.idents.0) %] -
Code search: [% code_res.query %]
+
Code search: [% code_res.query | html %]
[% ptype = '' %] [% FOREACH ident = code_res.idents %] [% IF ptype != ident.1 %] - [% ident.1 %] + [% ident.1 | html %] [% ptype = ident.1 %] [% END %] [% INCLUDE line_reference.tt2, file = ident.2, line = ident.3 %] [usage...] [% END %] @@ -27,19 +27,19 @@ [% IF ident_res %]
Identifier: - [% ident_res.query %] + [% ident_res.query | html %]
- [% ident_res.ident.1 %] + [% ident_res.ident.1 | html %] [% IF ident_res.ident.4 %] - in [% ident_res.ident.5 %] + in [% ident_res.ident.5 | html %] - [% ident_res.ident.4 %] + [% ident_res.ident.4 | html %] [% END %] at @@ -64,24 +64,24 @@ [% IF file_res %] [% FOREACH file = file_res.files %] [% IF loop.first %] -
Filename search: [% file_res.query %]
+
Filename search: [% file_res.query | html %]
[% END %] - [% file %] + [% file | html %] [% END %] [% END %] [% IF text_res %] -
Freetext search: [% text_res.query %] - ([% text_res.total %] estimated hits)
+
Freetext search: [% text_res.query | html %] + ([% text_res.total | html %] estimated hits)
[% FOREACH file = text_res.files %] [% INCLUDE line_reference.tt2, file = file.1, line = file.2 %] - ([% file.0 %]%) + ([% file.0 | html %]%) [% END %] [% END %] @@ -90,9 +90,9 @@
Ambiguous file reference, please choose one:
diff --git a/webroot/.static/js/lxrng-funcs.js b/webroot/.static/js/lxrng-funcs.js index 8a6720f..a612055 100644 --- a/webroot/.static/js/lxrng-funcs.js +++ b/webroot/.static/js/lxrng-funcs.js @@ -264,14 +264,14 @@ function load_file_finalize(content) { res.innerHTML = 'Done'; res.innerHTML = content; var head = document.getElementById('current_path'); - head.innerHTML = '' + pending_tree + ''; + head.innerHTML = '' + escape(pending_tree) + ''; var path_walked = ''; var elems = pending_file.split(/\//); for (var i = 0; i < elems.length; i++) { if (elems[i] != '') { head.innerHTML = head.innerHTML + '/' + - '' + elems[i] + ''; + '' + escape(elems[i]) + ''; path_walked = path_walked + elems[i] + '/'; } } -- cgit v1.2.3