]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 621108: [SECURITY] Creating/editing charts lacks CSRF protection
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 24 Jan 2011 17:14:08 +0000 (18:14 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 24 Jan 2011 17:14:08 +0000 (18:14 +0100)
r=dkl a=LpSolit

chart.cgi
template/en/default/reports/edit-series.html.tmpl
template/en/default/search/search-create-series.html.tmpl

index 12ef8d8345f317dac931ca09a1ee58944cb30a28..a04cde06829270f84b830c745862f3d606d9a56c 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -146,6 +146,8 @@ elsif ($action eq "wrap") {
 }
 elsif ($action eq "create") {
     assertCanCreate($cgi);
+    my $token = $cgi->param('token');
+    check_hash_token($token, ['create-series']);
     
     my $series = new Bugzilla::Series($cgi);
 
@@ -164,9 +166,11 @@ elsif ($action eq "edit") {
     edit($series);
 }
 elsif ($action eq "alter") {
-    assertCanEdit($series_id);
+    my $series = assertCanEdit($series_id);
+    my $token = $cgi->param('token');
+    check_hash_token($token, [$series->id, $series->name]);
     # XXX - This should be replaced by $series->set_foo() methods.
-    my $series = new Bugzilla::Series($cgi);
+    $series = new Bugzilla::Series($cgi);
 
     # We need to check if there is _another_ series in the database with
     # our (potentially new) name. So we call existsInDatabase() to see if
index 214bbcd75b94d23244cf37fae2be9cc0d4262262..527a84f0a4d83349fe81403908804fd817b0e687 100644 (file)
@@ -40,6 +40,8 @@
   [% PROCESS reports/series.html.tmpl 
      button_name = "Change Data Set" %]
   <input type="hidden" name="action" value="alter">
+  <input type="hidden" name="token"
+         value="[% issue_hash_token([default.id, default.name]) FILTER html %]">
   
   [% IF default.series_id %]
     <input type="hidden" name="series_id" value="[% default.series_id %]">
index 2aa5224c45b1145bfcd32eee0ef32cc0c84907fb..468324abd30bcb02d6515bbffb54eccca304cff3 100644 (file)
@@ -54,6 +54,7 @@
 [% PROCESS reports/series.html.tmpl 
    button_name = "Create Data Set" %]
   <input type="hidden" name="action" value="create">
+  <input type="hidden" name="token" value="[% issue_hash_token(['create-series']) FILTER html %]">
 
 <script type="text/javascript">
   document.chartform.category[0].selected = true;