Skip to content

Commit 9cdb6d1

Browse files
authored
Merge pull request #60576 from nextcloud/backport/60547/stable31
[stable31] fix: don't tell the remote their token is lower
2 parents b70b80a + d14d8a4 commit 9cdb6d1

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
@@ -110,7 +110,7 @@ public function requestSharedSecret(string $url, string $token): DataResponse {
110110
'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
111111
['app' => 'federation']
112112
);
113-
throw new OCSForbiddenException();
113+
return new DataResponse();
114114
}
115115

116116
$this->jobList->add(

apps/federation/tests/Controller/OCSAuthAPIControllerTest.php

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

106106
try {
107107
$this->ocsAuthApi->requestSharedSecret($url, $token);
108-
$this->assertTrue($ok);
108+
$this->assertTrue($isTrustedServer);
109109
} catch (OCSForbiddenException $e) {
110-
$this->assertFalse($ok);
110+
$this->assertFalse($isTrustedServer);
111111
}
112112
}
113113

@@ -160,7 +160,6 @@ public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, b
160160

161161
try {
162162
$result = $ocsAuthApi->getSharedSecret($url, $token);
163-
$this->assertTrue($ok);
164163
$data = $result->getData();
165164
$this->assertSame('secret', $data['sharedSecret']);
166165
} catch (OCSForbiddenException $e) {

0 commit comments

Comments
 (0)