From 78aeabe9deb620bb25ba5ec35dec7e86834d738e Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 15 Oct 2025 13:21:15 -0100 Subject: [PATCH] limit event to configured interface Signed-off-by: Maxence Lange --- lib/Controller/RemoteController.php | 5 +++++ lib/Service/RemoteStreamService.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lib/Controller/RemoteController.php b/lib/Controller/RemoteController.php index 9c43a5778..cab9721df 100644 --- a/lib/Controller/RemoteController.php +++ b/lib/Controller/RemoteController.php @@ -411,8 +411,13 @@ public function memberships(string $circleId): DataResponse { * @throws MalformedArrayException * @throws SignatoryException * @throws SignatureException + * @throws UnknownInterfaceException */ private function extractEventFromRequest(): FederatedEvent { + // will throw exception if instance is not configured for this event. + $this->interfaceService->setCurrentInterfaceFromRequest($this->request); + $this->interfaceService->getCurrentInterface(); + $signed = $this->remoteStreamService->incomingSignedRequest(); $this->confirmRemoteInstance($signed); diff --git a/lib/Service/RemoteStreamService.php b/lib/Service/RemoteStreamService.php index e41348998..b913803dc 100644 --- a/lib/Service/RemoteStreamService.php +++ b/lib/Service/RemoteStreamService.php @@ -38,6 +38,7 @@ use OCA\Circles\Tools\Traits\TNCWellKnown; use OCA\Circles\Tools\Traits\TStringTools; use OCP\AppFramework\Http; +use OCP\IConfig; use OCP\IURLGenerator; use ReflectionClass; use ReflectionException; @@ -83,6 +84,7 @@ class RemoteStreamService extends NCSignature { * @param ConfigService $configService */ public function __construct( + private readonly IConfig $config, IURLGenerator $urlGenerator, RemoteRequest $remoteRequest, InterfaceService $interfaceService, @@ -364,6 +366,7 @@ public function retrieveSignatory(string $keyId, bool $refresh = true): NCSignat $request = new NCRequest(); $this->configService->configureRequest($request); + $request->setLocalAddressAllowed($this->config->getSystemValueBool('allow_local_remote_servers')); $this->downloadSignatory($remoteInstance, $keyId, ['auth' => $confirm], $request); $remoteInstance->setUidFromKey();