Skip to content

Commit dd6a67c

Browse files
authored
Merge pull request #60579 from nextcloud/backport/60547/stable28
[stable28] fix: don't tell the remote their token is lower
2 parents 4d58883 + 1f679b8 commit dd6a67c

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
@@ -147,7 +147,7 @@ public function requestSharedSecret(string $url, string $token): DataResponse {
147147
'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
148148
['app' => 'federation']
149149
);
150-
throw new OCSForbiddenException();
150+
return new DataResponse();
151151
}
152152

153153
$this->jobList->add(

apps/federation/tests/Controller/OCSAuthAPIControllerTest.php

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

125125
try {
126126
$this->ocsAuthApi->requestSharedSecret($url, $token);
127-
$this->assertTrue($ok);
127+
$this->assertTrue($isTrustedServer);
128128
} catch (OCSForbiddenException $e) {
129-
$this->assertFalse($ok);
129+
$this->assertFalse($isTrustedServer);
130130
}
131131
}
132132

@@ -182,7 +182,6 @@ public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, b
182182

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

0 commit comments

Comments
 (0)