Skip to content

Commit

Permalink
change samesite to Lax
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Dec 2, 2024
1 parent 8b3b37b commit 48cbd28
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion htdocs/class/logger/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function xoLogCreateCookie(name,value,days)
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
} else var expires = "";
document.cookie = name+"="+value+expires+";path=/;samesite=strict;";
document.cookie = name+"="+value+expires+";path=/;samesite=Lax;";
}
function xoLogReadCookie(name)
{
Expand Down
6 changes: 3 additions & 3 deletions htdocs/include/xoopssetcookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Richard Griffith <[email protected]>
*
* This exists to bring samesite support to php versions before 7.3, and
* it treats the default as samesite=strict
* it treats the default as samesite=Lax
*
* It supports both of the two declared signatures:
* - setcookie ( string $name , string $value = "" , int $expires = 0 , string $path = "" , string $domain = "" , bool $secure = false , bool $httponly = false ) : bool
Expand Down Expand Up @@ -51,8 +51,8 @@ function xoops_setcookie()
}
}

// make samesite=strict the default
$args['options']['samesite'] ??= 'strict';
// make samesite=Lax the default
$args['options']['samesite'] ??= 'Lax';
if (!isset($args['value'])){
$args['value'] = '';
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/include/common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function fatalPhpErrorHandler($e = null) {
'domain' => null,
'secure' => false,
'httponly' => true,
'samesite' => 'strict',
'samesite' => 'Lax',
];
// options for mainfile.php
if (empty($xoopsOption['hascommon'])) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/kernel/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function __construct(XoopsDatabase $db)
'domain' => XOOPS_COOKIE_DOMAIN,
'secure' => $secure,
'httponly' => true,
'samesite' => 'strict',
'samesite' => 'Lax',
];
session_set_cookie_params($options);
} else {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modules/system/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function system_createCookie(name, value, days) {
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + ";path=/;samesite=strict;";
document.cookie = name + "=" + value + expires + ";path=/;samesite=Lax;";
}
function system_readCookie(name) {
var nameEQ = name + "=";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modules/system/themes/default/js/styleswitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function createCookie(name,value,days)
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+";path=/;samesite=strict;";
document.cookie = name+"="+value+expires+";path=/;samesite=Lax;";
}
function readCookie(name)
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modules/system/themes/transition/js/styleswitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function createCookie(name,value,days)
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+";path=/;samesite=strict;";
document.cookie = name+"="+value+expires+";path=/;samesite=Lax;";
}
function readCookie(name)
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/themes/xswatch4/tpl/nav-admin.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
toolbar_cookie = 'off';
xswatchToolbarIndOff();
}
Cookies.set('xswatch-toolbar', toolbar_cookie, { expires: 365, sameSite: 'strict' });
Cookies.set('xswatch-toolbar', toolbar_cookie, { expires: 365, sameSite: 'Lax' });
}
// set initial conditions based on cookie
var toolbar_cookie = Cookies.get('xswatch-toolbar');
Expand Down

0 comments on commit 48cbd28

Please sign in to comment.