diff options
author | Dave Miller <justdave@bugzilla.org> | 2024-08-29 07:03:41 -0400 |
---|---|---|
committer | Dave Miller <github@justdave.net> | 2024-09-03 11:41:55 -0400 |
commit | 430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8 (patch) | |
tree | 20ec85a34871ebe12df5aa703df5faaa9cb5495d /report.cgi | |
parent | 004ee037b0f49a549648a84b568188ec49bccac7 (diff) | |
download | bugs-430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8.tar bugs-430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8.tar.gz bugs-430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8.tar.bz2 bugs-430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8.tar.xz bugs-430a93b7c4df3aadfa2262ef9b8bcc8e77f0eca8.zip |
Bug 1439260: XSS in chart.cgi and report.cgi
Diffstat (limited to 'report.cgi')
-rwxr-xr-x | report.cgi | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/report.cgi b/report.cgi index 2a8317d7a..d5f471ef0 100755 --- a/report.cgi +++ b/report.cgi @@ -359,19 +359,22 @@ my $format = $template->get_format("reports/report", $formatparam, # If we get a template or CGI error, it comes out as HTML, which isn't valid # PNG data, and the browser just displays a "corrupt PNG" message. So, you can # set debug=1 to always get an HTML content-type, and view the error. -$format->{'ctype'} = "text/html" if $cgi->param('debug'); +if (exists $vars->{'debug'}) { + # Bug 1439260 - if we're using debug mode, always use the HTML template + # which has proper filters in it. Debug forces an HTML content type + # anyway, and can cause XSS if we're not filtering the output. + $format = $template->get_format("reports/report", $formatparam, "html"); +} $cgi->set_dated_content_disp("inline", "report", $format->{extension}); print $cgi->header($format->{'ctype'}); # Problems with this CGI are often due to malformed data. Setting debug=1 # prints out both data structures. -if ($cgi->param('debug')) { +if (exists $vars->{'debug'}) { require Data::Dumper; - say "<pre>data hash:"; - say html_quote(Data::Dumper::Dumper(%data)); - say "\ndata array:"; - say html_quote(Data::Dumper::Dumper(@image_data)) . "\n\n</pre>"; + $vars->{'debug_hash'} = Data::Dumper::Dumper(%data); + $vars->{'debug_array'} = Data::Dumper::Dumper(@image_data); } # All formats point to the same section of the documentation. |