The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Allow wildcard routes for nonproxy admin (SCIM) (#17178)
v0rtex20k205a563b65d1
diff --git a/litellm/proxy/auth/route_checks.py b/litellm/proxy/auth/route_checks.pyindex 664b8a9ddce..76621e95cd3 100644--- a/litellm/proxy/auth/route_checks.py+++ b/litellm/proxy/auth/route_checks.py@@ -241,6 +241,12 @@ class RouteChecks:route_allowed = Truebreak+ if RouteChecks._route_matches_wildcard_pattern(+ route=route, pattern=allowed_route+ ):+ route_allowed = True+ break+if not route_allowed:RouteChecks._raise_admin_only_route_exception(user_obj=user_obj, route=routediff --git a/tests/test_litellm/proxy/auth/test_route_checks.py b/tests/test_litellm/proxy/auth/test_route_checks.pyindex b2a51de3d67..de2aa2427ca 100644--- a/tests/test_litellm/proxy/auth/test_route_checks.py+++ b/tests/test_litellm/proxy/auth/test_route_checks.py@@ -732,3 +732,31 @@ def test_videos_route_with_virtual_key_llm_api_routes():assert (result is True), f"Virtual key with llm_api_routes should be able to access {route}"++def test_non_proxy_admin_wildcard_allowed_routes():+ """Test that nonproxy admin users can still use wildcard routes"""++ user_obj = LiteLLM_UserTable(+ user_id="test_user",+ user_email="[email protected]",+ user_role=LitellmUserRoles.INTERNAL_USER.value,+ )++ valid_token = UserAPIKeyAuth(+ user_id="test_user",+ user_role=LitellmUserRoles.INTERNAL_USER.value,+ allowed_routes=["/scim/*"],+ )++ request = MagicMock(spec=Request)+ request.query_params = {}++ RouteChecks.non_proxy_admin_allowed_routes_check(+ user_obj=user_obj,+ _user_role=LitellmUserRoles.INTERNAL_USER.value,+ route="/scim/v2/Users",+ request=request,+ valid_token=valid_token,+ request_data={},+ )+