Skip to content

Commit 2fdfcbd

Browse files
Merge pull request #45322 from nextcloud/backport/45321/stable29
[stable29] fix: Correctly check result of function
2 parents 79908f9 + 4ad567d commit 2fdfcbd

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/private/Installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function downloadApp(string $appId, bool $allowUnstable = false): void {
280280

281281
// Check if the signature actually matches the downloaded content
282282
$certificate = openssl_get_publickey($app['certificate']);
283-
$verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
283+
$verified = openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512) === 1;
284284
// PHP 8+ deprecates openssl_free_key and automatically destroys the key instance when it goes out of scope
285285
if ((PHP_VERSION_ID < 80000)) {
286286
openssl_free_key($certificate);

lib/private/Security/IdentityProof/Signer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ public function verify(array $data): bool {
7474
$user = $this->userManager->get($userId);
7575
if ($user !== null) {
7676
$key = $this->keyManager->getKey($user);
77-
return (bool)openssl_verify(
77+
return openssl_verify(
7878
json_encode($data['message']),
7979
base64_decode($data['signature']),
8080
$key->getPublic(),
8181
OPENSSL_ALGO_SHA512
82-
);
82+
) === 1;
8383
}
8484
}
8585

0 commit comments

Comments
 (0)