]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 243463 Use a param to protect new charts from leaking information
authorbugreport%peshkin.net <>
Tue, 6 Jul 2004 08:12:29 +0000 (08:12 +0000)
committerbugreport%peshkin.net <>
Tue, 6 Jul 2004 08:12:29 +0000 (08:12 +0000)
r=justdave
a=justdave

chart.cgi
defparams.pl
editproducts.cgi
template/en/default/reports/menu.html.tmpl

index 229e9bbf7b689416645d8a3b263cb517cf95f511..b6f7f746b541458d792eef7015081d7316abff3f 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -84,6 +84,10 @@ if ($action eq "search") {
 
 Bugzilla->login(LOGIN_REQUIRED);
 
+UserInGroup(Param("chartgroup")) 
+    || ThrowUserError("authorization_failure", 
+                     {action => "use this feature"});
+
 # Only admins may create public queries
 UserInGroup('admin') || $cgi->delete('public');
 
index 849c033eacc086a70941194f33ce9763c317de12..6861d04476944e855f95ebc5102ee89eb656803f 100644 (file)
@@ -1034,6 +1034,17 @@ Reason: %reason%
    checker => \&check_numeric
   },
 
+  {
+   name => 'chartgroup',
+   desc => 'The name of the group of users who can use the "New Charts" ' .
+           'feature. Administrators should ensure that the public categories ' .
+           'and series definitions do not divulge unwanted information ' .
+           'before enabling this for an untrusted population. If left blank, ' .
+           'no users will be able to use New Charts.',
+   type => 't',
+   default => ''
+  },
+  
   {
    name => 'insidergroup',
    desc => 'The name of the group of users who can see/change private ' .
index 8cf9a309d71867d5d72959911cd6808c9908c046..6d33c80804d86a16b52a1c9865795549e4caceee 100755 (executable)
@@ -271,6 +271,10 @@ if ($action eq 'add') {
     print "</TR><TR>\n";
     print "  <TH ALIGN=\"right\">Version:</TH>\n";
     print "  <TD><INPUT SIZE=64 MAXLENGTH=255 NAME=\"version\" VALUE=\"unspecified\"></TD>\n";
+    print "</TR><TR>\n";
+    print "  <TH ALIGN=\"right\">Create chart datasets for this product:</TH>\n";
+    print "  <TD><INPUT TYPE=CHECKBOX NAME=\"createseries\" VALUE=1></TD>";
+    print "</TR>\n";
 
     print "</TABLE>\n<HR>\n";
     print "<INPUT TYPE=SUBMIT VALUE=\"Add\">\n";
@@ -389,36 +393,37 @@ if ($action eq 'new') {
                 CONTROLMAPNA . ", 0)");
     }
 
-    # Insert default charting queries for this product.
-    # If they aren't using charting, this won't do any harm.
-    GetVersionTable();
-
-    my @series;
-
-    # We do every status, every resolution, and an "opened" one as well.
-    foreach my $bug_status (@::legal_bug_status) {
-        push(@series, [$bug_status, "bug_status=$bug_status"]);
-    }
+    if ($::FORM{createseries}) {
+        # Insert default charting queries for this product.
+        # If they aren't using charting, this won't do any harm.
+        GetVersionTable();
+    
+        my @series;
+    
+        # We do every status, every resolution, and an "opened" one as well.
+        foreach my $bug_status (@::legal_bug_status) {
+            push(@series, [$bug_status, "bug_status=$bug_status"]);
+        }
 
-    foreach my $resolution (@::legal_resolution) {
-        next if !$resolution;
-        push(@series, [$resolution, "resolution=$resolution"]);
-    }
+        foreach my $resolution (@::legal_resolution) {
+            next if !$resolution;
+            push(@series, [$resolution, "resolution=$resolution"]);
+        }
 
-    # For localisation reasons, we get the name of the "global" subcategory
-    # and the title of the "open" query from the submitted form.
-    my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
-    my $query = join("&", map { "bug_status=$_" } @openedstatuses);
-    push(@series, [$::FORM{'open_name'}, $query]);
-
-    foreach my $sdata (@series) {
-        my $series = new Bugzilla::Series(undef, $product, 
-                                          $::FORM{'subcategory'},
-                                          $sdata->[0], $::userid, 1,
-                                          $sdata->[1] . "&product=$product", 1);
-        $series->writeToDatabase();
+        # For localisation reasons, we get the name of the "global" subcategory
+        # and the title of the "open" query from the submitted form.
+        my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
+        my $query = join("&", map { "bug_status=$_" } @openedstatuses);
+        push(@series, [$::FORM{'open_name'}, $query]);
+    
+        foreach my $sdata (@series) {
+            my $series = new Bugzilla::Series(undef, $product, 
+                                              $::FORM{'subcategory'},
+                                              $sdata->[0], $::userid, 1,
+                                              $sdata->[1] . "&product=$product", 1);
+            $series->writeToDatabase();
+        }
     }
-
     # Make versioncache flush
     unlink "$datadir/versioncache";
 
index 7481790fd07fca5f6d1a33f56b16e53c165a448a..5ac1516d5edd0901dfea0bc6e898ed6db9d10d66 100644 (file)
     plot the status and/or resolution of [% terms.bugs %] against
     time, for each product in your database.
   </li>
-  <li>
-    <strong><a href="chart.cgi">New Charts</a></strong> - 
-    plot any arbitrary search against time. Far more powerful.
-  </li>
+  [% IF UserInGroup(Param("chartgroup")) %]
+    <li>
+      <strong><a href="chart.cgi">New Charts</a></strong> - 
+      plot any arbitrary search against time. Far more powerful.
+    </li>
+  [% END %]
 </ul>
 
 [% PROCESS global/footer.html.tmpl %]