1
0
Fork 0
forked from mirror/pixelfed

Update InboxPipeline

This commit is contained in:
Daniel Supernault 2022-12-09 05:49:39 -07:00
parent 3cfa8b69fb
commit bce1d547e7
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -107,9 +107,6 @@ class DeleteWorker implements ShouldQueue
if($this->verifySignature($headers, $payload) == true) { if($this->verifySignature($headers, $payload) == true) {
(new Inbox($headers, $profile, $payload))->handle(); (new Inbox($headers, $profile, $payload))->handle();
return 1; return 1;
} else if($this->blindKeyRotation($headers, $payload) == true) {
(new Inbox($headers, $profile, $payload))->handle();
return 1;
} else { } else {
return 1; return 1;
} }
@ -122,15 +119,15 @@ class DeleteWorker implements ShouldQueue
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature']; $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
$date = is_array($headers['date']) ? $headers['date'][0] : $headers['date']; $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
if(!$signature) { if(!$signature) {
return; return false;
} }
if(!$date) { if(!$date) {
return; return false;
} }
if(!now()->parse($date)->gt(now()->subDays(1)) || if(!now()->parse($date)->gt(now()->subDays(1)) ||
!now()->parse($date)->lt(now()->addDays(1)) !now()->parse($date)->lt(now()->addDays(1))
) { ) {
return; return false;
} }
$signatureData = HttpSignature::parseSignatureHeader($signature); $signatureData = HttpSignature::parseSignatureHeader($signature);
$keyId = Helpers::validateUrl($signatureData['keyId']); $keyId = Helpers::validateUrl($signatureData['keyId']);
@ -150,11 +147,11 @@ class DeleteWorker implements ShouldQueue
} }
} }
if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) { if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) {
return; return false;
} }
} }
if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) { if(!$keyDomain || !$idDomain || $keyDomain !== $idDomain) {
return; return false;
} }
$actor = Profile::whereKeyId($keyId)->first(); $actor = Profile::whereKeyId($keyId)->first();
if(!$actor) { if(!$actor) {
@ -162,11 +159,11 @@ class DeleteWorker implements ShouldQueue
$actor = Helpers::profileFirstOrNew($actorUrl); $actor = Helpers::profileFirstOrNew($actorUrl);
} }
if(!$actor) { if(!$actor) {
return; return false;
} }
$pkey = openssl_pkey_get_public($actor->public_key); $pkey = openssl_pkey_get_public($actor->public_key);
if(!$pkey) { if(!$pkey) {
return 0; return false;
} }
$inboxPath = "/f/inbox"; $inboxPath = "/f/inbox";
list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $headers, $inboxPath, $body); list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $headers, $inboxPath, $body);