From 8b4bf890f82c28439e6cddb4502ffa16f19ac814 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 30 Jul 2022 05:30:08 +0000 Subject: [PATCH] Issue 11798: Handling of empty author --- src/Protocol/ActivityPub/Processor.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 5cb8474424..e3e2e295af 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -299,6 +299,11 @@ class Processor $conversation = []; } + if (empty($activity['author']) && empty($activity['actor'])) { + Logger::notice('Missing author and actor. We quit here.', ['activity' => $activity]); + return []; + } + if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Post::exists(['uri' => $activity['reply-to-id']])) { $recursion_depth = $activity['recursion-depth'] ?? 0; Logger::notice('Parent not found. Try to refetch it.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]); @@ -918,7 +923,7 @@ class Processor continue; } - if (!($item['isForum'] ?? false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT) && !Contact::isSharingByURL($activity['author'] ?? '', $receiver)) { + if (!($item['isForum'] ?? false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT) && !Contact::isSharingByURL($activity['author'], $receiver)) { if ($item['post-reason'] == Item::PR_BCC) { Logger::info('Top level post via BCC from a non sharer, ignoring', ['uid' => $receiver, 'contact' => $item['contact-id']]); continue;