From bce1d547e7366c2fe509107dc2e70f515dc2c78b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 9 Dec 2022 05:49:39 -0700 Subject: [PATCH] Update InboxPipeline --- app/Jobs/InboxPipeline/DeleteWorker.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/Jobs/InboxPipeline/DeleteWorker.php b/app/Jobs/InboxPipeline/DeleteWorker.php index 74039d40..8b9cc256 100644 --- a/app/Jobs/InboxPipeline/DeleteWorker.php +++ b/app/Jobs/InboxPipeline/DeleteWorker.php @@ -107,9 +107,6 @@ class DeleteWorker implements ShouldQueue if($this->verifySignature($headers, $payload) == true) { (new Inbox($headers, $profile, $payload))->handle(); return 1; - } else if($this->blindKeyRotation($headers, $payload) == true) { - (new Inbox($headers, $profile, $payload))->handle(); - return 1; } else { return 1; } @@ -122,15 +119,15 @@ class DeleteWorker implements ShouldQueue $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature']; $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date']; if(!$signature) { - return; + return false; } if(!$date) { - return; + return false; } if(!now()->parse($date)->gt(now()->subDays(1)) || !now()->parse($date)->lt(now()->addDays(1)) ) { - return; + return false; } $signatureData = HttpSignature::parseSignatureHeader($signature); $keyId = Helpers::validateUrl($signatureData['keyId']); @@ -150,11 +147,11 @@ class DeleteWorker implements ShouldQueue } } if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) { - return; + return false; } } if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) { - return; + return false; } $actor = Profile::whereKeyId($keyId)->first(); if(!$actor) { @@ -162,11 +159,11 @@ class DeleteWorker implements ShouldQueue $actor = Helpers::profileFirstOrNew($actorUrl); } if(!$actor) { - return; + return false; } $pkey = openssl_pkey_get_public($actor->public_key); if(!$pkey) { - return 0; + return false; } $inboxPath = "/f/inbox"; list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $headers, $inboxPath, $body);