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
fix memory_usage_in_mem_cache cache endpoint vulnerability (#14229)
Ishaan Jaffab3cd5e96ead
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 7206d3dcb0e..0595c44d69d 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -388,7 +388,11 @@ class LiteLLMRoutes(enum.Enum):]# NOTE: ROUTES ONLY FOR MASTER KEY - only the Master Key should be able to Reset Spend- master_key_only_routes = ["/global/spend/reset"]+ master_key_only_routes = [+ "/global/spend/reset",+ "/memory-usage-in-mem-cache",+ "/memory-usage-in-mem-cache-items",+ ]key_management_routes = [KeyManagementRoutes.KEY_GENERATE,diff --git a/litellm/proxy/common_utils/debug_utils.py b/litellm/proxy/common_utils/debug_utils.pyindex 8096d782dec..16ab2cc8058 100644--- a/litellm/proxy/common_utils/debug_utils.py+++ b/litellm/proxy/common_utils/debug_utils.py@@ -5,10 +5,12 @@ import osimport tracemallocfrom collections import Counter-from fastapi import APIRouter+from fastapi import APIRouter, Dependsfrom litellm import get_secret_strfrom litellm._logging import verbose_proxy_logger+from litellm.proxy._types import UserAPIKeyAuth+from litellm.proxy.auth.user_api_key_auth import user_api_key_authrouter = APIRouter()@@ -84,7 +86,9 @@ if os.environ.get("LITELLM_PROFILE", "false").lower() == "true":@router.get("/memory-usage-in-mem-cache", include_in_schema=False)-async def memory_usage_in_mem_cache():+async def memory_usage_in_mem_cache(+ _: UserAPIKeyAuth = Depends(user_api_key_auth),+):# returns the size of all in-memory caches on the proxy server"""1. user_api_key_cache@@ -121,7 +125,9 @@ async def memory_usage_in_mem_cache():@router.get("/memory-usage-in-mem-cache-items", include_in_schema=False)-async def memory_usage_in_mem_cache_items():+async def memory_usage_in_mem_cache_items(+ _: UserAPIKeyAuth = Depends(user_api_key_auth),+):# returns the size of all in-memory caches on the proxy server"""1. user_api_key_cache