mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Validate subscribe payload format in realtime message handling
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user