浏览代码

Update FederationController

Daniel Supernault 5 年之前
父节点
当前提交
b9acd64543
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      app/Http/Controllers/FederationController.php

+ 4 - 1
app/Http/Controllers/FederationController.php

@@ -228,6 +228,9 @@ class FederationController extends Controller
         $id = Helpers::validateUrl($bodyDecoded['id']);
         $id = Helpers::validateUrl($bodyDecoded['id']);
         $keyDomain = parse_url($keyId, PHP_URL_HOST);
         $keyDomain = parse_url($keyId, PHP_URL_HOST);
         $idDomain = parse_url($id, PHP_URL_HOST);
         $idDomain = parse_url($id, PHP_URL_HOST);
+        if($keyDomain == config('pixelfed.domain.app') || $idDomain == config('pixelfed.domain.app')) {
+            return false;
+        }
         if(isset($bodyDecoded['object']) 
         if(isset($bodyDecoded['object']) 
             && is_array($bodyDecoded['object'])
             && is_array($bodyDecoded['object'])
             && isset($bodyDecoded['object']['attributedTo'])
             && isset($bodyDecoded['object']['attributedTo'])
@@ -248,7 +251,7 @@ class FederationController extends Controller
         }
         }
         $pkey = openssl_pkey_get_public($actor->public_key);
         $pkey = openssl_pkey_get_public($actor->public_key);
         $inboxPath = "/users/{$profile->username}/inbox";
         $inboxPath = "/users/{$profile->username}/inbox";
-        list($verified, $headers) = HTTPSignature::verify($pkey, $signatureData, $request->headers->all(), $inboxPath, $body);
+        list($verified, $headers) = HttpSignature::verify($pkey, $signatureData, $request->headers->all(), $inboxPath, $body);
         if($verified == 1) { 
         if($verified == 1) { 
             return true;
             return true;
         } else {
         } else {