summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-03-23 16:41:31 +0000
committerGitHub <noreply@github.com>2021-04-06 11:37:47 +0000
commit5f3abffe6f37b4f8639fde8bcaf35d873a17636c (patch)
tree3498450ac8351f5a292dacc7cb17de9b27e4535b /lib/private/Server.php
parent2056b76c5fb29fa9273c50e17e54c5cf43f8a5fc (diff)
downloadnextcloud-server-5f3abffe6f37b4f8639fde8bcaf35d873a17636c.tar.gz
nextcloud-server-5f3abffe6f37b4f8639fde8bcaf35d873a17636c.zip
Improve networking checks
Whilst we currently state that SSRF is generally outside of our threat model, this is something where we should invest to improve this. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 6a1550f83e0..c09ec0a8e18 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -100,6 +100,9 @@ use OC\Files\Type\Loader;
use OC\Files\View;
use OC\FullTextSearch\FullTextSearchManager;
use OC\Http\Client\ClientService;
+use OC\Http\Client\DnsPinMiddleware;
+use OC\Http\Client\LocalAddressChecker;
+use OC\Http\Client\NegativeDnsCache;
use OC\IntegrityCheck\Checker;
use OC\IntegrityCheck\Helpers\AppLocator;
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
@@ -822,6 +825,22 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerAlias(ICertificateManager::class, CertificateManager::class);
$this->registerAlias(IClientService::class, ClientService::class);
+ $this->registerService(LocalAddressChecker::class, function (ContainerInterface $c) {
+ return new LocalAddressChecker(
+ $c->get(ILogger::class),
+ );
+ });
+ $this->registerService(NegativeDnsCache::class, function (ContainerInterface $c) {
+ return new NegativeDnsCache(
+ $c->get(ICacheFactory::class),
+ );
+ });
+ $this->registerService(DnsPinMiddleware::class, function (ContainerInterface $c) {
+ return new DnsPinMiddleware(
+ $c->get(NegativeDnsCache::class),
+ $c->get(LocalAddressChecker::class)
+ );
+ });
$this->registerDeprecatedAlias('HttpClientService', IClientService::class);
$this->registerService(IEventLogger::class, function (ContainerInterface $c) {
$eventLogger = new EventLogger();