aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@netscape.net>2017-04-22 19:14:24 +0200
committerFrédéric Buclin <LpSolit@netscape.net>2017-04-22 19:14:24 +0200
commitfc55ae56a457aa489da0ad72fac598f40d0df8c3 (patch)
tree8c4c1e99676ee5e586b21be6d5d7395273148932
parentb208d47874bf39eba5f9aec2e3890dd82c303e40 (diff)
downloadbugs-fc55ae56a457aa489da0ad72fac598f40d0df8c3.tar
bugs-fc55ae56a457aa489da0ad72fac598f40d0df8c3.tar.gz
bugs-fc55ae56a457aa489da0ad72fac598f40d0df8c3.tar.bz2
bugs-fc55ae56a457aa489da0ad72fac598f40d0df8c3.tar.xz
bugs-fc55ae56a457aa489da0ad72fac598f40d0df8c3.zip
Backport upstream bug 1235772: Display all text/* attachments as plain
text in the "Details" page
-rw-r--r--template/en/default/attachment/edit.html.tmpl9
1 files changed, 7 insertions, 2 deletions
diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl
index 184cdde05..570b611b2 100644
--- a/template/en/default/attachment/edit.html.tmpl
+++ b/template/en/default/attachment/edit.html.tmpl
@@ -188,9 +188,12 @@
[% END %]
</a>
</p>
- [% ELSIF attachment.contenttype == "text/html" %]
+ [% ELSIF attachment.contenttype.match('^text/') %]
[%# For security reasons (clickjacking, embedded scripts), we never
- # render HTML pages from here. The source code is displayed instead. %]
+ # render HTML, XML or SVG pages directly. The source code for all
+ # text/* MIME types is displayed instead. If someone tries to abuse
+ # Bugzilla by manually editing the MIME type, it will be caught
+ # by the iframe below, thanks to its 'sandbox' attribute. %]
[% INCLUDE global/textarea.html.tmpl
id = 'viewFrame'
minrows = 10
@@ -199,6 +202,8 @@
readonly = 'readonly'
%]
[% ELSE %]
+ [%# The 'sandbox' attribute causes all scripts and form submissions
+ # embedded in the attachment to be disabled, for security reasons. %]
<iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]" sandbox>
<b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
<a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>