Skip to content

Commit dc1b292

Browse files
Merge pull request #2212 from nextcloud/fix/noid/allow-local-request
limit event to configured interface
2 parents 118d380 + 78aeabe commit dc1b292

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/Controller/RemoteController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,13 @@ public function memberships(string $circleId): DataResponse {
411411
* @throws MalformedArrayException
412412
* @throws SignatoryException
413413
* @throws SignatureException
414+
* @throws UnknownInterfaceException
414415
*/
415416
private function extractEventFromRequest(): FederatedEvent {
417+
// will throw exception if instance is not configured for this event.
418+
$this->interfaceService->setCurrentInterfaceFromRequest($this->request);
419+
$this->interfaceService->getCurrentInterface();
420+
416421
$signed = $this->remoteStreamService->incomingSignedRequest();
417422
$this->confirmRemoteInstance($signed);
418423

lib/Service/RemoteStreamService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use OCA\Circles\Tools\Traits\TNCWellKnown;
3939
use OCA\Circles\Tools\Traits\TStringTools;
4040
use OCP\AppFramework\Http;
41+
use OCP\IConfig;
4142
use OCP\IURLGenerator;
4243
use ReflectionClass;
4344
use ReflectionException;
@@ -83,6 +84,7 @@ class RemoteStreamService extends NCSignature {
8384
* @param ConfigService $configService
8485
*/
8586
public function __construct(
87+
private readonly IConfig $config,
8688
IURLGenerator $urlGenerator,
8789
RemoteRequest $remoteRequest,
8890
InterfaceService $interfaceService,
@@ -364,6 +366,7 @@ public function retrieveSignatory(string $keyId, bool $refresh = true): NCSignat
364366
$request = new NCRequest();
365367
$this->configService->configureRequest($request);
366368

369+
$request->setLocalAddressAllowed($this->config->getSystemValueBool('allow_local_remote_servers'));
367370
$this->downloadSignatory($remoteInstance, $keyId, ['auth' => $confirm], $request);
368371
$remoteInstance->setUidFromKey();
369372

0 commit comments

Comments
 (0)