]> git.mxchange.org Git - friendica.git/commitdiff
Issue 10747: Improved check for blocked domains
authorMichael <heluecht@pirati.ca>
Sat, 2 Oct 2021 10:25:50 +0000 (10:25 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 2 Oct 2021 10:25:50 +0000 (10:25 +0000)
src/Model/APContact.php
src/Network/Probe.php

index 13add7e658939fdd92b9d6871eaf537aebe86c4b..a919a67f30e740c88d1e2e13b7d5bd73be34a9ae 100644 (file)
@@ -119,7 +119,8 @@ class APContact
         */
        public static function getByURL($url, $update = null)
        {
-               if (empty($url)) {
+               if (empty($url) || Network::isUrlBlocked($url)) {
+                       Logger::info('Domain is blocked', ['url' => $url]);
                        return [];
                }
 
index bb805b2d051f71a0386c13609c084ea0889310e8..4aa50b4be5a71b91438ab7025192a106314e6349 100644 (file)
@@ -231,6 +231,11 @@ class Probe
                        }
                }
 
+               if (Network::isUrlBlocked($host_url)) {
+                       Logger::info('Domain is blocked', ['url' => $host]);
+                       return [];
+               }
+
                self::$baseurl = $host_url;
 
                Logger::info('Probing successful', ['host' => $host]);
@@ -625,6 +630,11 @@ class Probe
         */
        private static function getWebfinger(string $template, string $type, string $uri, string $addr)
        {
+               if (Network::isUrlBlocked($template)) {
+                       Logger::info('Domain is blocked', ['url' => $template]);
+                       return [];
+               }
+
                // First try the address because this is the primary purpose of webfinger
                if (!empty($addr)) {
                        $detected = $addr;