Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-02-23 14:53:47 +0300
committerJulius Härtl <jus@bitgrid.net>2021-02-23 14:53:47 +0300
commitdb482c09aa1deddfa9eb8b43fe8b9f7f69b66235 (patch)
treee5f63446f6bb8e96f36abd645f21eed8e4d85b48 /lib
parent920fc643722b23fae8972ddc166c144e422ae575 (diff)
Make sure that the same host remote is always considered as trusted
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/FederationService.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Service/FederationService.php b/lib/Service/FederationService.php
index 7c82e7d3..d07c61f9 100644
--- a/lib/Service/FederationService.php
+++ b/lib/Service/FederationService.php
@@ -37,6 +37,7 @@ use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
+use OCP\IRequest;
class FederationService {
@@ -52,13 +53,16 @@ class FederationService {
private $config;
/** @var TokenManager */
private $tokenManager;
+ /** @var IRequest */
+ private $request;
- public function __construct(ICacheFactory $cacheFactory, IClientService $clientService, ILogger $logger, TokenManager $tokenManager, IConfig $config) {
+ public function __construct(ICacheFactory $cacheFactory, IClientService $clientService, ILogger $logger, TokenManager $tokenManager, IConfig $config, IRequest $request) {
$this->cache = $cacheFactory->createDistributed('richdocuments_remote/');
$this->clientService = $clientService;
$this->logger = $logger;
$this->tokenManager = $tokenManager;
$this->config = $config;
+ $this->request = $request;
try {
$this->trustedServers = \OC::$server->query( \OCA\Federation\TrustedServers::class);
} catch (QueryException $e) {}
@@ -108,7 +112,7 @@ class FederationService {
$domain = $this->getDomainWithoutPort($domainWithPort);
- $trustedList = $this->config->getSystemValue('gs.trustedHosts', []);
+ $trustedList = array_merge($this->config->getSystemValue('gs.trustedHosts', []), [$this->request->getServerHost()]);
if (!is_array($trustedList)) {
return false;
}