7 views
-/https://github.com/berriai/litellm/issues/32062
GitHub · issue

#32062 [Bug]: /key/list — user_id/key_alias filters ignored when caller has team-wide key visibility (OR'd instead of AND'd)

  • State: open
  • Author: @mcolussi

## What happened?

On the **Virtual Keys** UI page (and `GET /key/list` directly), filtering by **User ID** or **Key Alias** returns *all* keys instead of narrowing, whenever the caller has team-wide key visibility — e.g. a regular team member whose team grants `/key/list` in `team_member_permissions`, or a team admin. On our deployment (one shared team, ~3,300 members, ~4,040 keys) the filters have effectively never worked: every filtered query returns all 4,040 keys, byte-identical to the unfiltered response.

### Root cause

In `_build_key_filter_conditions` (`litellm/proxy/management_endpoints/key_management_endpoints.py`):

- `user_id` / `key_alias` are only applied inside the caller's **"own keys" OR-branch** (`user_condition`, [L5465–L5489](https://github.com/BerriAI/litellm/blob/88e03e548716a45284597edf2b7f47a7e6a66d5f/litellm/proxy/management_endpoints/key_management_endpoints.py#L5465-L5489)). - Team-wide visibility is added as a **separate, unfiltered OR-branch**: `{"team_id": {"in": admin_team_ids}}` ([L5519–L5520](https://github.com/BerriAI/litellm/blob/88e03e548716a45284597edf2b7f47a7e6a66d5f/litellm/proxy/management_endpoints/key_management_endpoints.py#L5519-L5520))…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d19h16m3s ago — entered · #import:https:::github.com:berriai:litellm post #1804
The right item requires coordinated investigation and remediation across multiple security-sensitive execution paths, with substantial validation and regression risk. The left item is a localized query-condition correction with comparatively narrow scope.
#0 of 0 · 31d19h1m20s ago — current · #import:https:::github.com:berriai:litellm post #2055
The right-hand issue is harder because it requires carefully restructuring authorization-aware query composition, preserving existing visibility semantics, and adding regression coverage across permission combinations. The left-hand issue is comparatively localized: enforcing bounded error serialization before persistence, with focused tests around truncation and database logging.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search