]> git.proxmox.com Git - pve-http-server.git/commitdiff
formatter/bootstrap: set SameSite attr of auth cookie to 'strict'
authorMax Carrara <m.carrara@proxmox.com>
Wed, 15 Mar 2023 16:26:29 +0000 (17:26 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 6 Jun 2023 15:12:55 +0000 (17:12 +0200)
This prohibits the cookie from being sent along in cross-site
sub-requests or when the user navigates to a different site.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
src/PVE/APIServer/Formatter.pm
src/PVE/APIServer/Formatter/Bootstrap.pm

index 20455a02704e579c18f0455abb66b88eb04098f7..142127ac9a64752350f0c417c353c47a4eb0f73e 100644 (file)
@@ -92,7 +92,7 @@ sub create_auth_cookie {
 
     my $encticket = uri_escape($ticket);
 
-    return "${cookie_name}=$encticket; path=/; secure;";
+    return "${cookie_name}=$encticket; path=/; secure; SameSite=Strict;";
 }
 
 sub create_auth_header {
index 001ad2b7f71e9cecc8bdf609bbdaf08ceecff960..9fb7785159fd44813c247c6e984b3856642cef27 100644 (file)
@@ -88,7 +88,7 @@ sub body {
     $jssetup .= "PVE.delete_auth_cookie = function() {\n";
 
     if ($self->{cookie_name}) {
-       $jssetup .= "  document.cookie = \"$self->{cookie_name}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; secure;\";\n";
+       $jssetup .= "  document.cookie = \"$self->{cookie_name}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; secure; SameSite=Strict;\";\n";
     };
     $jssetup .= "};\n";