From 86050e2201141e674b81e957bc69ec9119025636 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 12 Mar 2025 00:31:32 -0400 Subject: [PATCH] Refactor ContactManager to add validation for peer address and UUID input https://github.com/nosial/Socialbox-PHP/issues/31 --- src/Socialbox/Managers/ContactManager.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Socialbox/Managers/ContactManager.php b/src/Socialbox/Managers/ContactManager.php index 06d14a8..006e5ff 100644 --- a/src/Socialbox/Managers/ContactManager.php +++ b/src/Socialbox/Managers/ContactManager.php @@ -191,6 +191,15 @@ { $contactAddress = $contactAddress->getAddress(); } + elseif(!Validator::validatePeerAddress($contactAddress)) + { + throw new InvalidArgumentException('The given contact address is invalid'); + } + + if(!Validator::validateUuid($peerUuid)) + { + throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4'); + } try {