1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00

Update InboxPipeline, fixes #3332

This commit is contained in:
Daniel Supernault 2022-04-06 01:03:05 -06:00
parent f8931dc7cd
commit 4287f14bc5
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 4 additions and 5 deletions

View file

@ -167,9 +167,8 @@ class InboxValidator implements ShouldQueue
&& is_array($bodyDecoded['object']) && is_array($bodyDecoded['object'])
&& isset($bodyDecoded['object']['attributedTo']) && 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; return;
abort(400, 'Invalid request');
} }
} }
if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) { if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) {
@ -178,7 +177,7 @@ class InboxValidator implements ShouldQueue
} }
$actor = Profile::whereKeyId($keyId)->first(); $actor = Profile::whereKeyId($keyId)->first();
if(!$actor) { if(!$actor) {
$actorUrl = is_array($bodyDecoded['actor']) ? $bodyDecoded['actor'][0] : $bodyDecoded['actor']; $actorUrl = Helpers::pluckval($bodyDecoded['actor']);
$actor = Helpers::profileFirstOrNew($actorUrl); $actor = Helpers::profileFirstOrNew($actorUrl);
} }
if(!$actor) { if(!$actor) {

View file

@ -157,7 +157,7 @@ class InboxWorker implements ShouldQueue
&& is_array($bodyDecoded['object']) && is_array($bodyDecoded['object'])
&& isset($bodyDecoded['object']['attributedTo']) && 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; return;
} }
} }
@ -166,7 +166,7 @@ class InboxWorker implements ShouldQueue
} }
$actor = Profile::whereKeyId($keyId)->first(); $actor = Profile::whereKeyId($keyId)->first();
if(!$actor) { if(!$actor) {
$actorUrl = is_array($bodyDecoded['actor']) ? $bodyDecoded['actor'][0] : $bodyDecoded['actor']; $actorUrl = Helpers::pluckval($bodyDecoded['actor']);
$actor = Helpers::profileFirstOrNew($actorUrl); $actor = Helpers::profileFirstOrNew($actorUrl);
} }
if(!$actor) { if(!$actor) {