diff --git a/app/Jobs/InboxPipeline/InboxValidator.php b/app/Jobs/InboxPipeline/InboxValidator.php index 4fc1b75a2..481844bb2 100644 --- a/app/Jobs/InboxPipeline/InboxValidator.php +++ b/app/Jobs/InboxPipeline/InboxValidator.php @@ -167,9 +167,8 @@ class InboxValidator implements ShouldQueue && is_array($bodyDecoded['object']) && isset($bodyDecoded['object']['attributedTo']) ) { - if(parse_url($bodyDecoded['object']['attributedTo'], PHP_URL_HOST) !== $keyDomain) { + if(parse_url(Helpers::pluckval($bodyDecoded['object']['attributedTo']), PHP_URL_HOST) !== $keyDomain) { return; - abort(400, 'Invalid request'); } } if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) { @@ -178,7 +177,7 @@ class InboxValidator implements ShouldQueue } $actor = Profile::whereKeyId($keyId)->first(); if(!$actor) { - $actorUrl = is_array($bodyDecoded['actor']) ? $bodyDecoded['actor'][0] : $bodyDecoded['actor']; + $actorUrl = Helpers::pluckval($bodyDecoded['actor']); $actor = Helpers::profileFirstOrNew($actorUrl); } if(!$actor) { diff --git a/app/Jobs/InboxPipeline/InboxWorker.php b/app/Jobs/InboxPipeline/InboxWorker.php index 44e3a1cb0..f475b2dc5 100644 --- a/app/Jobs/InboxPipeline/InboxWorker.php +++ b/app/Jobs/InboxPipeline/InboxWorker.php @@ -157,7 +157,7 @@ class InboxWorker implements ShouldQueue && is_array($bodyDecoded['object']) && isset($bodyDecoded['object']['attributedTo']) ) { - if(parse_url($bodyDecoded['object']['attributedTo'], PHP_URL_HOST) !== $keyDomain) { + if(parse_url(Helpers::pluckval($bodyDecoded['object']['attributedTo']), PHP_URL_HOST) !== $keyDomain) { return; } } @@ -166,7 +166,7 @@ class InboxWorker implements ShouldQueue } $actor = Profile::whereKeyId($keyId)->first(); if(!$actor) { - $actorUrl = is_array($bodyDecoded['actor']) ? $bodyDecoded['actor'][0] : $bodyDecoded['actor']; + $actorUrl = Helpers::pluckval($bodyDecoded['actor']); $actor = Helpers::profileFirstOrNew($actorUrl); } if(!$actor) {