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): drop a stored-credential reference along with the credentials it names
Yuneng Jiang298fb8ce5609
diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.pyindex 2a2ab8f6de2..52b7faeac07 100644--- a/litellm/proxy/health_endpoints/_health_endpoints.py+++ b/litellm/proxy/health_endpoints/_health_endpoints.py@@ -88,7 +88,11 @@ def _reject_os_environ_references(params: dict) -> None:_CONFIG_CONNECTION_FIELDS: Final[frozenset[str]] = frozenset(- (*_ADMIN_CONFIG_FIELDS_TO_CLEAR_ON_BASE_OVERRIDE, *clientside_credential_keys)+ (+ *_ADMIN_CONFIG_FIELDS_TO_CLEAR_ON_BASE_OVERRIDE,+ *clientside_credential_keys,+ "litellm_credential_name",+ ))@@ -105,6 +109,11 @@ def _config_base_for_health_check(still comes from the configuration, which is what lets a request name aconfigured model and test it as configured.+ ``litellm_credential_name`` is dropped alongside the literal credential+ fields: it names a stored credential that ``load_credentials_from_list``+ resolves into the same secrets further down the call, so leaving it in place+ would reintroduce them by reference.+``general_settings.allow_client_side_credentials`` is the existing proxy-wideopt-in for callers supplying their own connection parameters. Where an adminhas enabled it, a request may pair its own endpoint with the configureddiff --git a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.pyindex cef2e643194..f74aafd9df1 100644--- a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py+++ b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py@@ -2438,3 +2438,22 @@ class TestConfigBaseForHealthCheck:allow_client_side_credentials=True,)assert base["api_key"] == "sk-configured"++ def test_stored_credential_reference_is_dropped_with_the_credentials(self):+ """A stored-credential name resolves to the same secrets downstream, so a+ request that redirects the destination must not keep it either."""+ config = {**self.CONFIG, "litellm_credential_name": "OpenAI-prod"}+ base = self._base(config, {"api_base": "https://caller.example/v1"})+ assert "litellm_credential_name" not in base+ assert "api_key" not in base++ def test_stored_credential_reference_kept_when_request_sets_no_connection(self):+ """The Admin UI tests a configured model by naming it plus its stored+ credential and nothing else; that keeps working."""+ config = {**self.CONFIG, "litellm_credential_name": "OpenAI-prod"}+ base = self._base(+ config,+ {"model": "openai/gpt-4o", "litellm_credential_name": "OpenAI-prod", "custom_llm_provider": "openai"},+ )+ assert base["litellm_credential_name"] == "OpenAI-prod"+ assert base["api_key"] == "sk-configured"