]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 731178 (CVE-2012-4199): [SECURITY] field-events.js.tmpl discloses product and...
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 13 Nov 2012 17:09:30 +0000 (18:09 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 13 Nov 2012 17:09:30 +0000 (18:09 +0100)
r=dkl a=LpSolit

template/en/default/bug/edit.html.tmpl
template/en/default/bug/field-events.js.tmpl

index bdee838066be48c99c67f886d96a30dbdc521e17..fbc6e4a96d2b9c804681dd7ffa73783125041734 100644 (file)
@@ -30,9 +30,8 @@
 
 [% PROCESS bug/time.html.tmpl %]
 
-  <script type="text/javascript">
-  <!--
-  
+<script type="text/javascript">
+<!--
   /* Outputs a link to call replyToComment(); used to reduce HTML output */
   function addReplyLink(id, real_id) {
       /* XXX this should really be updated to use the DOM Core's
 
 [% END %]
 
+[% IF user.id %]
   /* Index all classifications so we can keep track of the classification
    * for the selected product, which could control field visibility.
    */
       all_classifications['[% product.name FILTER js %]'] = '
           [%- product.classification.name FILTER js %]';
   [%- END %]
-
-  //-->
-  </script>
+[% END %]
+//-->
+</script>
 
 <form name="changeform" id="changeform" method="post" action="process_bug.cgi">
 
index 13ec18d38cb4873a8a74cd37e1b2af456401887b..f1d5afd3261d8c1a5b88ea220996f9d1de8f6610 100644 (file)
   #%]
 
 [% FOREACH controlled_field = field.controls_visibility_of %]
+  [% vis_names = [] %]
+  [% FOREACH visibility_value = controlled_field.visibility_values %]
+    [%# Exclude non-enterable products and components outside the current product. %]
+    [% NEXT IF field.name == "product"
+               && visibility_value.id != product.id
+               && !user.can_enter_product(visibility_value) %]
+    [% NEXT IF field.name == "component" && visibility_value.product_id != product.id %]
+    [% vis_names.push(visibility_value.name) %]
+  [% END %]
+
+  [% NEXT UNLESS vis_names.size %]
+
   showFieldWhen('[% controlled_field.name FILTER js %]',
                 '[% field.name FILTER js %]', [
-  [%- FOREACH visibility_value = controlled_field.visibility_values -%]
-    '[%- visibility_value.name FILTER js -%]'[% "," UNLESS loop.last %]
-  [%- END %]
+                [%~ FOREACH vis_name = vis_names ~%]
+                  '[% vis_name FILTER js %]'[% "," UNLESS loop.last %]
+                [%~ END ~%]
   ]);
 [% END %]