diff options
author | David Lawrence <dkl@mozilla.com> | 2014-11-04 04:11:09 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-11-04 04:11:09 +0100 |
commit | 4e1941fedbe46bafce9aded3a0a38d272fec37a2 (patch) | |
tree | 633351ada50932ec6b747705b95e0bd04e39f05e /relogin.cgi | |
parent | d6ee5ade172abe24389aca15eba9fe922b5697c7 (diff) | |
download | bugzilla-4e1941fedbe46bafce9aded3a0a38d272fec37a2.tar.gz bugzilla-4e1941fedbe46bafce9aded3a0a38d272fec37a2.tar.xz |
Bug 1090427: Backport bug 713926 to bmo/4.2 to protect against csrf for login forms
Diffstat (limited to 'relogin.cgi')
-rwxr-xr-x | relogin.cgi | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/relogin.cgi b/relogin.cgi index 6eb798205..9eea67bd5 100755 --- a/relogin.cgi +++ b/relogin.cgi @@ -67,6 +67,19 @@ elsif ($action eq 'prepare-sudo') { # Keep a temporary record of the user visiting this page $vars->{'token'} = issue_session_token('sudo_prepared'); + if ($user->authorizer->can_login) { + my $value = generate_random_password(); + my %args; + $args{'-secure'} = 1 if Bugzilla->params->{ssl_redirect}; + + $cgi->send_cookie(-name => 'Bugzilla_login_request_cookie', + -value => $value, + -httponly => 1, + %args); + + $vars->{'login_request_token'} = issue_hash_token(['login_request', $value]); + } + # Show the sudo page $vars->{'target_login_default'} = $cgi->param('target_login'); $vars->{'reason_default'} = $cgi->param('reason'); |