Browse Source

Update InboxPipeline, fail earlier for invalid public keys. Fixes #2648

Daniel Supernault 4 years ago
parent
commit
d1c5e9b867

+ 3 - 0
app/Jobs/InboxPipeline/InboxValidator.php

@@ -173,6 +173,9 @@ class InboxValidator implements ShouldQueue
             return;
             return;
         }
         }
         $pkey = openssl_pkey_get_public($actor->public_key);
         $pkey = openssl_pkey_get_public($actor->public_key);
+        if(!$pkey) {
+            return 0;
+        }
         $inboxPath = "/users/{$profile->username}/inbox";
         $inboxPath = "/users/{$profile->username}/inbox";
         list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $headers, $inboxPath, $body);
         list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $headers, $inboxPath, $body);
         if($verified == 1) { 
         if($verified == 1) { 

+ 3 - 0
app/Jobs/InboxPipeline/InboxWorker.php

@@ -161,6 +161,9 @@ class InboxWorker implements ShouldQueue
             return;
             return;
         }
         }
         $pkey = openssl_pkey_get_public($actor->public_key);
         $pkey = openssl_pkey_get_public($actor->public_key);
+        if(!$pkey) {
+            return 0;
+        }
         $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);
         if($verified == 1) { 
         if($verified == 1) {