Skip to content

Commit e645b4a

Browse files
committed
A few extra safety checks
1 parent 50fa2c0 commit e645b4a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ucp/controller/webpush.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ public function is_valid_endpoint(string $endpoint): bool
309309
return false;
310310
}
311311

312+
$host = strtolower($host);
313+
312314
if (in_array($host, self::PUSH_SERVICE_WHITELIST, true))
313315
{
314316
return true;
@@ -358,6 +360,8 @@ public function subscribe(symfony_request $symfony_request): JsonResponse
358360

359361
$data = json_sanitizer::decode($symfony_request->get('data', ''));
360362

363+
$data['endpoint'] = $data['endpoint'] ?? '';
364+
361365
if (!$this->is_valid_endpoint($data['endpoint']))
362366
{
363367
throw new http_exception(Response::HTTP_BAD_REQUEST, 'WEBPUSH_INVALID_ENDPOINT');

0 commit comments

Comments
 (0)