Refactor SettingsSetPassword and PasswordManager to enhance password handling and validate UUID format

https://github.com/nosial/Socialbox-PHP/issues/66
This commit is contained in:
netkas 2025-03-12 15:11:52 -04:00
parent c3b1ee799a
commit d127393402
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
2 changed files with 6 additions and 10 deletions

View file

@ -63,11 +63,15 @@
{
$peerUuid = $peerUuid->getUuid();
}
elseif(!Validator::validateUuid($peerUuid))
{
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
}
// Throws an exception if the hash is invalid
if(!Cryptography::validatePasswordHash($hash))
{
throw new CryptographyException('Invalid password hash');
throw new CryptographyException('Invalid password aragon2id hash');
}
$encryptionKey = Configuration::getCryptographyConfiguration()->getRandomInternalEncryptionKey();