Commit 1b925f4b authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 731178 (CVE-2012-4199): [SECURITY] field-events.js.tmpl discloses product…

Bug 731178 (CVE-2012-4199): [SECURITY] field-events.js.tmpl discloses product and component names that the user is not allowed to see r=dkl a=LpSolit
parent 718f80ed
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
[% PROCESS bug/time.html.tmpl %] [% PROCESS bug/time.html.tmpl %]
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
[% IF user.is_timetracker %] [% IF user.is_timetracker %]
var fRemainingTime = [% bug.remaining_time %]; // holds the original value var fRemainingTime = [% bug.remaining_time %]; // holds the original value
function adjustRemainingTime() { function adjustRemainingTime() {
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
} }
[% END %] [% END %]
[% IF user.id %]
/* Index all classifications so we can keep track of the classification /* Index all classifications so we can keep track of the classification
* for the selected product, which could control field visibility. * for the selected product, which could control field visibility.
*/ */
...@@ -38,9 +39,9 @@ ...@@ -38,9 +39,9 @@
all_classifications['[% product.name FILTER js %]'] = ' all_classifications['[% product.name FILTER js %]'] = '
[%- product.classification.name FILTER js %]'; [%- product.classification.name FILTER js %]';
[%- END %] [%- END %]
[% END %]
//--> //-->
</script> </script>
<form name="changeform" id="changeform" method="post" action="process_bug.cgi"> <form name="changeform" id="changeform" method="post" action="process_bug.cgi">
......
...@@ -13,11 +13,23 @@ ...@@ -13,11 +13,23 @@
#%] #%]
[% FOREACH controlled_field = field.controls_visibility_of %] [% 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 %]', showFieldWhen('[% controlled_field.name FILTER js %]',
'[% field.name FILTER js %]', [ '[% field.name FILTER js %]', [
[%- FOREACH visibility_value = controlled_field.visibility_values -%] [%~ FOREACH vis_name = vis_names ~%]
'[%- visibility_value.name FILTER js -%]'[% "," UNLESS loop.last %] '[% vis_name FILTER js %]'[% "," UNLESS loop.last %]
[%- END %] [%~ END ~%]
]); ]);
[% END %] [% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment