Avoid beeing flooded by invalid requests

This commit is contained in:
Michael 2018-10-13 04:31:37 +00:00
parent 5f9dd11cfb
commit b6f2144237
2 changed files with 7 additions and 3 deletions

View file

@ -48,6 +48,10 @@ if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']); System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']);
} }
if (strstr($a->query_string, '.well-known/host-meta') and ($a->query_string != '.well-known/host-meta')) {
System::httpExit(404);
}
if (!$a->getMode()->isInstall()) { if (!$a->getMode()->isInstall()) {
if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http") if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL) && (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)

View file

@ -13,7 +13,7 @@ function xrd_init(App $a)
{ {
if ($a->argv[0] == 'xrd') { if ($a->argv[0] == 'xrd') {
if (empty($_GET['uri'])) { if (empty($_GET['uri'])) {
killme(); System::httpExit(404);
} }
$uri = urldecode(notags(trim($_GET['uri']))); $uri = urldecode(notags(trim($_GET['uri'])));
@ -24,7 +24,7 @@ function xrd_init(App $a)
} }
} else { } else {
if (empty($_GET['resource'])) { if (empty($_GET['resource'])) {
killme(); System::httpExit(404);
} }
$uri = urldecode(notags(trim($_GET['resource']))); $uri = urldecode(notags(trim($_GET['resource'])));
@ -48,7 +48,7 @@ function xrd_init(App $a)
$user = DBA::selectFirst('user', [], ['nickname' => $name]); $user = DBA::selectFirst('user', [], ['nickname' => $name]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
killme(); System::httpExit(404);
} }
$profile_url = System::baseUrl().'/profile/'.$user['nickname']; $profile_url = System::baseUrl().'/profile/'.$user['nickname'];