fix(crypto): reject malformed nonce in check()
This commit is contained in:
@@ -42,6 +42,10 @@ class Nonce
|
||||
*/
|
||||
public static function check(string $nonce, string $passphrase = ''): bool
|
||||
{
|
||||
if ($nonce === '' || !ctype_xdigit($nonce) || strlen($nonce) % 2 !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$decripted = openssl_decrypt(
|
||||
hex2bin($nonce),
|
||||
'aes-128-ecb',
|
||||
|
||||
Reference in New Issue
Block a user