Skip to content

Commit 077dedf

Browse files
AngelFQCclaude
andcommitted
Security: fix SQL precedence so soft-deleted users stay filtered
The user list query in access_url_add_users_to_url.php mixed AND and OR without parentheses, so SQL precedence made the active <> USER_SOFT_DELETED filter apply only to the first LIKE clause; the trailing OR clause returned matching users regardless of status, exposing soft-deleted accounts. Wrap the OR group in parentheses so the active-status filter applies to the whole match. Refs GHSA-6cmq-j35w-q932 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4ebcf1a commit 077dedf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

public/main/admin/access_url_add_users_to_url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
$target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
8686
$target_name = 'lastname';
8787
$sql = "SELECT id, lastname, firstname, username FROM $tbl_user
88-
WHERE active <> ".USER_SOFT_DELETED." AND ".$target_name." LIKE '".$first_letter_user_lower."%' OR ".$target_name." LIKE '".$first_letter_user_lower."%'
88+
WHERE active <> ".USER_SOFT_DELETED." AND (".$target_name." LIKE '".$first_letter_user_lower."%' OR ".$target_name." LIKE '".$first_letter_user_lower."%')
8989
ORDER BY ".(count($users) > 0 ? '(id IN('.implode(',', $users).')) DESC,' : '').' '.$target_name;
9090
$result = Database::query($sql);
9191
$db_users = Database::store_result($result);

0 commit comments

Comments
 (0)