]> 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:55:03 +0000 (16:55 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 8 Feb 2012 15:55:03 +0000 (16:55 +0100)
r=dkl a=LpSolit

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

index 0db468bd25cf0cf8700f8a2c7eb98df5c914832e..44dc87fd47a59362bf8e08ea33d450b90e102408 100644 (file)
@@ -232,6 +232,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 15e20e894c5ff4d9a015ad784b65c644aa23f719..0bfabc1535d7453653ba400e8a0f38a02a40d8ab 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.*.