Commit 19b51489 authored by Reed Loden's avatar Reed Loden

Bug 754673 - CSRF vulnerability in query.cgi allows possible unauthorized use of…

Bug 754673 - CSRF vulnerability in query.cgi allows possible unauthorized use of "Set my default search back to the system default" [r=LpSolit a=LpSolit]
parent a196f9ce
...@@ -20,6 +20,7 @@ use Bugzilla::Product; ...@@ -20,6 +20,7 @@ use Bugzilla::Product;
use Bugzilla::Keyword; use Bugzilla::Keyword;
use Bugzilla::Field; use Bugzilla::Field;
use Bugzilla::Install::Util qw(vers_cmp); use Bugzilla::Install::Util qw(vers_cmp);
use Bugzilla::Token;
############### ###############
# Subroutines # # Subroutines #
...@@ -72,6 +73,8 @@ my $userid = $user->id; ...@@ -72,6 +73,8 @@ my $userid = $user->id;
if ($cgi->param('nukedefaultquery')) { if ($cgi->param('nukedefaultquery')) {
if ($userid) { if ($userid) {
my $token = $cgi->param('token');
check_hash_token($token, ['nukedefaultquery']);
$dbh->do("DELETE FROM namedqueries" . $dbh->do("DELETE FROM namedqueries" .
" WHERE userid = ? AND name = ?", " WHERE userid = ? AND name = ?",
undef, ($userid, DEFAULT_QUERY_NAME)); undef, ($userid, DEFAULT_QUERY_NAME));
......
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
[% IF userdefaultquery %] [% IF userdefaultquery %]
<p> <p>
<a href="query.cgi?nukedefaultquery=1"> <a href="query.cgi?nukedefaultquery=1&amp;token=
[%- issue_hash_token(['nukedefaultquery']) FILTER uri %]">
Set my default search back to the system default</a>. Set my default search back to the system default</a>.
</p> </p>
[% END %] [% END %]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment