From d5fe5c34af37e3cd5ff435467d09e8fcd0cd9d8a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 6 Apr 2026 17:14:12 +0530 Subject: [PATCH] Validate subscribe payload format in realtime message handling --- app/realtime.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/realtime.php b/app/realtime.php index d7542c0457..796686be3e 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -986,6 +986,9 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re // bulk validation + parsing before subscribing $parsedPayloads = []; foreach ($message['data'] as $payload) { + if (!\is_array($payload)) { + throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Each subscribe payload must be an object.'); + } if (!array_key_exists('channels', $payload)) { throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'channels is not present in payload.'); }