]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 722161: Clickjacking is possible in "View All" with HTML attachments
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 8 Feb 2012 15:51:48 +0000 (16:51 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 8 Feb 2012 15:51:48 +0000 (16:51 +0100)
r=dkl a=LpSolit

skins/standard/attachment.css
template/en/default/attachment/show-multiple.html.tmpl

index 287160331800eed3f5c05b75511ed0e215b613d5..55e62f2b0f7051fb6002ac9f5d14c488499f1652 100644 (file)
@@ -221,6 +221,11 @@ div#update_container {
     margin-left: 2%;
 }
 
+.viewall_frame {
+    width: 75%;
+    height: 350px;
+}
+
 .details span.bz_private{
   border-left: 1px solid darkred;
   padding-left: 0.5em;
index e238e5f49a24dc061f952c9806ee098b86e9a63f..91768c0d30452649b061592a41cfd6ac1e225331 100644 (file)
   </table>
 
   [% IF a.is_viewable %]
-    <iframe src="attachment.cgi?id=[% a.id %]" width="75%" height="350">
-      <b>You cannot view the attachment on this page because your browser does not support IFRAMEs.
-      <a href="attachment.cgi?id=[% a.id %]">View the attachment on a separate page</a>.</b>
-    </iframe>
+    [% IF a.contenttype == "text/html" %]
+      [%# For security reasons (clickjacking, embedded scripts), we never
+        # render HTML pages from here. The source code is displayed instead. %]
+      [% INCLUDE global/textarea.html.tmpl
+         minrows = 10
+         cols    = 80
+         defaultcontent = a.data
+         readonly = 'readonly'
+         classes = 'viewall_frame'
+      %]
+    [% ELSE %]
+      <iframe src="attachment.cgi?id=[% a.id %]" class="viewall_frame">
+        <b>You cannot view the attachment on this page because your browser does not support IFRAMEs.
+        <a href="attachment.cgi?id=[% a.id %]">View the attachment on a separate page</a>.</b>
+      </iframe>
+    [% END %]
   [% ELSE %]
     <p><b>
       Attachment cannot be viewed because its MIME type is not text/*, image/*, or application/vnd.mozilla.*.