Skip to content

Commit 9a00604

Browse files
authored
Merge pull request #60547 from nextcloud/fed-share-secret-lower-dont-tell
fix: don't tell the remote their token is lower
2 parents 9a03d9a + e9fc60b commit 9a00604

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

apps/federation/lib/Controller/OCSAuthAPIController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function requestSharedSecret(string $url, string $token): DataResponse {
109109
$this->logger->info(
110110
'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.'
111111
);
112-
throw new OCSForbiddenException();
112+
return new DataResponse();
113113
}
114114

115115
$this->jobList->add(

apps/federation/tests/Controller/OCSAuthAPIControllerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public function testRequestSharedSecret(string $token, string $localToken, bool
9090

9191
try {
9292
$this->ocsAuthApi->requestSharedSecret($url, $token);
93-
$this->assertTrue($ok);
93+
$this->assertTrue($isTrustedServer);
9494
} catch (OCSForbiddenException $e) {
95-
$this->assertFalse($ok);
95+
$this->assertFalse($isTrustedServer);
9696
}
9797
}
9898

@@ -144,7 +144,6 @@ public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, b
144144

145145
try {
146146
$result = $ocsAuthApi->getSharedSecret($url, $token);
147-
$this->assertTrue($ok);
148147
$data = $result->getData();
149148
$this->assertSame('secret', $data['sharedSecret']);
150149
} catch (OCSForbiddenException $e) {

0 commit comments

Comments
 (0)