소스 검색

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

Daniel Supernault 4 년 전
부모
커밋
d1c5e9b867
2개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      app/Jobs/InboxPipeline/InboxValidator.php
  2. 3 0
      app/Jobs/InboxPipeline/InboxWorker.php

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

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

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

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