Skip to content

Commit 088bc44

Browse files
authored
Merge pull request #60577 from nextcloud/backport/60547/stable30
[stable30] fix: don't tell the remote their token is lower
2 parents 022f2f5 + 9e8f0b0 commit 088bc44

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
@@ -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

@@ -163,7 +163,6 @@ public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, b
163163

164164
try {
165165
$result = $ocsAuthApi->getSharedSecret($url, $token);
166-
$this->assertTrue($ok);
167166
$data = $result->getData();
168167
$this->assertSame('secret', $data['sharedSecret']);
169168
} catch (OCSForbiddenException $e) {

0 commit comments

Comments
 (0)