Skip to content

Commit cd24a7c

Browse files
committed
fix(HaRP): do not block HaRP itself if requests contain a non-existent application
Signed-off-by: Oleksander Piskun <[email protected]>
1 parent 20044da commit cd24a7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Controller/HarpController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ public function getExAppMetadata(string $appId): DataResponse {
7373
$exApp = $this->exAppService->getExApp($appId);
7474
if ($exApp === null) {
7575
$this->logger->error('ExApp not found', ['appId' => $appId]);
76-
// Protection for guessing installed ExApps list
77-
$this->throttler->registerAttempt(Application::APP_ID, $this->request->getRemoteAddress(), [
78-
'appid' => $appId,
79-
]);
8076
// return the same response as invalid harp key to prevent ex-app guessing
8177
return new DataResponse(['message' => 'Harp shared key is not valid'], Http::STATUS_UNAUTHORIZED);
8278
}
8379

8480
if (!$this->validateHarpSharedKey($exApp)) {
81+
// Protection for guessing HaRP shared key
82+
$this->throttler->registerAttempt(Application::APP_ID, $this->request->getRemoteAddress(), [
83+
'appid' => $appId,
84+
]);
85+
$this->logger->error('Harp shared key is not valid', ['appId' => $appId]);
8586
return new DataResponse(['message' => 'Harp shared key is not valid'], Http::STATUS_UNAUTHORIZED);
8687
}
8788

0 commit comments

Comments
 (0)