FIX Reflected XSS reported by 柏天浩

This commit is contained in:
ldestailleur 2025-03-11 10:38:26 +01:00
parent 620cb5c90a
commit a65f699528

View file

@ -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 === '/') {
}
?>
<form id="login" name="login" method="post" action="<?php echo $callbackUrl; ?>">
<form id="login" name="login" method="post" action="<?php echo dolPrintHTMLForAttributeUrl($callbackUrl); ?>">
<!-- Add fields to send OpenID information -->
<input type="hidden" name="openid_mode" value="true" />
<input type="hidden" name="state" value="<?php echo GETPOST('state'); ?>" />