Skip to content

Commit 47a6716

Browse files
nickvergessenblizzz
authored andcommitted
fix: Correctly check result of function
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 8d725b1 commit 47a6716

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
@@ -297,7 +297,7 @@ public function downloadApp($appId, $allowUnstable = false) {
297297

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