Skip to content

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]

allow non-admin roles on /compliance/* read routes

Michael Riad Zaky2993e45ad18e
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index c6653a722d6..7a049dcc5de 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -656,6 +656,13 @@ class LiteLLMRoutes(enum.Enum):
"/health/services",
] + info_routes
+ # Stateless validators on caller-supplied log data; source logs are
+ # already accessible via spend_tracking_routes, so no scope expansion.
+ compliance_check_routes = [
+ "/compliance/eu-ai-act",
+ "/compliance/gdpr",
+ ]
+
# Routes in `global_spend_tracking_routes` return proxy-wide spend across
# every team, customer, and api_key. They are intentionally NOT included
# here — non-admin roles must not see other tenants' spend. Admin roles go
@@ -675,9 +682,10 @@ class LiteLLMRoutes(enum.Enum):
]
+ spend_tracking_routes
+ key_management_routes
+ + compliance_check_routes
)
- internal_user_view_only_routes = spend_tracking_routes
+ internal_user_view_only_routes = spend_tracking_routes + compliance_check_routes
self_managed_routes = [
"/team/member_add",
diff --git a/tests/test_litellm/proxy/auth/test_route_checks.py b/tests/test_litellm/proxy/auth/test_route_checks.py
index cf6feabf85f..3e0b1b739ec 100644
--- a/tests/test_litellm/proxy/auth/test_route_checks.py
+++ b/tests/test_litellm/proxy/auth/test_route_checks.py
@@ -53,6 +53,39 @@ def test_non_admin_config_update_route_rejected():
assert "Your role=internal_user" in str(exc_info.value)
+ "role",
+ [
+ LitellmUserRoles.INTERNAL_USER.value,
+ LitellmUserRoles.INTERNAL_USER_VIEW_ONLY.value,
+ ],
+)
+ "route",
+ ["/compliance/eu-ai-act", "/compliance/gdpr"],
+)
+def test_compliance_routes_open_to_non_admin_roles(role, route):
+ """Compliance routes are stateless validators on caller-supplied log data
+ — both non-admin internal_user roles can call them."""
+ user_obj = LiteLLM_UserTable(
+ user_id="test_user",
+ user_email="[email protected]",
+ user_role=role,
+ )
+ valid_token = UserAPIKeyAuth(user_id="test_user", user_role=role)
+ request = MagicMock(spec=Request)
+ request.query_params = {}
+
+ RouteChecks.non_proxy_admin_allowed_routes_check(
+ user_obj=user_obj,
+ _user_role=role,
+ route=route,
+ request=request,
+ valid_token=valid_token,
+ request_data={},
+ )
+
+
def test_proxy_admin_viewer_config_update_route_rejected():
"""Test that proxy admin viewer users are rejected when trying to call /config/update"""