]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones...
authorlpsolit%gmail.com <>
Sun, 15 Oct 2006 05:05:54 +0000 (05:05 +0000)
committerlpsolit%gmail.com <>
Sun, 15 Oct 2006 05:05:54 +0000 (05:05 +0000)
53 files changed:
Bugzilla/Token.pm
editclassifications.cgi
editcomponents.cgi
editflagtypes.cgi
editgroups.cgi
editkeywords.cgi
editmilestones.cgi
editparams.cgi
editproducts.cgi
editsettings.cgi
editusers.cgi
editvalues.cgi
editversions.cgi
editwhines.cgi
relogin.cgi
skins/standard/global.css
template/en/default/admin/classifications/add.html.tmpl
template/en/default/admin/classifications/del.html.tmpl
template/en/default/admin/classifications/edit.html.tmpl
template/en/default/admin/classifications/reclassify.html.tmpl
template/en/default/admin/components/confirm-delete.html.tmpl
template/en/default/admin/components/create.html.tmpl
template/en/default/admin/components/edit.html.tmpl
template/en/default/admin/confirm-action.html.tmpl [new file with mode: 0644]
template/en/default/admin/fieldvalues/confirm-delete.html.tmpl
template/en/default/admin/fieldvalues/create.html.tmpl
template/en/default/admin/fieldvalues/edit.html.tmpl
template/en/default/admin/flag-type/confirm-delete.html.tmpl
template/en/default/admin/flag-type/edit.html.tmpl
template/en/default/admin/flag-type/list.html.tmpl
template/en/default/admin/groups/create.html.tmpl
template/en/default/admin/groups/delete.html.tmpl
template/en/default/admin/groups/edit.html.tmpl
template/en/default/admin/keywords/confirm-delete.html.tmpl
template/en/default/admin/keywords/create.html.tmpl
template/en/default/admin/keywords/edit.html.tmpl
template/en/default/admin/milestones/confirm-delete.html.tmpl
template/en/default/admin/milestones/create.html.tmpl
template/en/default/admin/milestones/edit.html.tmpl
template/en/default/admin/params/editparams.html.tmpl
template/en/default/admin/products/confirm-delete.html.tmpl
template/en/default/admin/products/create.html.tmpl
template/en/default/admin/products/edit.html.tmpl
template/en/default/admin/products/groupcontrol/edit.html.tmpl
template/en/default/admin/settings/edit.html.tmpl
template/en/default/admin/users/confirm-delete.html.tmpl
template/en/default/admin/users/create.html.tmpl
template/en/default/admin/users/edit.html.tmpl
template/en/default/admin/versions/confirm-delete.html.tmpl
template/en/default/admin/versions/create.html.tmpl
template/en/default/admin/versions/edit.html.tmpl
template/en/default/filterexceptions.pl
template/en/default/whine/schedule.html.tmpl

index dfc7be418f3e4b36f10bc4598214cf68f5ba174d..dcf476c810fed85f80d678fdc1c17d8fe64ced9f 100644 (file)
@@ -18,6 +18,7 @@
 # Rights Reserved.
 #
 # Contributor(s):    Myk Melez <myk@mozilla.org>
+#                    Frédéric Buclin <LpSolit@gmail.com>
 
 ################################################################################
 # Module Initialization
@@ -36,6 +37,11 @@ use Bugzilla::Util;
 
 use Date::Format;
 use Date::Parse;
+use File::Basename;
+
+use base qw(Exporter);
+
+@Bugzilla::Token::EXPORT = qw(issue_session_token check_token_data delete_token);
 
 # This module requires that its caller have said "require globals.pl" to import
 # relevant functions from that script.
@@ -132,7 +138,7 @@ sub IssuePasswordToken {
     Bugzilla::BugMail::MessageToMTA($message);
 }
 
-sub IssueSessionToken {
+sub issue_session_token {
     # Generates a random token, adds it to the tokens table, and returns
     # the token to the caller.
 
@@ -223,7 +229,7 @@ sub Cancel {
     Bugzilla::BugMail::MessageToMTA($message);
 
     # Delete the token from the database.
-    DeleteToken($token);
+    delete_token($token);
 }
 
 sub DeletePasswordTokens {
@@ -258,6 +264,7 @@ sub GetTokenData {
 
     my ($token) = @_;
     return unless defined $token;
+    $token = clean_text($token);
     trick_taint($token);
     
     my $dbh = Bugzilla->dbh;
@@ -267,7 +274,7 @@ sub GetTokenData {
          WHERE  token = ?", undef, $token);
 }
 
-sub DeleteToken {
+sub delete_token {
     # Deletes specified token
 
     my ($token) = @_;
@@ -280,6 +287,50 @@ sub DeleteToken {
     $dbh->bz_unlock_tables();
 }
 
+# Given a token, makes sure it comes from the currently logged in user
+# and match the expected event. Returns 1 on success, else displays a warning.
+# Note: this routine must not be called while tables are locked as it will try
+# to lock some tables itself, see CleanTokenTable().
+sub check_token_data {
+    my ($token, $expected_action) = @_;
+    my $user = Bugzilla->user;
+    my $template = Bugzilla->template;
+    my $cgi = Bugzilla->cgi;
+
+    my ($creator_id, $date, $token_action) = GetTokenData($token);
+    unless ($creator_id
+            && $creator_id == $user->id
+            && $token_action eq $expected_action)
+    {
+        # Something is going wrong. Ask confirmation before processing.
+        # It is possible that someone tried to trick an administrator.
+        # In this case, we want to know his name!
+        require Bugzilla::User;
+
+        my $vars = {};
+        $vars->{'abuser'} = Bugzilla::User->new($creator_id)->identity;
+        $vars->{'token_action'} = $token_action;
+        $vars->{'expected_action'} = $expected_action;
+        $vars->{'script_name'} = basename($0);
+
+        # Now is a good time to remove old tokens from the DB.
+        CleanTokenTable();
+
+        # If no token was found, create a valid token for the given action.
+        unless ($creator_id) {
+            $token = issue_session_token($expected_action);
+            $cgi->param('token', $token);
+        }
+
+        print $cgi->header();
+
+        $template->process('admin/confirm-action.html.tmpl', $vars)
+          || ThrowTemplateError($template->error());
+        exit;
+    }
+    return 1;
+}
+
 ################################################################################
 # Internal Functions
 ################################################################################
index 352d7816b9584b8f3a396ba610a7ae8927ef8f48..ac4ed9feadd3635c32c0f0a82c5cd1112b8d785b 100755 (executable)
@@ -29,6 +29,7 @@ use Bugzilla::Util;
 use Bugzilla::Error;
 use Bugzilla::Config qw($datadir);
 use Bugzilla::Classification;
+use Bugzilla::Token;
 
 require "globals.pl";
 
@@ -68,7 +69,8 @@ ThrowUserError("auth_classification_not_enabled") unless Param("useclassificatio
 #
 my $action     = trim($cgi->param('action')         || '');
 my $class_name = trim($cgi->param('classification') || '');
-    
+my $token      = $cgi->param('token');
+
 #
 # action='' -> Show nice list of classifications
 #
@@ -88,6 +90,7 @@ unless ($action) {
 #
 
 if ($action eq 'add') {
+    $vars->{'token'} = issue_session_token('add_classification');
     LoadTemplate($action);
 }
 
@@ -96,7 +99,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
-
+    check_token_data($token, 'add_classification');
     $class_name || ThrowUserError("classification_not_specified");
 
     my $classification =
@@ -119,7 +122,7 @@ if ($action eq 'new') {
     unlink "$datadir/versioncache";
 
     $vars->{'classification'} = $class_name;
-
+    delete_token($token);
     LoadTemplate($action);
 }
 
@@ -143,7 +146,7 @@ if ($action eq 'del') {
     }
 
     $vars->{'classification'} = $classification;
-
+    $vars->{'token'} = issue_session_token('delete_classification');
     LoadTemplate($action);
 }
 
@@ -152,7 +155,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
-
+    check_token_data($token, 'delete_classification');
     my $classification =
         Bugzilla::Classification::check_classification($class_name);
 
@@ -176,7 +179,7 @@ if ($action eq 'delete') {
     unlink "$datadir/versioncache";
 
     $vars->{'classification'} = $classification;
-
+    delete_token($token);
     LoadTemplate($action);
 }
 
@@ -192,7 +195,7 @@ if ($action eq 'edit') {
         Bugzilla::Classification::check_classification($class_name);
 
     $vars->{'classification'} = $classification;
-
+    $vars->{'token'} = issue_session_token('edit_classification');
     LoadTemplate($action);
 }
 
@@ -201,7 +204,7 @@ if ($action eq 'edit') {
 #
 
 if ($action eq 'update') {
-
+    check_token_data($token, 'edit_classification');
     $class_name || ThrowUserError("classification_not_specified");
 
     my $class_old_name = trim($cgi->param('classificationold') || '');
@@ -240,7 +243,7 @@ if ($action eq 'update') {
     }
 
     $dbh->bz_unlock_tables();
-
+    delete_token($token);
     LoadTemplate($action);
 }
 
@@ -257,26 +260,30 @@ if ($action eq 'reclassify') {
                              WHERE name = ?");
 
     if (defined $cgi->param('add_products')) {
+        check_token_data($token, 'reclassify_classifications');
         if (defined $cgi->param('prodlist')) {
             foreach my $prod ($cgi->param("prodlist")) {
                 trick_taint($prod);
                 $sth->execute($classification->id, $prod);
             }
         }
+        delete_token($token);
     } elsif (defined $cgi->param('remove_products')) {
+        check_token_data($token, 'reclassify_classifications');
         if (defined $cgi->param('myprodlist')) {
             foreach my $prod ($cgi->param("myprodlist")) {
                 trick_taint($prod);
                 $sth->execute(1,$prod);
             }
         }
+        delete_token($token);
     }
 
     my @classifications = 
         Bugzilla::Classification::get_all_classifications;
     $vars->{'classifications'} = \@classifications;
     $vars->{'classification'} = $classification;
-
+    $vars->{'token'} = issue_session_token('reclassify_classifications');
     LoadTemplate($action);
 }
 
index c65fd3167232076b7adcf701592dd16f2273b18d..70ead70a72450b9e08b2abb1fe10dc47930ed367 100755 (executable)
@@ -39,6 +39,7 @@ use Bugzilla::User;
 use Bugzilla::Product;
 use Bugzilla::Component;
 use Bugzilla::Bug;
+use Bugzilla::Token;
 
 my $cgi = Bugzilla->cgi;
 my $dbh = Bugzilla->dbh;
@@ -66,6 +67,7 @@ my $product_name  = trim($cgi->param('product')     || '');
 my $comp_name     = trim($cgi->param('component')   || '');
 my $action        = trim($cgi->param('action')      || '');
 my $showbugcounts = (defined $cgi->param('showbugcounts'));
+my $token         = $cgi->param('token');
 
 #
 # product = '' -> Show nice list of products
@@ -111,7 +113,7 @@ unless ($action) {
 #
 
 if ($action eq 'add') {
-
+    $vars->{'token'} = issue_session_token('add_component');
     $vars->{'product'} = $product->name;
     $template->process("admin/components/create.html.tmpl", $vars)
         || ThrowTemplateError($template->error());
@@ -126,7 +128,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
-    
+    check_token_data($token, 'add_component');
     # Do the user matching
     Bugzilla::User::match_field ($cgi, {
         'initialowner'     => { 'type' => 'single' },
@@ -213,6 +215,7 @@ if ($action eq 'new') {
 
     $vars->{'name'} = $comp_name;
     $vars->{'product'} = $product->name;
+    delete_token($token);
     $template->process("admin/components/created.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
@@ -229,7 +232,7 @@ if ($action eq 'new') {
 #
 
 if ($action eq 'del') {
-    
+    $vars->{'token'} = issue_session_token('delete_component');
     $vars->{'comp'} =
         Bugzilla::Component::check_component($product, $comp_name);
 
@@ -248,7 +251,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
-
+    check_token_data($token, 'delete_component');
     my $component =
         Bugzilla::Component::check_component($product, $comp_name);
 
@@ -282,6 +285,7 @@ if ($action eq 'delete') {
 
     $vars->{'name'} = $component->name;
     $vars->{'product'} = $product->name;
+    delete_token($token);
     $template->process("admin/components/deleted.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
     exit;
@@ -296,7 +300,7 @@ if ($action eq 'delete') {
 #
 
 if ($action eq 'edit') {
-
+    $vars->{'token'} = issue_session_token('edit_component');
     $vars->{'comp'} =
         Bugzilla::Component::check_component($product, $comp_name);
 
@@ -316,7 +320,7 @@ if ($action eq 'edit') {
 #
 
 if ($action eq 'update') {
-
+    check_token_data($token, 'edit_component');
     # Do the user matching
     Bugzilla::User::match_field ($cgi, {
         'initialowner'     => { 'type' => 'single' },
@@ -405,6 +409,7 @@ if ($action eq 'update') {
 
     $vars->{'name'} = $comp_name;
     $vars->{'product'} = $product->name;
+    delete_token($token);
     $template->process("admin/components/updated.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
index dfef556474b4c1ec3842c36cd4eb8b8f97018506..6ed20c47c366c1199e01eabdbb01b3333b106208 100755 (executable)
@@ -38,6 +38,7 @@ use Bugzilla::Flag;
 use Bugzilla::FlagType;
 use Bugzilla::Group;
 use Bugzilla::Util;
+use Bugzilla::Token;
 
 my $template = Bugzilla->template;
 my $vars = {};
@@ -66,11 +67,12 @@ my $component_id;
 
 # Determine whether to use the action specified by the user or the default.
 my $action = $cgi->param('action') || 'list';
+my $token  = $cgi->param('token');
 my @categoryActions;
 
 if (@categoryActions = grep(/^categoryAction-.+/, $cgi->param())) {
     $categoryActions[0] =~ s/^categoryAction-//;
-    processCategoryChange($categoryActions[0]);
+    processCategoryChange($categoryActions[0], $token);
     exit;
 }
 
@@ -78,11 +80,11 @@ if    ($action eq 'list')           { list();           }
 elsif ($action eq 'enter')          { edit();           }
 elsif ($action eq 'copy')           { edit();           }
 elsif ($action eq 'edit')           { edit();           }
-elsif ($action eq 'insert')         { insert();         }
-elsif ($action eq 'update')         { update();         }
+elsif ($action eq 'insert')         { insert($token);   }
+elsif ($action eq 'update')         { update($token);   }
 elsif ($action eq 'confirmdelete')  { confirmDelete();  } 
-elsif ($action eq 'delete')         { deleteType();     }
-elsif ($action eq 'deactivate')     { deactivate();     }
+elsif ($action eq 'delete')         { deleteType($token); }
+elsif ($action eq 'deactivate')     { deactivate($token); }
 else { 
     ThrowCodeError("action_unrecognized", { action => $action });
 }
@@ -128,9 +130,11 @@ sub edit {
     $vars->{'last_action'} = $cgi->param('action');
     if ($cgi->param('action') eq 'enter' || $cgi->param('action') eq 'copy') {
         $vars->{'action'} = "insert";
+        $vars->{'token'} = issue_session_token('add_flagtype');
     }
     else { 
         $vars->{'action'} = "update";
+        $vars->{'token'} = issue_session_token('edit_flagtype');
     }
     
     # If copying or editing an existing flag type, retrieve it.
@@ -168,7 +172,7 @@ sub edit {
 }
 
 sub processCategoryChange {
-    my $categoryAction = shift;
+    my ($categoryAction, $token) = @_;
     validateIsActive();
     validateIsRequestable();
     validateIsRequesteeble();
@@ -218,7 +222,8 @@ sub processCategoryChange {
     $type->{'inclusions'} = \%inclusions;
     $type->{'exclusions'} = \%exclusions;
     $vars->{'type'} = $type;
-    
+    $vars->{'token'} = $token;
+
     # Return the appropriate HTTP response headers.
     print $cgi->header();
 
@@ -243,6 +248,8 @@ sub clusion_array_to_hash {
 }
 
 sub insert {
+    my $token = shift;
+    check_token_data($token, 'add_flagtype');
     my $name = validateName();
     my $description = validateDescription();
     my $cc_list = validateCCList();
@@ -285,6 +292,7 @@ sub insert {
 
     $vars->{'name'} = $cgi->param('name');
     $vars->{'message'} = "flag_type_created";
+    delete_token($token);
 
     # Return the appropriate HTTP response headers.
     print $cgi->header();
@@ -296,6 +304,8 @@ sub insert {
 
 
 sub update {
+    my $token = shift;
+    check_token_data($token, 'edit_flagtype');
     my $id = validateID();
     my $name = validateName();
     my $description = validateDescription();
@@ -368,6 +378,7 @@ sub update {
     
     $vars->{'name'} = $cgi->param('name');
     $vars->{'message'} = "flag_type_changes_saved";
+    delete_token($token);
 
     # Return the appropriate HTTP response headers.
     print $cgi->header();
@@ -390,7 +401,7 @@ sub confirmDelete
   if ($count > 0) {
     $vars->{'flag_type'} = Bugzilla::FlagType::get($id);
     $vars->{'flag_count'} = scalar($count);
-
+    $vars->{'token'} = issue_session_token('delete_flagtype');
     # Return the appropriate HTTP response headers.
     print $cgi->header();
 
@@ -399,12 +410,15 @@ sub confirmDelete
       || ThrowTemplateError($template->error());
   } 
   else {
-    deleteType();
+    my $token = issue_session_token('delete_flagtype');
+    deleteType($token);
   }
 }
 
 
 sub deleteType {
+    my $token = shift;
+    check_token_data($token, 'delete_flagtype');
     my $id = validateID();
     my $dbh = Bugzilla->dbh;
 
@@ -423,6 +437,7 @@ sub deleteType {
     $dbh->bz_unlock_tables();
 
     $vars->{'message'} = "flag_type_deleted";
+    delete_token($token);
 
     # Return the appropriate HTTP response headers.
     print $cgi->header();
@@ -434,6 +449,8 @@ sub deleteType {
 
 
 sub deactivate {
+    my $token = shift;
+    check_token_data($token, 'delete_flagtype');
     my $id = validateID();
     validateIsActive();
 
@@ -445,7 +462,8 @@ sub deactivate {
     
     $vars->{'message'} = "flag_type_deactivated";
     $vars->{'flag_type'} = Bugzilla::FlagType::get($id);
-    
+    delete_token($token);
+
     # Return the appropriate HTTP response headers.
     print $cgi->header();
 
index fb0704bd9adb57c9b59ba2af49f28d04d65513c6..3d228b59b6ef2396006fa4d0a9bb9723836db638 100755 (executable)
@@ -34,6 +34,7 @@ use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin);
 use Bugzilla::Group;
 use Bugzilla::User;
+use Bugzilla::Token;
 require "globals.pl";
 
 my $cgi = Bugzilla->cgi;
@@ -51,6 +52,7 @@ $user->in_group('creategroups')
                                      object => "groups"});
 
 my $action = trim($cgi->param('action') || '');
+my $token  = $cgi->param('token');
 
 # RederiveRegexp: update user_group_map with regexp-based grants
 sub RederiveRegexp
@@ -250,6 +252,7 @@ if ($action eq 'changeform') {
     $vars->{'isactive'}    = $isactive;
     $vars->{'isbuggroup'}  = $isbuggroup;
     $vars->{'groups'}      = \@groups;
+    $vars->{'token'}       = issue_session_token('edit_group');
 
     print $cgi->header();
     $template->process("admin/groups/edit.html.tmpl", $vars)
@@ -265,6 +268,7 @@ if ($action eq 'changeform') {
 #
 
 if ($action eq 'add') {
+    $vars->{'token'} = issue_session_token('add_group');
     print $cgi->header();
     $template->process("admin/groups/create.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
@@ -279,6 +283,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
+    check_token_data($token, 'add_group');
     # Check that a not already used group name is given, that
     # a description is also given and check if the regular
     # expression is valid (if any).
@@ -315,6 +320,7 @@ if ($action eq 'new') {
                   undef, ($gid, CONTROLMAPSHOWN, CONTROLMAPNA));
     }
     RederiveRegexp($regexp, $gid);
+    delete_token($token);
 
     print $cgi->header();
     $template->process("admin/groups/created.html.tmpl", $vars)
@@ -380,6 +386,7 @@ if ($action eq 'del') {
     $vars->{'hasproduct'}  = $hasproduct;
     $vars->{'hasflags'}    = $hasflags;
     $vars->{'buglist'}     = $buglist;
+    $vars->{'token'}       = issue_session_token('delete_group');
 
     print $cgi->header();
     $template->process("admin/groups/delete.html.tmpl", $vars)
@@ -393,6 +400,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
+    check_token_data($token, 'delete_group');
     # Check that an existing group ID is given
     my $gid = CheckGroupID($cgi->param('group'));
     my ($name, $isbuggroup) =
@@ -475,6 +483,8 @@ if ($action eq 'delete') {
     $dbh->do('DELETE FROM groups WHERE id = ?',
               undef, $gid);
 
+    delete_token($token);
+
     print $cgi->header();
     $template->process("admin/groups/deleted.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
@@ -487,6 +497,7 @@ if ($action eq 'delete') {
 #
 
 if ($action eq 'postchanges') {
+    check_token_data($token, 'edit_group');
     # ZLL: Bug 181589: we need to have something to remove explicitly listed users from
     # groups in order for the conversion to 2.18 groups to work
     my $action;
@@ -508,7 +519,8 @@ if ($action eq 'postchanges') {
     if ($action == 2) {
         $vars->{'regexp'} = $regexp;
     }
-    
+    delete_token($token);
+
     print $cgi->header();
     $template->process("admin/groups/change.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
index e98be63060f51330c2e058e1e5a46aa86813f29e..e008cffc0062ff110bb1bc89b6abeed47226da28 100755 (executable)
@@ -28,6 +28,7 @@ require "globals.pl";
 use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
+use Bugzilla::Token;
 
 my $cgi = Bugzilla->cgi;
 my $dbh = Bugzilla->dbh;
@@ -76,6 +77,7 @@ $user->in_group('editkeywords')
                                      object => "keywords"});
 
 my $action  = trim($cgi->param('action')  || '');
+my $token   = $cgi->param('token');
 $vars->{'action'} = $action;
 
 
@@ -101,6 +103,7 @@ if ($action eq "") {
     
 
 if ($action eq 'add') {
+    $vars->{'token'} = issue_session_token('add_keyword');
     print $cgi->header();
 
     $template->process("admin/keywords/create.html.tmpl", $vars)
@@ -114,6 +117,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
+    check_token_data($token, 'add_keyword');
     # Cleanups and validity checks
 
     my $name = trim($cgi->param('name') || '');
@@ -154,6 +158,7 @@ if ($action eq 'new') {
 
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     print $cgi->header();
 
@@ -193,6 +198,7 @@ if ($action eq 'edit') {
     $vars->{'name'} = $name;
     $vars->{'description'} = $description;
     $vars->{'bug_count'} = $bugs;
+    $vars->{'token'} = issue_session_token('edit_keyword');
 
     print $cgi->header();
 
@@ -208,6 +214,7 @@ if ($action eq 'edit') {
 #
 
 if ($action eq 'update') {
+    check_token_data($token, 'edit_keyword');
     my $id = ValidateKeyID(scalar $cgi->param('id'));
 
     my $name  = trim($cgi->param('name') || '');
@@ -228,6 +235,7 @@ if ($action eq 'update') {
 
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     print $cgi->header();
 
@@ -250,10 +258,14 @@ if ($action eq 'delete') {
                                           WHERE keywordid = ?',
                                           undef, $id);
 
+        # We need this token even if there is no bug using this keyword.
+        $token = issue_session_token('delete_keyword');
+
         if ($bugs) {
             $vars->{'bug_count'} = $bugs;
             $vars->{'keyword_id'} = $id;
             $vars->{'name'} = $name;
+            $vars->{'token'} = $token;
 
             print $cgi->header();
 
@@ -263,12 +275,15 @@ if ($action eq 'delete') {
             exit;
         }
     }
+    # We cannot do this check earlier as we have to check 'reallydelete' first.
+    check_token_data($token, 'delete_keyword');
 
     $dbh->do('DELETE FROM keywords WHERE keywordid = ?', undef, $id);
     $dbh->do('DELETE FROM keyworddefs WHERE id = ?', undef, $id);
 
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     print $cgi->header();
 
index c87828526576bfe362dcf22a99c815fed06a9d27..cd2ce8ab0fa8e5cf11146213fefca008f3eb026e 100755 (executable)
@@ -12,7 +12,7 @@
 # Matt Masson <matthew@zeroknowledge.com>
 #
 # Contributors : Gavin Shelley <bugzilla@chimpychompy.org>
-#                Frédéric Buclin <LpSolit@gmail.com>
+#                Frédéric Buclin <LpSolit@gmail.com>
 #
 
 
@@ -26,6 +26,7 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
 use Bugzilla::Product;
 use Bugzilla::Milestone;
 use Bugzilla::Bug;
+use Bugzilla::Token;
 
 my $cgi = Bugzilla->cgi;
 my $dbh = Bugzilla->dbh;
@@ -54,6 +55,7 @@ my $milestone_name = trim($cgi->param('milestone')   || '');
 my $sortkey        = trim($cgi->param('sortkey')     || 0);
 my $action         = trim($cgi->param('action')      || '');
 my $showbugcounts = (defined $cgi->param('showbugcounts'));
+my $token          = $cgi->param('token');
 
 #
 # product = '' -> Show nice list of products
@@ -103,7 +105,7 @@ unless ($action) {
 #
 
 if ($action eq 'add') {
-
+    $vars->{'token'} = issue_session_token('add_milestone');
     $vars->{'product'} = $product->name;
     $template->process("admin/milestones/create.html.tmpl",
                        $vars)
@@ -119,7 +121,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
-
+    check_token_data($token, 'add_milestone');
     $milestone_name || ThrowUserError('milestone_blank_name');
 
     if (length($milestone_name) > 20) {
@@ -147,6 +149,7 @@ if ($action eq 'new') {
 
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'name'} = $milestone_name;
     $vars->{'product'} = $product->name;
@@ -179,6 +182,7 @@ if ($action eq 'del') {
     }
 
     $vars->{'bug_count'} = $milestone->bug_count;
+    $vars->{'token'} = issue_session_token('delete_milestone');
 
     $template->process("admin/milestones/confirm-delete.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
@@ -192,7 +196,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
-
+    check_token_data($token, 'delete_milestone');
     my $milestone =
         Bugzilla::Milestone::check_milestone($product,
                                              $milestone_name);
@@ -233,6 +237,7 @@ if ($action eq 'delete') {
              undef, ($product->id, $milestone->name));
 
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $template->process("admin/milestones/deleted.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
@@ -256,6 +261,7 @@ if ($action eq 'edit') {
     $vars->{'sortkey'} = $milestone->sortkey;
     $vars->{'name'}    = $milestone->name;
     $vars->{'product'} = $product->name;
+    $vars->{'token'}   = issue_session_token('edit_milestone');
 
     $template->process("admin/milestones/edit.html.tmpl",
                        $vars)
@@ -271,7 +277,7 @@ if ($action eq 'edit') {
 #
 
 if ($action eq 'update') {
-
+    check_token_data($token, 'edit_milestone');
     my $milestone_old_name = trim($cgi->param('milestoneold') || '');
     my $milestone_old =
         Bugzilla::Milestone::check_milestone($product,
@@ -350,6 +356,7 @@ if ($action eq 'update') {
     }
 
     $dbh->bz_unlock_tables();
+    delete_token($token);
 
     $vars->{'name'} = $milestone_name;
     $vars->{'product'} = $product->name;
index 57058e7ad7ed437f05497afecdd038404ca06f27..bd1b1f54576075f9593ce36de3ac0b5c1d750c7c 100755 (executable)
@@ -28,6 +28,7 @@ use lib ".";
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin :params $datadir);
 use Bugzilla::Config::Common;
+use Bugzilla::Token;
 
 require "globals.pl";
 use vars qw(@parampanels);
@@ -45,6 +46,7 @@ $user->in_group('tweakparams')
                                      object => "parameters"});
 
 my $action = trim($cgi->param('action') || '');
+my $token  = $cgi->param('token');
 my $current_panel = $cgi->param('section') || 'core';
 $current_panel =~ /^([A-Za-z0-9_-]+)$/;
 $current_panel = $1;
@@ -69,6 +71,7 @@ foreach my $panel (@parampanels) {
 $vars->{panels} = \@panels;
 
 if ($action eq 'save' && $current_module) {
+    check_token_data($token, 'edit_parameters');
     my @changes = ();
     my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list();
 
@@ -129,7 +132,10 @@ if ($action eq 'save' && $current_module) {
 
     WriteParams();
     unlink "$datadir/versioncache";
+    delete_token($token);
 }
 
+$vars->{'token'} = issue_session_token('edit_parameters');
+
 $template->process("admin/params/editparams.html.tmpl", $vars)
     || ThrowTemplateError($template->error());
index 29b3c3642297f56433842f8bdec1683bb3dd8421..75597f172222589430b59609375df5dd87626c7b 100755 (executable)
@@ -41,6 +41,7 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
 use Bugzilla::Product;
 use Bugzilla::Classification;
 use Bugzilla::Milestone;
+use Bugzilla::Token;
 
 # Shut up misguided -w warnings about "used only once".  "use vars" just
 # doesn't work for me.
@@ -72,6 +73,7 @@ my $classification_name = trim($cgi->param('classification') || '');
 my $product_name = trim($cgi->param('product') || '');
 my $action  = trim($cgi->param('action')  || '');
 my $showbugcounts = (defined $cgi->param('showbugcounts'));
+my $token = $cgi->param('token');
 
 #
 # product = '' -> Show nice list of classifications (if
@@ -132,6 +134,8 @@ if ($action eq 'add') {
             Bugzilla::Classification::check_classification($classification_name);
         $vars->{'classification'} = $classification;
     }
+    $vars->{'token'} = issue_session_token('add_product');
+
     $template->process("admin/products/create.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
 
@@ -144,7 +148,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
-
+    check_token_data($token, 'add_product');
     # Cleanups and validity checks
 
     my $classification_id = 1;
@@ -307,6 +311,7 @@ if ($action eq 'new') {
     }
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'product'} = $product;
     
@@ -341,6 +346,7 @@ if ($action eq 'del') {
     }
 
     $vars->{'product'} = $product;
+    $vars->{'token'} = issue_session_token('delete_product');
 
     $template->process("admin/products/confirm-delete.html.tmpl", $vars)
         || ThrowTemplateError($template->error());
@@ -352,6 +358,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
+    check_token_data($token, 'delete_product');
     # First make sure the product name is valid.
     my $product = Bugzilla::Product::check_product($product_name);
 
@@ -414,6 +421,7 @@ if ($action eq 'delete') {
     $dbh->bz_unlock_tables();
 
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $template->process("admin/products/deleted.html.tmpl", $vars)
         || ThrowTemplateError($template->error());
@@ -469,9 +477,9 @@ if ($action eq 'edit' || (!$action && $product_name)) {
         }
     }
     $vars->{'group_controls'} = $group_controls;
-
     $vars->{'product'} = $product;
-        
+    $vars->{'token'} = issue_session_token('edit_product');
+
     $template->process("admin/products/edit.html.tmpl", $vars)
         || ThrowTemplateError($template->error());
 
@@ -483,6 +491,7 @@ if ($action eq 'edit' || (!$action && $product_name)) {
 #
 
 if ($action eq 'updategroupcontrols') {
+    check_token_data($token, 'edit_group_controls');
     # First make sure the product name is valid.
     my $product = Bugzilla::Product::check_product($product_name);
 
@@ -724,10 +733,10 @@ if ($action eq 'updategroupcontrols') {
     }
     $dbh->bz_unlock_tables();
 
-    $vars->{'removed_na'} = \@removed_na;
+    delete_token($token);
 
+    $vars->{'removed_na'} = \@removed_na;
     $vars->{'added_mandatory'} = \@added_mandatory;
-
     $vars->{'product'} = $product;
 
     $template->process("admin/products/groupcontrol/updated.html.tmpl", $vars)
@@ -739,7 +748,7 @@ if ($action eq 'updategroupcontrols') {
 # action='update' -> update the product
 #
 if ($action eq 'update') {
-
+    check_token_data($token, 'edit_product');
     my $product_old_name    = trim($cgi->param('product_old_name')    || '');
     my $description         = trim($cgi->param('description')         || '');
     my $disallownew         = trim($cgi->param('disallownew')         || '');
@@ -976,6 +985,7 @@ if ($action eq 'update') {
         $vars->{'confirmedbugs'} = \@updated_bugs;
         $vars->{'changer'} = $user->login;
     }
+    delete_token($token);
 
     $vars->{'old_product'} = $product_old;
     $vars->{'product'} = $product;
@@ -1018,6 +1028,7 @@ if ($action eq 'editgroupcontrols') {
 
     $vars->{'product'} = $product;
     $vars->{'groups'} = $groups;
+    $vars->{'token'} = issue_session_token('edit_group_controls');
 
     $vars->{'const'} = {
         'CONTROLMAPNA' => CONTROLMAPNA,
index 231c1aea8c2b5802373bcddba5cb6cc6c49e121e..e4579f95acad0bc73f30180674c9e5e8c6efd2d4 100755 (executable)
@@ -22,6 +22,7 @@ use lib qw(.);
 use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::User::Setting;
+use Bugzilla::Token;
 
 require "globals.pl";
 
@@ -79,9 +80,12 @@ $user->in_group('tweakparams')
                                      object => "settings"});
 
 my $action  = trim($cgi->param('action')  || 'load');
+my $token   = $cgi->param('token');
 
 if ($action eq 'update') {
+    check_token_data($token, 'edit_settings');
     SaveSettings();
+    delete_token($token);
     $vars->{'changes_saved'} = 1;
 
     $template->process("admin/settings/updated.html.tmpl", $vars)
@@ -92,6 +96,7 @@ if ($action eq 'update') {
 
 if ($action eq 'load') {
     LoadSettings();
+    $vars->{'token'} = issue_session_token('edit_settings');
 
     $template->process("admin/settings/edit.html.tmpl", $vars)
       || ThrowTemplateError($template->error());
index 3e23d0808e1be6c88608139d01496501e6fe2a8c..36366aad73cfab0900b0303a14f48a66e978d4af 100755 (executable)
@@ -31,6 +31,7 @@ use Bugzilla::Constants;
 use Bugzilla::Util;
 use Bugzilla::Field;
 use Bugzilla::Group;
+use Bugzilla::Token;
 
 my $user = Bugzilla->login(LOGIN_REQUIRED);
 
@@ -55,6 +56,7 @@ print $cgi->header();
 my $action         = $cgi->param('action') || 'search';
 my $otherUserID    = $cgi->param('userid');
 my $otherUserLogin = $cgi->param('user');
+my $token          = $cgi->param('token');
 
 # Prefill template vars with data used in all or nearly all templates
 $vars->{'editusers'} = $editusers;
@@ -168,6 +170,8 @@ if ($action eq 'search') {
                                                   action => "add",
                                                   object => "users"});
 
+    $vars->{'token'} = issue_session_token('add_user');
+
     $template->process('admin/users/create.html.tmpl', $vars)
        || ThrowTemplateError($template->error());
 
@@ -177,6 +181,7 @@ if ($action eq 'search') {
                                                   action => "add",
                                                   object => "users"});
 
+    check_token_data($token, 'add_user');
     my $login        = $cgi->param('login');
     my $password     = $cgi->param('password');
     my $realname     = trim($cgi->param('name')         || '');
@@ -212,6 +217,10 @@ if ($action eq 'search') {
     $dbh->bz_unlock_tables();
     userDataToVars($new_user_id);
 
+    delete_token($token);
+
+    # We already display the updated page. We have to recreate a token now.
+    $vars->{'token'} = issue_session_token('edit_user');
     $vars->{'message'} = 'account_created';
     $template->process('admin/users/edit.html.tmpl', $vars)
        || ThrowTemplateError($template->error());
@@ -223,6 +232,7 @@ if ($action eq 'search') {
 
 ###########################################################################
 } elsif ($action eq 'update') {
+    check_token_data($token, 'edit_user');
     my $otherUser = check_user($otherUserID, $otherUserLogin);
     $otherUserID = $otherUser->id;
 
@@ -403,6 +413,7 @@ if ($action eq 'search') {
 
     # XXX: userDataToVars may be off when editing ourselves.
     userDataToVars($otherUserID);
+    delete_token($token);
 
     $vars->{'message'} = 'account_updated';
     $vars->{'loginold'} = $loginold;
@@ -411,6 +422,9 @@ if ($action eq 'search') {
     $vars->{'groups_removed_from'} = \@groupsRemovedFrom;
     $vars->{'groups_granted_rights_to_bless'} = \@groupsGrantedRightsToBless;
     $vars->{'groups_denied_rights_to_bless'} = \@groupsDeniedRightsToBless;
+    # We already display the updated page. We have to recreate a token now.
+    $vars->{'token'} = issue_session_token('edit_user');
+
     $template->process('admin/users/edit.html.tmpl', $vars)
        || ThrowTemplateError($template->error());
 
@@ -484,12 +498,14 @@ if ($action eq 'search') {
            AND mailto_type = ?
           },
         undef, ($otherUserID, MAILTO_USER));
+    $vars->{'token'} = issue_session_token('delete_user');
 
     $template->process('admin/users/confirm-delete.html.tmpl', $vars)
        || ThrowTemplateError($template->error());
 
 ###########################################################################
 } elsif ($action eq 'delete') {
+    check_token_data($token, 'delete_user');
     my $otherUser = check_user($otherUserID, $otherUserLogin);
     $otherUserID = $otherUser->id;
 
@@ -703,6 +719,7 @@ if ($action eq 'search') {
     $dbh->do('DELETE FROM profiles WHERE userid = ?', undef, $otherUserID);
 
     $dbh->bz_unlock_tables();
+    delete_token($token);
 
     $vars->{'message'} = 'account_deleted';
     $vars->{'otheruser'}{'login'} = $otherUser->login;
@@ -826,6 +843,7 @@ sub edit_processing {
                                            object => "user"});
 
     userDataToVars($otherUser->id);
+    $vars->{'token'} = issue_session_token('edit_user');
 
     $template->process('admin/users/edit.html.tmpl', $vars)
        || ThrowTemplateError($template->error());
index 21c7a14f4d5b8955c0d7c2f7759a41ebecc9e58e..b03fea609cd583db0c0105282bba0faad9761f73 100755 (executable)
@@ -27,6 +27,7 @@ use Bugzilla::Util;
 use Bugzilla::Error;
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin :locations);
+use Bugzilla::Token;
 
 # List of different tables that contain the changeable field values
 # (the old "enums.") Keep them in alphabetical order by their 
@@ -116,6 +117,7 @@ my $field   = trim($cgi->param('field')   || '');
 my $value   = trim($cgi->param('value')   || '');
 my $sortkey = trim($cgi->param('sortkey') || '0');
 my $action  = trim($cgi->param('action')  || '');
+my $token   = $cgi->param('token');
 
 # Gives the name of the parameter associated with the field
 # and representing its default value.
@@ -175,6 +177,8 @@ if ($action eq 'add') {
 
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
+    $vars->{'token'} = issue_session_token('add_field_value');
+
     $template->process("admin/fieldvalues/create.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
@@ -187,6 +191,7 @@ if ($action eq 'add') {
 # action='new' -> add field value entered in the 'action=add' screen
 #
 if ($action eq 'new') {
+    check_token_data($token, 'add_field_value');
     FieldMustExist($field);
     trick_taint($field);
 
@@ -218,6 +223,7 @@ if ($action eq 'new') {
     $sth->execute($value, $sortkey);
 
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
@@ -248,6 +254,8 @@ if ($action eq 'del') {
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
     $vars->{'param_name'} = $defaults{$field};
+    $vars->{'token'} = issue_session_token('delete_field_value');
+
     $template->process("admin/fieldvalues/confirm-delete.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
@@ -260,6 +268,7 @@ if ($action eq 'del') {
 # action='delete' -> really delete the field value
 #
 if ($action eq 'delete') {
+    check_token_data($token, 'delete_field_value');
     ValueMustExist($field, $value);
     if ($value eq Param($defaults{$field})) {
         ThrowUserError('fieldvalue_is_default', {field      => $field,
@@ -288,6 +297,7 @@ if ($action eq 'delete') {
     $dbh->bz_unlock_tables();
 
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
@@ -312,6 +322,7 @@ if ($action eq 'edit') {
 
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
+    $vars->{'token'} = issue_session_token('edit_field_value');
 
     $template->process("admin/fieldvalues/edit.html.tmpl",
                        $vars)
@@ -325,6 +336,7 @@ if ($action eq 'edit') {
 # action='update' -> update the field value
 #
 if ($action eq 'update') {
+    check_token_data($token, 'edit_field_value');
     my $valueold   = trim($cgi->param('valueold')   || '');
     my $sortkeyold = trim($cgi->param('sortkeyold') || '0');
 
@@ -396,6 +408,7 @@ if ($action eq 'update') {
         unlink "$datadir/versioncache";
         $vars->{'default_value_updated'} = 1;
     }
+    delete_token($token);
 
     $vars->{'value'} = $value;
     $vars->{'field'} = $field;
index 4ac83c542af7f342f65967f0a1dee397665e7f44..9626c9e9aed3fd7ab5fe13e9bd13dc027ce88299 100755 (executable)
@@ -21,7 +21,7 @@
 # Contributor(s): Holger Schurig <holgerschurig@nikocity.de>
 #                 Terry Weissman <terry@mozilla.org>
 #                 Gavin Shelley <bugzilla@chimpychompy.org>
-#                 Frédéric Buclin <LpSolit@gmail.com>
+#                 Frédéric Buclin <LpSolit@gmail.com>
 #
 #
 # Direct any questions on this source code to
@@ -37,6 +37,7 @@ use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 use Bugzilla::Product;
 use Bugzilla::Version;
+use Bugzilla::Token;
 
 my $cgi = Bugzilla->cgi;
 my $dbh = Bugzilla->dbh;
@@ -63,6 +64,7 @@ my $product_name = trim($cgi->param('product') || '');
 my $version_name = trim($cgi->param('version') || '');
 my $action       = trim($cgi->param('action')  || '');
 my $showbugcounts = (defined $cgi->param('showbugcounts'));
+my $token        = $cgi->param('token');
 
 #
 # product = '' -> Show nice list of products
@@ -110,7 +112,7 @@ unless ($action) {
 #
 
 if ($action eq 'add') {
-
+    $vars->{'token'} = issue_session_token('add_version');
     $vars->{'product'} = $product->name;
     $template->process("admin/versions/create.html.tmpl",
                        $vars)
@@ -126,7 +128,7 @@ if ($action eq 'add') {
 #
 
 if ($action eq 'new') {
-
+    check_token_data($token, 'add_version');
     # Cleanups and validity checks
     $version_name || ThrowUserError('version_blank_name');
 
@@ -147,6 +149,7 @@ if ($action eq 'new') {
 
     # Make versioncache flush
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'name'} = $version_name;
     $vars->{'product'} = $product->name;
@@ -175,6 +178,8 @@ if ($action eq 'del') {
     $vars->{'bug_count'} = $bugs;
     $vars->{'name'} = $version->name;
     $vars->{'product'} = $product->name;
+    $vars->{'token'} = issue_session_token('delete_version');
+
     $template->process("admin/versions/confirm-delete.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
@@ -189,7 +194,7 @@ if ($action eq 'del') {
 #
 
 if ($action eq 'delete') {
-
+    check_token_data($token, 'delete_version');
     my $version = Bugzilla::Version::check_version($product,
                                                    $version_name);
 
@@ -204,6 +209,7 @@ if ($action eq 'delete') {
               undef, ($product->id, $version->name));
 
     unlink "$datadir/versioncache";
+    delete_token($token);
 
     $vars->{'name'} = $version->name;
     $vars->{'product'} = $product->name;
@@ -228,6 +234,7 @@ if ($action eq 'edit') {
 
     $vars->{'name'}    = $version->name;
     $vars->{'product'} = $product->name;
+    $vars->{'token'} = issue_session_token('edit_version');
 
     $template->process("admin/versions/edit.html.tmpl",
                        $vars)
@@ -243,7 +250,7 @@ if ($action eq 'edit') {
 #
 
 if ($action eq 'update') {
-
+    check_token_data($token, 'edit_version');
     $version_name || ThrowUserError('version_not_specified');
 
     # Remove unprintable characters
@@ -288,7 +295,8 @@ if ($action eq 'update') {
         $vars->{'updated_name'} = 1;
     }
 
-    $dbh->bz_unlock_tables(); 
+    $dbh->bz_unlock_tables();
+    delete_token($token);
 
     $vars->{'name'} = $version_name;
     $vars->{'product'} = $product->name;
index 8086862d2415562a32e60373275b9e1bd48f8dab..cfa4443f06dc6ea830e658e851fdd05b9d03fc3c 100755 (executable)
@@ -33,6 +33,8 @@ require "globals.pl";
 use Bugzilla::Constants;
 use Bugzilla::User;
 use Bugzilla::Group;
+use Bugzilla::Token;
+
 # require the user to have logged in
 my $user = Bugzilla->login(LOGIN_REQUIRED);
 
@@ -46,7 +48,7 @@ my $vars     = {};
 my $dbh      = Bugzilla->dbh;
 
 my $userid   = $user->id;
-
+my $token    = $cgi->param('token');
 my $sth; # database statement handle
 
 # $events is a hash ref, keyed by event id, that stores the active user's
@@ -83,6 +85,7 @@ my $can_mail_others = UserInGroup('bz_canusewhineatothers');
 # removed, then what was altered.
 
 if ($cgi->param('update')) {
+    check_token_data($token, 'edit_whine');
     if ($cgi->param("add_event")) {
         # we create a new event
         $sth = $dbh->prepare("INSERT INTO whine_events " .
@@ -346,6 +349,7 @@ if ($cgi->param('update')) {
             }
         }
     }
+    delete_token($token);
 }
 
 $vars->{'mail_others'} = $can_mail_others;
@@ -433,6 +437,7 @@ $vars->{'available_queries'} = [];
 while (my ($query) = $sth->fetchrow_array) {
     push @{$vars->{'available_queries'}}, $query;
 }
+$vars->{'token'} = issue_session_token('edit_whine');
 
 $template->process("whine/schedule.html.tmpl", $vars)
   || ThrowTemplateError($template->error());
index 0d772f9eb9cf9ed9ed77ac9125ae3e5cfa39af89..4dbd33996cbf917377de6540363bdcd168229d03 100755 (executable)
@@ -62,7 +62,7 @@ if ($action eq 'prepare-sudo') {
     }
 
     # Keep a temporary record of the user visiting this page
-    $vars->{'token'} = Bugzilla::Token::IssueSessionToken('sudo_prepared');
+    $vars->{'token'} = issue_session_token('sudo_prepared');
 
     # Show the sudo page
     $vars->{'target_login_default'} = $cgi->param('target_login');
@@ -124,7 +124,7 @@ elsif ($action eq 'begin-sudo') {
                        { target_login => scalar $cgi->param('target_login'),
                                reason => scalar $cgi->param('reason')});
     }
-    Bugzilla::Token::DeleteToken($cgi->param('token'));
+    delete_token($cgi->param('token'));
 
     # Get & verify the target user (the user who we will be impersonating)
     my $target_user = 
index d313b19de1374f55534af41275bb1d225b12517b..bc60d6f056e3d4cfd7b5071897830c7f9b46d5e3 100644 (file)
@@ -160,10 +160,10 @@ body
 
     #message
     {
-       border: 1px solid red;
+        border: 1px solid red;
 
-       padding: 0.3em;
-       color: green;
+        padding: 0.3em;
+        color: green;
     }
 /* header (end)   */
 
@@ -335,3 +335,11 @@ td.tab.spacer
 }
 
 table#flags th, table#flags td { vertical-align: baseline; text-align: left; }
+
+.throw_error {
+    background-color: #ff0000;
+    color: black;
+    font-size: 120%;
+    margin: 1em;
+    padding: 0.5em 1em;
+}
index d6a7c388039e225dde6bd5fa6efc82cb8a9f953e..a2134e52b9119335075576dd8f14952140064213 100644 (file)
@@ -37,6 +37,7 @@
   <hr>
   <input type=submit value="Add">
   <input type=hidden name="action" value="new">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </FORM>
 
 <p>Back to the <a href="./">main [% terms.bugs %] page</a>
index 7f54a18ed875f02f86c4c39a2dee1bc2688b5e21..9fc1b0cf56759a49f55835a4f2da33dcc8b57317 100644 (file)
@@ -52,6 +52,7 @@
   <input type=submit value="Yes, delete">
   <input type=hidden name="action" value="delete">
   <input type=hidden name="classification" value="[% classification.name FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>Back to the <a href="./">main [% terms.bugs %] page</a>
index 60ece58b2ba29c6c7a4d1b590a867ccb0f4b72ef..77af7f8a95dfd90272a7eac8bce80500ee17d3d1 100644 (file)
@@ -67,6 +67,7 @@
   <input type=hidden name="classificationold" 
          value="[% classification.name FILTER html %]">
   <input type=hidden name="action" value="update">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type=submit value="Update">
 </form>
 
index b89f83d093f7b23eee840fdd881649d68ebb6e7b..830a01ad6390824f0c62da53dc5cb7e051320c41 100644 (file)
@@ -78,6 +78,7 @@
 
   <input type=hidden name="action" value="reclassify">
   <input type=hidden name="classification" value="[% classification.name FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>Back to the <a href="./">main [% terms.bugs %] page</a>,
index 16418843518e3fe320ec8641a06fa050e482111c..4ec8d9bf5edcee0140d04fa6fe2b6389ca49091f 100644 (file)
   <input type="hidden" name="action" value="delete">
   <input type="hidden" name="product" value="[% prod.name FILTER html %]">
   <input type="hidden" name="component" value="[% comp.name FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   </form>
 
 [% END %]
index fcb57bb03cc92f8ddf0dc1a5ab555b897e6f31c5..0e5c924b49ea20911418a28f87f3654cb095fd19 100644 (file)
@@ -78,7 +78,7 @@
   <input type="hidden" name='open_name' value='All Open'>
   <input type="hidden" name='nonopen_name' value='All Closed'>
   <input type="hidden" name='product' value="[% product FILTER html %]">
-
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 [% PROCESS admin/components/footer.html.tmpl %]
index 8b350d9e8570f382338445cb220896c5a231d379..7fa37488368d74f9159c2f75e6aea98ff5e3c519 100644 (file)
@@ -94,6 +94,7 @@
    <input type="hidden" name="action" value="update">
    <input type="hidden" name="componentold" value="[% comp.name FILTER html %]">
    <input type="hidden" name="product" value="[% prod.name FILTER html %]">
+   <input type="hidden" name="token" value="[% token FILTER html %]">
    <input type="submit" value="Update"> or <a 
         href="editcomponents.cgi?action=del&amp;product=
         [%- prod.name FILTER url_quote %]&amp;component=
diff --git a/template/en/default/admin/confirm-action.html.tmpl b/template/en/default/admin/confirm-action.html.tmpl
new file mode 100644 (file)
index 0000000..6e8caa6
--- /dev/null
@@ -0,0 +1,97 @@
+[%# 1.0@bugzilla.org %]
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # The Initial Developer of the Original Code is Frédéric Buclin.
+  #
+  # Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
+  #%]
+
+[%# INTERFACE:
+  # abuser: identity of the user who created the (invalid?) token.
+  # token_action: the action the token was supposed to serve.
+  # expected_action: the action the user was going to do.
+  # script_name: the script generating this warning.
+  #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+[% PROCESS global/header.html.tmpl title = "Suspicious Action"
+                                   style_urls = ['skins/standard/global.css'] %]
+
+[% IF abuser %]
+  <div class="throw_error">
+    <p>When you view an administrative form in [% terms.Bugzilla %], a token string
+    is randomly generated and stored both in the database and in the form you loaded,
+    to make sure that the requested changes are being made as a result of submitting
+    a form generated by [% terms.Bugzilla %]. Unfortunately, the token used right now
+    is incorrect, meaning that it looks like you didn't come from the right page.
+    The following token has been used :</p>
+
+    <table border="0" cellpadding="5" cellspacing="0">
+      [% IF token_action != expected_action %]
+        <tr>
+          <th>Action&nbsp;stored:</th>
+          <td>[% token_action FILTER html %]</td>
+        </tr>
+        <tr>
+          <th>&nbsp;</th>
+          <td>
+            This action doesn't match the one expected ([% expected_action FILTER html %]).
+          </td>
+        </tr>
+      [% END %]
+
+      [% IF abuser != user.identity %]
+        <tr>
+          <th>Generated&nbsp;by:</th>
+          <td>[% abuser FILTER html %]</td>
+        </tr>
+        <tr>
+          <th>&nbsp;</th>
+          <td>
+            This token has not been generated by you. It is possible that someone
+            tried to trick you!
+          </td>
+        </tr>
+      [% END %]
+    </table>
+
+    <p>Please report this problem to [%+ Param("maintainer") FILTER html %].</p>
+  </div>
+[% ELSE %]
+  <div class="throw_error">
+    It looks like you didn't come from the right page (you have no valid token for
+    the <em>[% expected_action FILTER html %]</em> action while processing the
+    '[% script_name FILTER html%]' script). The reason could be one of:<br>
+    <ul>
+      <li>You clicked the "Back" button of your web browser after having successfully
+      submitted changes, which is generally not a good idea (but harmless).</li>
+      <li>You entered the URL in the address bar of your web browser directly,
+      which should be safe.</li>
+      <li>You clicked on a URL which redirected you here <b>without your consent</b>,
+      in which case this action is much more critical.</li>
+    </ul>
+    Are you sure you want to commit these changes anyway? This may result in
+    unexpected and undesired results.
+  </div>
+
+  <form name="check" id="check" method="post" action="[% script_name FILTER html %]">
+    [% PROCESS "global/hidden-fields.html.tmpl"
+               exclude="^(Bugzilla_login|Bugzilla_password)$" %]
+    <input type="submit" id="confirm" value="Confirm Changes">
+  </form>
+  <p>Or throw away these changes and go back to <a href="[% script_name FILTER html %]">
+    [%- script_name FILTER html %]</a>.</p>
+[% END %]
+
+[% PROCESS global/footer.html.tmpl %]
index 31deb547f47a51da1c7a05bf85d5c833d6191221..7ee946d37678aa7c75a550b05153cd7d79012ac2 100644 (file)
     <input type="hidden" name="action" value="delete">
     <input type="hidden" name="field" value="[% field FILTER html %]">
     <input type="hidden" name="value" value="[% value FILTER html %]">
+    <input type="hidden" name="token" value="[% token FILTER html %]">
   </form>
 
 [% END %]
index a23c8ddb2c4e28407217768cce3598630235b73a..0bec8c28b0f42042d20f44fc24d0bbe845474054 100644 (file)
@@ -42,7 +42,7 @@
   <input type="submit" value="Add">
   <input type="hidden" name="action" value="new">
   <input type="hidden" name='field' value="[% field FILTER html %]">
-
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>
index 58de8611b182008146abdda807e59a72f7b2de1c..145f6a8a5ce969d26a587201c1b9e0d3f1feb876 100644 (file)
@@ -48,8 +48,8 @@
   <input type="hidden" name="sortkeyold" value="[% sortkey FILTER html %]">
   <input type="hidden" name="action" value="update">
   <input type="hidden" name="field" value="[% field FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="submit" value="Update">
-
 </form>
 
 <p>
index 99dba148e26333c00b4d1a567363c616e88171c5..e67412a1c21e0ab4b87873d294e4133eaed014fa 100644 (file)
 
 [% PROCESS global/variables.none.tmpl %]
 
-[%# Filter off the name here to be used multiple times below %]
-[% name = BLOCK %][% flag_type.name FILTER html %][% END %]
+[% title = BLOCK %]Confirm Deletion of Flag Type '[% flag_type.name FILTER html %]'[% END %]
 
-[% PROCESS global/header.html.tmpl
-  title = "Confirm Deletion of Flag Type '$name'"
-%]
+[% PROCESS global/header.html.tmpl title = title %]
 
 <p>
-   There are [% flag_count %] flags of type [% name FILTER html %].
+   There are [% flag_count %] flags of type [% flag_type.name FILTER html %].
    If you delete this type, those flags will also be deleted.  Note that
    instead of deleting the type you can
-   <a href="editflagtypes.cgi?action=deactivate&amp;id=[% flag_type.id %]">deactivate it</a>,
+   <a href="editflagtypes.cgi?action=deactivate&amp;id=[% flag_type.id %]&amp;token=
+           [%- token FILTER html %]">deactivate it</a>,
    in which case the type and its flags will remain in the database
    but will not appear in the [% terms.Bugzilla %] UI.
 </p>
@@ -45,8 +43,8 @@
    </tr>
    <tr>
       <td>
-         <a href="editflagtypes.cgi?action=delete&amp;id=[% flag_type.id %]">
-            Yes, delete
+         <a href="editflagtypes.cgi?action=delete&amp;id=[% flag_type.id %]&amp;token=
+                  [%- token FILTER html %]">Yes, delete
          </a>
       </td>
       <td align="right">
index 11c951f15558663e22c373563fa062825764f5b8..e0abf0df577122cab1bdb98ae4e34b42a9f77cf1 100644 (file)
@@ -63,6 +63,7 @@
 <form method="post" action="editflagtypes.cgi">
   <input type="hidden" name="action" value="[% action %]">
   <input type="hidden" name="id" value="[% type.id %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="hidden" name="target_type" value="[% type.target_type %]">
   [% FOREACH category = type.inclusions %]
     <input type="hidden" name="inclusions" value="[% category.value FILTER html %]">
index 66467d35a21e86ab923be61f2ed01dc7d0334a37..a94e59c9ed7ddccd2040dc4702cbef3ab8684d9a 100644 (file)
   <a href="editflagtypes.cgi?action=enter&amp;target_type=attachment">Create Flag Type For Attachments</a>
 </p>
 
-<script type="text/javascript">
-  <!--
-  function confirmDelete(id, name, count)
-  {
-    if (count > 0) {
-        var msg = 'There are ' + count + ' flags of type ' + name + '. ' +
-                  'If you delete this type, those flags will also be ' +
-                  'deleted.\n\nNote: to deactivate the type instead ' +
-                  'of deleting it, edit it and uncheck its "is active" ' +
-                  'flag.\n\nDo you really want to delete this flag type?';
-        if (!confirm(msg)) return false;
-    }
-    location.href = "editflagtypes.cgi?action=delete&id=" + id;
-    return false; // prevent strict JavaScript warning that this function
-                  // does not always return a value
-  }
-  //-->
-</script>
-
 [% PROCESS global/footer.html.tmpl %]
 
 
@@ -97,9 +78,7 @@
         <td>[% type.description FILTER html %]</td>
         <td>
           <a href="editflagtypes.cgi?action=copy&amp;id=[% type.id %]">Copy</a>
-          | <a href="editflagtypes.cgi?action=confirmdelete&amp;id=[% type.id %]"
-               onclick="return confirmDelete([% type.id %], '[% type.name FILTER js FILTER html %]',
-                                             [% type.flag_count %]);">Delete</a>
+          | <a href="editflagtypes.cgi?action=confirmdelete&amp;id=[% type.id %]">Delete</a>
         </td>
       </tr>
 
index 8da00a7994bdd397901e20d7d09e5cca0a7867a4..18c08fc48cf7b52207defabc8a8ecd8aa5f1adc0 100644 (file)
@@ -49,6 +49,7 @@
     Insert new group into all existing products.<p>
   <input type="submit" value="Add">
   <input type="hidden" name="action" value="new">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p><b>Name</b> is what is used with the UserInGroup() function in any
index f52ace03c1a6c791fc695e78bc20a87bf5ccbae0..24c0519870ff076037a2e63c76e292e0db971451 100644 (file)
   <p><input type="submit" value="Yes, delete">
   <input type="hidden" name="action" value="delete">
   <input type="hidden" name="group" value="[% gid FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 Go back to the <a href="editgroups.cgi">group list</a>.
index e317770cce0a9118d141bb346b34c3798a88ceba..f323c600edf82a56fbe1e9e8aecd8cd311182e1e 100644 (file)
 
   <input type="hidden" name="action" value="postchanges">
   <input type="hidden" name="group" value="[% group_id FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 Back to the <a href="editgroups.cgi">group list</a>.
index cfe8bf75f88f25cde16a33086b41dd57966ab038..3329a5473236635b48d7d5df575e788002d76740 100755 (executable)
@@ -46,6 +46,7 @@
   <input type="hidden" name="id" value="[% keyword_id %]">
   <input type="hidden" name="action" value="delete">
   <input type="hidden" name="reallydelete" value="1">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="submit" value="Yes, really delete the keyword">
 </form>
 
index 006b4b3447ef70814f13f7edac85c9a5cd87a99b..861c6f1e92d191e8742a88fbd9754418a50a4b83 100755 (executable)
@@ -47,6 +47,7 @@
   <input type="hidden" name="id" value="-1">
   <input type="submit" value="Add">
   <input type="hidden" name="action" value="new">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p><a href="editkeywords.cgi">Edit other keywords</a>.</p>
index 3809563c2c33b13884b7def8c15675666ee5c948..16b31da89b89c82a6308f7c31caf84861b4850f9 100755 (executable)
@@ -62,6 +62,7 @@
   <input type="submit" value="Update">
   <input type="hidden" name="action" value="update">
   <input type="hidden" name="id" value="[% keyword_id %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p><a href="editkeywords.cgi">Edit other keywords</a>.</p>
index 61601d18524ea60608b594f3b94f5d2d65bf4702..1eb4e0fa9e6e1199e644515700369facbede8b85 100644 (file)
@@ -91,6 +91,7 @@
   <input type="hidden" name="action" value="delete">
   <input type="hidden" name="product" value="[% product FILTER html %]">
   <input type="hidden" name="milestone" value="[% name FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 [% PROCESS admin/milestones/footer.html.tmpl %]
index d8779dd544f161ee8941c5a72753635cd78dee19..6e3b4b25235cb81e42c8510d2c644f2c175fba9b 100644 (file)
@@ -48,7 +48,7 @@
   <input type="submit" value="Add">
   <input type="hidden" name="action" value="new">
   <input type="hidden" name='product' value="[% product FILTER html %]">
-
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>
index f49cacf4a9832c16e8317ee7ffec46b275d6561b..3daf0765acb0f2b10a9af468ff3963866eae3d63 100644 (file)
@@ -56,7 +56,7 @@
   <input type="hidden" name="action" value="update">
   <input type="hidden" name="product" value="[% product FILTER html %]">
   <input type="submit" value="Update">
-
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>
index 0560cac6cbd9ca1a63d61bc2508d0e1a9979bac0..5d309067c80f0456bd6cd47475044a3969a71e1d 100644 (file)
@@ -99,6 +99,7 @@
           [% PROCESS admin/params/common.html.tmpl panel = current_panel %]
           <input type="hidden" name="section" value="[% current_panel.name FILTER html %]">
           <input type="hidden" name="action" value="save">
+          <input type="hidden" name="token" value="[% token FILTER html %]">
           <input type="reset" value="Reset form">
           <input type="submit" name="action" value="Save Changes">
         </form>
index 23550f26d7a9ac9d6d3a5a517f8ec560c2176c1b..5e2cdddb9b306aa288cc321583a8f3950b02f6f4 100644 (file)
     <input type="submit" value="Yes, delete">
     <input type="hidden" name="action" value="delete">
     <input type="hidden" name="product" value="[% product.name FILTER html %]">
+    <input type="hidden" name="token" value="[% token FILTER html %]">
     <input type="hidden" name="classification"
            value="[% classification.name FILTER html %]">
   </form>
index fd1ed34cc89a13950ffbc0443095cf32b9408c42..5fb7d8bd1340bc9eaea1caea94e5dbdb0e2d82d9 100644 (file)
@@ -57,6 +57,7 @@
   <input type="hidden" name="subcategory" value="-All-">
   <input type="hidden" name="open_name"   value="All Open">
   <input type="hidden" name="action" value="new">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="hidden" name="classification"
         value="[% classification.name FILTER html %]">
 </form>
index 105ec6e7417b28d012b7a7fa6ce1e249204f2f2e..0371e3343bd469dd523bae24eea0b3fd6b2e637f 100644 (file)
@@ -132,6 +132,7 @@ versions:</a>
   <input type="hidden" name="product_old_name" 
         value="[% product.name FILTER html %]">
   <input type="hidden" name="action" value="update">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="hidden" name="classification"
          value="[% classification.name FILTER html %]">
   <input type="submit" name="submit" value="Update">
index 174d1586903df0c51b40e77caa89e6c6cf41cd98..32b5e9d8c454e7ff6412c04b7b9ff810f9fb60aa 100644 (file)
@@ -31,6 +31,7 @@
 <form method="post" action="editproducts.cgi">
   <input type="hidden" name="action" value="updategroupcontrols">
   <input type="hidden" name="product" value="[% product.name FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="hidden" name="classification" 
          value="[% classification.name FILTER html %]">
 
index 85663f19b13794b386978f4d828e9184be07e22a..b0b5e55eeede4f30dd7f4d4bf6b597f1a1fcdfc3 100644 (file)
@@ -85,6 +85,7 @@ page, and the Default Value will automatically apply to everyone.
       </table>
 
     <input type="hidden" name="action" value="update">
+    <input type="hidden" name="token" value="[% token FILTER html %]">
     <table>
       <tr>
         <td width="150"></td>
index 68d7078f0e6bf55daddc3b11b9d236768a592942..c52b1a267c8c656b45cc7307023b033f2aa194fc 100644 (file)
       <input type="submit" value="Yes, delete" />
       <input type="hidden" name="action" value="delete" />
       <input type="hidden" name="userid" value="[% otheruser.id %]" />
+      <input type="hidden" name="token" value="[% token FILTER html %]">
       [% INCLUDE listselectionhiddenfields %]
     </p>
   </form>
index 42aefbdb702f1334f875a1b135b95d7c66dd2e7d..ffff303d7b276f93f2dedfb680ff277aa0da400a 100644 (file)
@@ -41,6 +41,7 @@
 <p>
   <input type="submit" value="Add" />
   <input type="hidden" name="action" value="new" />
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   [% INCLUDE listselectionhiddenfields %]
 </p>
 </form>
index 8f8e6692bc47dae79ee13c0b939b5a4f263e97aa..2d19a066020d6a62753fcc24bbc7126dd2b269ae 100644 (file)
   <input type="submit" value="Update" />
   <input type="hidden" name="userid" value="[% otheruser.id %]" />
   <input type="hidden" name="action" value="update" />
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   [% INCLUDE listselectionhiddenfields %]
 </p>
 </form>
index 34ada607bdf94f975da0671ddc6b11f6817d5393..27e89361c796692cffb5057701a70c5d97375526 100644 (file)
@@ -93,6 +93,7 @@
     <input type="hidden" name="action" value="delete">
     <input type="hidden" name="product" value="[% product FILTER html %]">
     <input type="hidden" name="version" value="[% name FILTER html %]">
+    <input type="hidden" name="token" value="[% token FILTER html %]">
   </form>
 
 [% END %]
index 594bf4f8749a6f298049ac24d34af4118dde3819..63f6784f7cd375e68958f20362bb2f8fe7578da5 100644 (file)
@@ -42,7 +42,7 @@
   <input type="submit" value="Add">
   <input type="hidden" name="action" value="new">
   <input type="hidden" name='product' value="[% product FILTER html %]">
-
+  <input type="hidden" name="token" value="[% token FILTER html %]">
 </form>
 
 <p>
index ef1fbd270b7c418e8fb6945f2831c50bfd1037ee..f5f645375fec271a8bfc2b4105ce36a569a4fe1f 100644 (file)
@@ -47,8 +47,8 @@
   <input type="hidden" name="versionold" value="[% name FILTER html %]">
   <input type="hidden" name="action" value="update">
   <input type="hidden" name="product" value="[% product FILTER html %]">
+  <input type="hidden" name="token" value="[% token FILTER html %]">
   <input type="submit" value="Update">
-
 </form>
 
 <p>
index 0440c0a1e7f0e3659d99335b516fd377a7699c07..9c9fa940c3d190c02128defa97272d07c3f6bffd 100644 (file)
 
 'admin/flag-type/list.html.tmpl' => [
   'type.id', 
-  'type.flag_count', 
 ],
 
 
index b49f713a8f2a292fe258da593041652051aad721..b158f5c0f374e0ce0a1dda12b51c64518ff2701c 100644 (file)
@@ -82,6 +82,7 @@
 <input type="submit" value="Update / Commit" name="commit"
        style="visibility: hidden">
 <input type="hidden" name="update" value="1">
+<input type="hidden" name="token" value="[% token FILTER html %]">
 
 [% FOREACH event = events %]