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]

fix(vector_stores): classify POST /indexes create as admin-only lifecycle with query string

Noah Nistler23f50e1f343f
diff --git a/litellm/proxy/vector_store_endpoints/utils.py b/litellm/proxy/vector_store_endpoints/utils.py
index 94ba7c06cad..afde5c787f1 100644
--- a/litellm/proxy/vector_store_endpoints/utils.py
+++ b/litellm/proxy/vector_store_endpoints/utils.py
@@ -86,7 +86,7 @@ def _is_vector_store_index_lifecycle_request(
return True
# POST /indexes (create index at service level; no index name in path).
- normalized: Final = request_path.rstrip("/")
+ normalized: Final = request_path.split("?", 1)[0].rstrip("/")
if request_method == "POST" and normalized.endswith("/indexes"):
return True
diff --git a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py
index 2a97a7df9d0..ad86ce60eab 100644
--- a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py
+++ b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py
@@ -3007,15 +3007,19 @@ class TestAzureAIDocumentWritePassthroughPermission:
assert exc_info.value.status_code == 403
@pytest.mark.parametrize(
- "method, operation",
- [("PUT", "update"), ("DELETE", "delete")],
- )
- def test_team_cannot_manage_index_lifecycle_even_with_write_grant(self, method, operation):
+ "method, operation, path",
+ [
+ ("PUT", "update", f"/azure_ai/indexes/{INDEX}?api-version=2024-07-01"),
+ ("DELETE", "delete", f"/azure_ai/indexes/{INDEX}?api-version=2024-07-01"),
+ ("POST", "create", "/azure_ai/indexes?api-version=2024-07-01"),
+ ],
+ )
+ def test_team_cannot_manage_index_lifecycle_even_with_write_grant(self, method, operation, path):
with pytest.raises(HTTPException) as exc_info:
is_allowed_to_call_vector_store_endpoint(
provider=LlmProviders.AZURE_AI,
index_name=self.INDEX,
- request=self._request(method, f"/azure_ai/indexes/{self.INDEX}?api-version=2024-07-01"),
+ request=self._request(method, path),
user_api_key_dict=self._team_member(["read", "write"]),
)
assert exc_info.value.status_code == 403