Explorar o código

Update WebfingerService, apply banned domains to webfinger logic

Daniel Supernault hai 3 meses
pai
achega
c1f2dfb013
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      app/Services/WebfingerService.php

+ 16 - 0
app/Services/WebfingerService.php

@@ -11,10 +11,26 @@ class WebfingerService
 {
     public static function rawGet($url)
     {
+        if (empty($url)) {
+            return false;
+        }
+
         $n = WebfingerUrl::get($url);
+
         if (! $n) {
             return false;
         }
+        if (empty($n) || ! str_starts_with($n, 'https://')) {
+            return false;
+        }
+        $host = parse_url($n, PHP_URL_HOST);
+        if (! $host) {
+            return false;
+        }
+
+        if (in_array($host, InstanceService::getBannedDomains())) {
+            return false;
+        }
         $webfinger = FetchCacheService::getJson($n);
         if (! $webfinger) {
             return false;