Fix CSRF token generation must be fast, can have low entropy.
This commit is contained in:
parent
3bc896be57
commit
d97a95aa2a
@ -448,7 +448,7 @@ if (!defined('NOTOKENRENEWAL')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
|
// Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
|
||||||
$token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number
|
$token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
|
||||||
$_SESSION['newtoken'] = $token;
|
$_SESSION['newtoken'] = $token;
|
||||||
dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
|
dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user