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(health): strip client_secret, azure_ad_token, and other credential fields from /health output
mateo-berri50f69a3a818d
diff --git a/litellm/proxy/health_check.py b/litellm/proxy/health_check.pyindex 9d68f5d0c6a..44e3409b0a1 100644--- a/litellm/proxy/health_check.py+++ b/litellm/proxy/health_check.py@@ -25,10 +25,16 @@ ILLEGAL_DISPLAY_PARAMS: Final = ["api_key","prompt","input",+ "client_secret",+ "azure_ad_token",+ "azure_username",+ "azure_password","vertex_credentials",+ "vertex_ai_credentials","aws_access_key_id","aws_secret_access_key","aws_session_token",+ "aws_web_identity_token","extra_headers","headers","exception", # internal; not JSON-serializable, never for displaydiff --git a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.pyindex 255cea9ebf5..49815d6acde 100644--- a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py+++ b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py@@ -2441,10 +2441,49 @@ def test_clean_endpoint_data_strips_extra_headers_and_aws_session_token():assert "extra_headers" not in cleanedassert "headers" not in cleanedassert "aws_session_token" not in cleaned- # routing/admin field still presentassert cleaned.get("api_base") == "https://example.test/v1"+ "credential_field",+ [+ "api_key",+ "client_secret",+ "azure_ad_token",+ "azure_username",+ "azure_password",+ "aws_access_key_id",+ "aws_secret_access_key",+ "aws_session_token",+ "aws_web_identity_token",+ "vertex_credentials",+ "vertex_ai_credentials",+ "extra_headers",+ "headers",+ ],+)[email protected]("details", [True, False, None])+def test_clean_endpoint_data_never_displays_credential_fields(credential_field, details):+ """+ LIT-6239 / gh-36898: /health entries, healthy and unhealthy alike, must never+ carry credential-bearing litellm_params, with or without details.+ """+ from litellm.proxy.health_check import _clean_endpoint_data++ canary = f"CANARY-{credential_field}-VALUE"+ cleaned = _clean_endpoint_data(+ {+ "model": "azure/gpt-5-mini",+ "api_base": "https://example.test/v1",+ credential_field: canary,+ },+ details=details,+ )++ assert credential_field not in cleaned+ assert canary not in str(cleaned)++class TestConfigBaseForHealthCheck:"""A request that sets its own connection fields gets a base without theconfiguration's credentials; anything it leaves unset still comes from