From f51ea0bd78100ef7ee79461f3145e13eb9fc608a Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 12 Mar 2025 15:13:42 -0400 Subject: [PATCH] Refactor SettingsGetInformationField and PeerInformationManager to improve error handling and validate UUID format https://github.com/nosial/Socialbox-PHP/issues/60 --- .../StandardMethods/Settings/SettingsGetInformationField.php | 1 + src/Socialbox/Managers/PeerInformationManager.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Socialbox/Classes/StandardMethods/Settings/SettingsGetInformationField.php b/src/Socialbox/Classes/StandardMethods/Settings/SettingsGetInformationField.php index 58bb968..e09b27b 100644 --- a/src/Socialbox/Classes/StandardMethods/Settings/SettingsGetInformationField.php +++ b/src/Socialbox/Classes/StandardMethods/Settings/SettingsGetInformationField.php @@ -25,6 +25,7 @@ { throw new MissingRpcArgumentException('field'); } + $fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field'))); if($fieldName === null) { diff --git a/src/Socialbox/Managers/PeerInformationManager.php b/src/Socialbox/Managers/PeerInformationManager.php index a1952fc..4db2c7c 100644 --- a/src/Socialbox/Managers/PeerInformationManager.php +++ b/src/Socialbox/Managers/PeerInformationManager.php @@ -208,6 +208,10 @@ { $peerUuid = $peerUuid->getUuid(); } + elseif(!Validator::validateUuid($peerUuid)) + { + throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4'); + } try {