diff options
author | lpsolit%gmail.com <> | 2009-02-02 19:59:17 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2009-02-02 19:59:17 +0100 |
commit | d382992164347e076c51d3116a32aeabb2beecd5 (patch) | |
tree | 733546d50af433091cac9db779e8ea275dc4c6ce /editkeywords.cgi | |
parent | 44341577cd209d8c61fe4129ea72785fc7be9ee5 (diff) | |
download | bugzilla-d382992164347e076c51d3116a32aeabb2beecd5.tar.gz bugzilla-d382992164347e076c51d3116a32aeabb2beecd5.tar.xz |
Bug 466692: [SECURITY] keywords and unused flag types can be deleted by bypassing the token check - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
Diffstat (limited to 'editkeywords.cgi')
-rwxr-xr-x | editkeywords.cgi | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/editkeywords.cgi b/editkeywords.cgi index dbc92971d..76bba4817 100755 --- a/editkeywords.cgi +++ b/editkeywords.cgi @@ -151,26 +151,23 @@ if ($action eq 'update') { exit; } - -if ($action eq 'delete') { +if ($action eq 'del') { my $keyword = new Bugzilla::Keyword($key_id) || ThrowCodeError('invalid_keyword_id', { id => $key_id }); $vars->{'keyword'} = $keyword; + $vars->{'token'} = issue_session_token('delete_keyword'); - # We need this token even if there is no bug using this keyword. - $token = issue_session_token('delete_keyword'); - - if (!$cgi->param('reallydelete') && $keyword->bug_count) { - $vars->{'token'} = $token; + print $cgi->header(); + $template->process("admin/keywords/confirm-delete.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; +} - print $cgi->header(); - $template->process("admin/keywords/confirm-delete.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; - } - # We cannot do this check earlier as we have to check 'reallydelete' first. +if ($action eq 'delete') { check_token_data($token, 'delete_keyword'); + my $keyword = new Bugzilla::Keyword($key_id) + || ThrowCodeError('invalid_keyword_id', { id => $key_id }); $dbh->do('DELETE FROM keywords WHERE keywordid = ?', undef, $keyword->id); $dbh->do('DELETE FROM keyworddefs WHERE id = ?', undef, $keyword->id); |