]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 507389: [SECURITY] Users can see all products when editing bugs - Patch by FrÃ...
authorlpsolit%gmail.com <>
Sat, 1 Aug 2009 12:37:49 +0000 (12:37 +0000)
committerlpsolit%gmail.com <>
Sat, 1 Aug 2009 12:37:49 +0000 (12:37 +0000)
t/008filter.t
template/en/default/bug/edit.html.tmpl
template/en/default/bug/field.html.tmpl

index 9a53ced93a8bc1d3d25c20a14e70e79c551e7087..ec9e21f51ccc70cafa01cc775a943c49a5b3fd1a 100644 (file)
@@ -211,7 +211,7 @@ sub directive_ok {
     return 1 if $directive =~ /^(time2str|url)\(/;
 
     # Safe Template Toolkit virtual methods
-    return 1 if $directive =~ /\.(length$|size$|push\(|delete\()/;
+    return 1 if $directive =~ /\.(length$|size$|push\(|unshift\(|delete\()/;
 
     # Special Template Toolkit loop variable
     return 1 if $directive =~ /^loop\.(index|count)$/;
index de89f1b8e7bd48ae65cb3050e645d50ebbb055a4..3c45a0813a06c14131fb3605e037058594c2adcd 100644 (file)
     [%#############%]
     
     <tr>
+       [% IF bug.check_can_change_field('product', 0, 1) %]
+         [% prod_list = user.get_enterable_products %]
+         [% IF NOT user.can_enter_product(bug.product) %]
+           [% prod_list.unshift(bug.product_obj) %]
+         [% END %]
+       [% END %]
+
        [% INCLUDE bug/field.html.tmpl
             bug = bug, field = select_fields.product,
+            override_legal_values = prod_list
             desc_url = 'describecomponents.cgi', value = bug.product
             editable = bug.check_can_change_field('product', 0, 1) %]
     </tr>
index d02f9801bac2b9677a531d9552dc9817e1756723..b7c45511fded16f2cb159b7c4db062c4d84aebc2 100644 (file)
@@ -23,6 +23,7 @@
 [%# INTERFACE:
   #   field: a Bugzilla::Field object
   #   value: The value of the field for this bug.
+  #   override_legal_values (optional): The list of legal values, for select fields.
   #   editable: Whether the field should be displayed as an editable
   #             <input> or as just the plain text of its value.
   #   allow_dont_change: display the --do_not_change-- option for select fields.
               [% dontchange FILTER html %]
             </option>
           [% END %]
-          [% FOREACH legal_value = field.legal_values %]
+          [% IF NOT override_legal_values %]
+            [% override_legal_values = field.legal_values %]
+          [% END %]
+          [% FOREACH legal_value = override_legal_values %]
             [% SET control_value = legal_value.visibility_value %]
             [% SET control_field = field.value_field %]
             <option value="[% legal_value.name FILTER html %]"