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: restrict x-pass- header forwarding for protected header names
Yuneng Jiangf46e9959db59
diff --git a/litellm/passthrough/utils.py b/litellm/passthrough/utils.pyindex ef4357d1ca2..8ae32d37a93 100644--- a/litellm/passthrough/utils.py+++ b/litellm/passthrough/utils.py@@ -56,11 +56,15 @@ class BasePassthroughUtils:# Combine request headers with custom headersheaders = {**request_headers, **headers}- # Always process x-pass- prefixed headers (strip prefix and forward)+ # Process x-pass- prefixed headers (strip prefix and forward)+ # Certain protocol-level and credential headers are excluded from this mechanism.+ _PROTECTED_HEADERS = {"authorization", "api-key", "host", "content-length"}for header_name, header_value in request_headers.items():if header_name.lower().startswith(PASS_THROUGH_HEADER_PREFIX):# Strip the 'x-pass-' prefix to get the actual header nameactual_header_name = header_name[len(PASS_THROUGH_HEADER_PREFIX) :]+ if actual_header_name.lower() in _PROTECTED_HEADERS:+ continueheaders[actual_header_name] = header_valuereturn headers