Skip to content

Commit 5c69644

Browse files
committed
fix(security): unbounded limit parameter in user search can be
The `index(string $filter = '', int $limit = 5)` method accepts client-controlled `limit` and passes it directly to collaborator search. Without an upper bound, an attacker can request very large limits, causing expensive directory lookups and increased response size. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
1 parent 9ad3fab commit 5c69644

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/Controller/UserApiController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function index(string $filter = '', int $limit = 5): DataResponse {
5555

5656
if (!$this->getSession()->isGuest()) {
5757
// Add other users to the autocomplete list
58+
$limit = min($limit, 50);
5859
[$result] = $this->collaboratorSearch->search($filter, [IShare::TYPE_USER], false, $limit, 0);
5960
$userSearch = array_merge($result['users'], $result['exact']['users']);
6061

0 commit comments

Comments
 (0)