]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 966676: The 'sudo' cookie should not be accessible from JavaScript
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 14 Feb 2014 23:29:15 +0000 (00:29 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 14 Feb 2014 23:29:15 +0000 (00:29 +0100)
r=dkl a=justdave

relogin.cgi

index 57240db43d3d687298149a87ed42e5a5e8041423..b3307c9eb5e6b2957634d111660db353dafdf925 100755 (executable)
@@ -136,11 +136,18 @@ elsif ($action eq 'begin-sudo') {
 
     # For future sessions, store the unique ID of the target user
     my $token = Bugzilla::Token::_create_token($user->id, 'sudo', $target_user->id);
+
+    my %args;
+    if (Bugzilla->params->{ssl_redirect}) {
+        $args{'-secure'} = 1;
+    }
+
     $cgi->send_cookie('-name'    => 'sudo',
                       '-expires' => $time_string,
-                      '-value'   => $token
-    );
-    
+                      '-value'   => $token,
+                      '-httponly' => 1,
+                      %args);
+
     # For the present, change the values of Bugzilla::user & Bugzilla::sudoer
     Bugzilla->sudo_request($target_user, $user);