From 658383e6d10115f0c9476234c44179b5e97625ea Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 21 Apr 2024 11:36:31 +0200 Subject: [PATCH] set lang cookie with strict SameSite property --- js/privatebin.js | 2 +- lib/Controller.php | 4 ++-- tpl/bootstrap.php | 2 +- tpl/bootstrap5.php | 2 +- tpl/page.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index e48ccbcb..4ebf3463 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -3855,7 +3855,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ function setLanguage(event) { - document.cookie = 'lang=' + $(event.target).data('lang') + ';secure'; + document.cookie = 'lang=' + $(event.target).data('lang') + '; SameSite=Strict; Secure'; UiHelper.reloadHome(); event.preventDefault(); } diff --git a/lib/Controller.php b/lib/Controller.php index 316b6b5d..85767b12 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -178,7 +178,7 @@ class Controller // force default language, if language selection is disabled and a default is set if (!$this->_conf->getKey('languageselection') && strlen($lang) == 2) { $_COOKIE['lang'] = $lang; - setcookie('lang', $lang, 0, '', '', true); + setcookie('lang', $lang, array('SameSite' => 'Strict', 'Secure' => true)); } } @@ -389,7 +389,7 @@ class Controller $languageselection = ''; if ($this->_conf->getKey('languageselection')) { $languageselection = I18n::getLanguage(); - setcookie('lang', $languageselection, 0, '', '', true); + setcookie('lang', $languageselection, array('SameSite' => 'Strict', 'Secure' => true)); } // strip policies that are unsupported in meta tag diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index f3691491..2e6961f8 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 8d3fc7a9..33756a5a 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -57,7 +57,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 63e8477d..077141db 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - +