]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 716283: Clickjacking in the attachment "Details" page allows to bypass token...
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 10 Jan 2012 00:03:49 +0000 (01:03 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 10 Jan 2012 00:03:49 +0000 (01:03 +0100)
r=dkl a=LpSolit

template/en/default/attachment/edit.html.tmpl
template/en/default/global/textarea.html.tmpl

index c0d30610aeb3efd6be64705b19f7723124df8811..876d47e55ec4be5ce67441891d4a974f72f4a31d 100644 (file)
               defaultcontent = (attachment.contenttype.match('^text\/')) ?
                                  attachment.data.replace('(.*\n|.+)', '>$1') : undef
             %]
-            <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
-              <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>
-            </iframe>
+            [% IF attachment.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
+                 id      = 'viewFrame'
+                 minrows = 10
+                 cols    = 80
+                 defaultcontent = attachment.data
+                 readonly = 'readonly'
+              %]
+            [% ELSE %]
+              <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
+                <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>
+              </iframe>
+            [% END %]
             <script type="text/javascript">
               <!--
               var patchviewerinstalled = 0;
index c158615bd723afd431dadc57966622fb5b5da9ae..ac7ab04ec43f0d74b504c0e62bab01865caa613a 100644 (file)
@@ -21,6 +21,8 @@
   # style:          (optional) The "style"-attribute of the textarea.
   # classes:        (optional) The "class"-attribute of the textarea.
   # wrap:           (deprecated; optional) The "wrap"-attribute of the textarea.
+  # disabled:       (optional) Disable the textarea.
+  # readonly:       (optional) Prevent the textarea from being edited.
   # minrows:        (required) Number of rows the textarea shall have initially
   #                 and when not having focus.
   # maxrows:        (optional) Number of rows the textarea shall have if
@@ -42,6 +44,7 @@
           [% IF classes %] class="[% classes FILTER html %]"[% END %]
           [% IF wrap %] wrap="[% wrap FILTER html %]"[% END %]
           [% IF disabled %] disabled="disabled"[% END %]
+          [% IF readonly %] readonly="readonly"[% END %]
           [% IF defaultrows && user.settings.zoom_textareas.value == 'off' %]
             rows="[% defaultrows FILTER html %]"
           [% ELSE %]