Skip to content

Commit eab019c

Browse files
nickvergessenblizzz
authored andcommitted
fix: Correctly check result of function
Signed-off-by: Joas Schilling <[email protected]>
1 parent a812fac commit eab019c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/private/Installer.php

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

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

lib/private/Security/IdentityProof/Signer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public function verify(array $data): bool {
9393
$user = $this->userManager->get($userId);
9494
if ($user !== null) {
9595
$key = $this->keyManager->getKey($user);
96-
return (bool)openssl_verify(
96+
return openssl_verify(
9797
json_encode($data['message']),
9898
base64_decode($data['signature']),
9999
$key->getPublic(),
100100
OPENSSL_ALGO_SHA512
101-
);
101+
) === 1;
102102
}
103103
}
104104

0 commit comments

Comments
 (0)