Commit ad1e3aef authored by David Lawrence's avatar David Lawrence

Bug 621105 - [SECURITY] Voting lacks CSRF protection

r=mkanat,a=LpSolit
parent 9244270a
......@@ -36,6 +36,7 @@ use Bugzilla::Field;
use Bugzilla::Mailer;
use Bugzilla::User;
use Bugzilla::Util qw(detaint_natural);
use Bugzilla::Token;
use List::Util qw(min);
......@@ -529,6 +530,9 @@ sub _update_votes {
|| ThrowUserError("voting_must_be_nonnegative");
}
my $token = $cgi->param('token');
check_hash_token($token, ['vote']);
############################################################################
# End Data/Security Validation
############################################################################
......
......@@ -74,6 +74,7 @@
[% IF products.size %]
<form name="voting_form" method="post" action="page.cgi?id=voting/user.html">
<input type="hidden" name="action" value="vote">
<input type="hidden" name="token" value="[% issue_hash_token(['vote']) FILTER html %]">
<table cellspacing="4">
<tr>
<td></td>
......
......@@ -35,6 +35,7 @@
<form action="page.cgi?id=voting/user.html" method="post">
<input type="hidden" name="action" value="vote">
<input type="hidden" name="token" value="[% issue_hash_token(['vote']) FILTER html %]">
<p>
<input type="radio" name="delete_all_votes" value="1">
Yes, delete all my votes
......
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