Skip to content

A free, self-hostable news aggregator…

Security: Use hash_equals() for GReader API token comparison (#9183)

Alexandre Alapetiteacef1de21f10
diff --git a/p/api/greader.php b/p/api/greader.php
index 74c97407a..9006e6095 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -192,7 +192,7 @@ final class GReaderAPI {
Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.');
self::unauthorized();
}
- if ($headerAuthX[1] === sha1(FreshRSS_Context::systemConf()->salt . $user . FreshRSS_Context::userConf()->apiPasswordHash)) {
+ if (hash_equals(sha1(FreshRSS_Context::systemConf()->salt . $user . FreshRSS_Context::userConf()->apiPasswordHash), $headerAuthX[1])) {
return $user;
} else {
Minz_Log::warning('Invalid API authorisation for user ' . $user);