]> 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:15:40 +0000 (18:15 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 24 Jan 2011 17:15:40 +0000 (18:15 +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 b4c82adae1dcef480166e4bc29bbb494d38ae56e..720050344054d58be4f9917c1272a6e35dce3ae6 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 da1011e10c39f015ec117471c3eecb09e405ab1a..26010af648bc009b3fc020510d918a2b92442de4 100644 (file)
@@ -52,6 +52,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;