Use generic session name and __Host- prefix for improved security
Hanno Böck

Hanno Böck commited on 2024-03-11 14:39:39
Zeige 2 geänderte Dateien mit 4 Einfügungen und 2 Löschungen.

... ...
@@ -33,7 +33,6 @@ $config['logging'] = LOG_ERR;
33 33
 
34 34
 $config['mime_type'] = 'text/html';
35 35
 
36
-$config['session_name'] = 'CONFIG_SCHOKOKEKS_ORG';
37 36
 $config['theme'] = 'default';
38 37
 
39 38
 ini_set('display_errors', 'On');
... ...
@@ -11,7 +11,10 @@ require_once('inc/debug.php');
11 11
 
12 12
 require_once('inc/base.php');
13 13
 
14
-session_name(config('session_name'));
14
+// __Host- prefix guarantees secure cookie that cannot be
15
+// overwritten by other hosts:
16
+// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
17
+session_name('__Host-CONFIG_INTERFACE');
15 18
 
16 19
 session_set_cookie_params(['path' => '/', 'secure' => true,
17 20
                                 'httponly' => true, 'samesite' => 'Lax', ]);
18 21