Fix null dereference error when updating the sharedInbox for actor

updates.

The old code assumes that all update messages have an endpoints key.
However, both the endpoints key, as well as the sharedInbox may be
missing or null per spec. This commit fixes the bug by using isset to
check for the key to exist, otherwise coalescing it to null

server to server update messages are PUT operations, not PATCH,
so if the sharedInbox is missing in the update, it should always be
removed (if previously set)
pull/6223/head
Anil Kulkarni 2 weeks ago
parent 76b5601a01
commit 2f6c6830ea
No known key found for this signature in database
GPG Key ID: 4806669421E998D3

@ -47,8 +47,9 @@ class HandleUpdateActivity implements ShouldQueue
return; return;
} }
if ($profile->sharedInbox == null || $profile->sharedInbox != $payload['object']['endpoints']['sharedInbox']) { $sharedInbox = isset($payload['object']['endpoints']['sharedInbox']) ? $payload['object']['endpoints']['sharedInbox'] : null;
$profile->sharedInbox = $payload['object']['endpoints']['sharedInbox']; if ($profile->sharedInbox !== $sharedInbox) {
$profile->sharedInbox = $sharedInbox;
} }
if ($profile->public_key !== $payload['object']['publicKey']['publicKeyPem']) { if ($profile->public_key !== $payload['object']['publicKey']['publicKeyPem']) {

Loading…
Cancel
Save