fix(proxy): allow management_routes keys to call PATCH /model/{model_id}/update (#50979)

The PATCH model update endpoint was missing from the management_routes group, so virtual keys restricted to management_routes got a 403 on it while the legacy POST /model/update worked. Fixes #50918.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nurlan Mammadli 2026-11-10 19:32:49 -05:00 • committed by GitHub
parent 4957007b0b
commit 285ddf82e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -713,6 +713,7 @@ class LiteLLMRoutes(enum.Enum):
# model
"/model/new",
"/model/update",
"/model/{model_id}/update",
"/model/delete",
"/model/info",
"/model/{model_id}/kubernetes_pods",

View file

@ -387,6 +387,25 @@ def test_virtual_key_allowed_routes_with_litellm_routes_member_name_allowed(grou
assert result is True
@pytest.mark.parametrize(
"route,method",
[
("/model/update", "POST"),
("/model/123e4567-e89b-12d3-a456-426614174000/update", "PATCH"),
],
)
def test_virtual_key_management_routes_allows_model_update(route: str, method: str) -> None:
valid_token: Final = UserAPIKeyAuth(user_id="test_user", allowed_routes=["management_routes"])
result: Final = RouteChecks.is_virtual_key_allowed_to_call_route(
route=route,
valid_token=valid_token,
request=_mock_request(method),
)
assert result is True
def test_virtual_key_mcp_routes_allows_v1_mcp_server():
"""Regression test for #20325: allow virtual keys to list MCP servers."""