From a65f699528afbc55ec302dedabed661731be5332 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 11 Mar 2025 10:38:26 +0100 Subject: [PATCH] =?UTF-8?q?FIX=20Reflected=20XSS=20reported=20by=20?= =?UTF-8?q?=E6=9F=8F=E5=A4=A9=E6=B5=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/modules/openid_connect/callback.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/openid_connect/callback.php b/htdocs/core/modules/openid_connect/callback.php index 065e6801588..ca973b03d28 100644 --- a/htdocs/core/modules/openid_connect/callback.php +++ b/htdocs/core/modules/openid_connect/callback.php @@ -46,7 +46,8 @@ top_htmlhead('', '', 0, 0, $arrayofjs); $prefix = dol_getprefix(''); $callbackUrl = $_COOKIE["DOL_rollback_url_".$prefix]; // Was set by login page to $_SERVER['REQUEST_URI'] to allow come back to initial requested page -if (empty($callbackUrl) || !preg_match('/^\//', $callbackUrl)) { + +if (empty($callbackUrl) || !preg_match('/^\/[a-z0-9]/i', $callbackUrl)) { // We accept only value that is an internal relative URL. URL starting with http are not allowed. $callbackUrl = '/'; } @@ -57,7 +58,7 @@ if ($callbackUrl === '/') { } ?> -
+