Merge pull request #10793 from annando/issue-10747

Issue 10747: Improved check for blocked domains
This commit is contained in:
Hypolite Petovan 2021-10-02 07:43:00 -04:00 committed by GitHub
commit ef7c543634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -119,7 +119,8 @@ class APContact
*/ */
public static function getByURL($url, $update = null) public static function getByURL($url, $update = null)
{ {
if (empty($url)) { if (empty($url) || Network::isUrlBlocked($url)) {
Logger::info('Domain is blocked', ['url' => $url]);
return []; return [];
} }

View file

@ -231,6 +231,11 @@ class Probe
} }
} }
if (Network::isUrlBlocked($host_url)) {
Logger::info('Domain is blocked', ['url' => $host]);
return [];
}
self::$baseurl = $host_url; self::$baseurl = $host_url;
Logger::info('Probing successful', ['host' => $host]); Logger::info('Probing successful', ['host' => $host]);
@ -625,6 +630,11 @@ class Probe
*/ */
private static function getWebfinger(string $template, string $type, string $uri, string $addr) 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 // First try the address because this is the primary purpose of webfinger
if (!empty($addr)) { if (!empty($addr)) {
$detected = $addr; $detected = $addr;