Skip to content

Commit fb712cf

Browse files
authored
Merge pull request #60581 from nextcloud/backport/60547/stable26
[stable26] fix: don't tell the remote their token is lower
2 parents 32e2e6a + 17ad1e7 commit fb712cf

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
@@ -126,7 +126,7 @@ public function requestSharedSecret(string $url, string $token): DataResponse {
126126
'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
127127
['app' => 'federation']
128128
);
129-
throw new OCSForbiddenException();
129+
return new DataResponse();
130130
}
131131

132132
$this->jobList->add(

apps/federation/tests/Controller/OCSAuthAPIControllerTest.php

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

126126
try {
127127
$this->ocsAuthApi->requestSharedSecret($url, $token);
128-
$this->assertTrue($ok);
128+
$this->assertTrue($isTrustedServer);
129129
} catch (OCSForbiddenException $e) {
130-
$this->assertFalse($ok);
130+
$this->assertFalse($isTrustedServer);
131131
}
132132
}
133133

@@ -183,7 +183,6 @@ public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, b
183183

184184
try {
185185
$result = $ocsAuthApi->getSharedSecret($url, $token);
186-
$this->assertTrue($ok);
187186
$data = $result->getData();
188187
$this->assertSame('secret', $data['sharedSecret']);
189188
} catch (OCSForbiddenException $e) {

0 commit comments

Comments
 (0)