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(proxy): thread config_file_path through LiteLLM_JWTAuth.custom_validate
user9f9e21d463e1
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 6128f485748..3fdc4c35e03 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -4486,6 +4486,14 @@ class LiteLLM_JWTAuth(LiteLLMPydanticObjectBase):#########################################################def __init__(self, **kwargs: Any) -> None:+ # ``config_file_path`` is a non-field kwarg threaded by the+ # startup-load path so an operator-configured+ # ``custom_validate: s3://bucket/module.fn`` resolves through+ # the documented config-file flow. Pop before the invalid-keys+ # check; the runtime gate in ``get_instance_fn`` refuses+ # ``s3://`` / ``gcs://`` when this is None.+ config_file_path = kwargs.pop("config_file_path", None)+# get the attribute names for this Pydantic modelallowed_keys = LiteLLM_JWTAuth.__annotations__.keys()@@ -4499,7 +4507,7 @@ class LiteLLM_JWTAuth(LiteLLMPydanticObjectBase):custom_validate = kwargs.get("custom_validate")if custom_validate is not None:- fn = get_instance_fn(custom_validate)+ fn = get_instance_fn(custom_validate, config_file_path=config_file_path)validate_custom_validate_return_type(fn)kwargs["custom_validate"] = fndiff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex adfac4dffda..9c9c00d59c8 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -6774,7 +6774,15 @@ class ProxyStartupEvent:for k, v in general_settings["litellm_jwtauth"].items():if isinstance(v, str) and v.startswith("os.environ/"):general_settings["litellm_jwtauth"][k] = get_secret(v)- litellm_jwtauth = LiteLLM_JWTAuth(**general_settings["litellm_jwtauth"])+ # ``user_config_file_path`` is set by ``ProxyConfig._get_config_from_file``+ # during startup. Threading it through lets an operator-+ # configured ``custom_validate: s3://...`` resolve through+ # the runtime gate; admin-API JWT config writes (no config+ # file context) hit the gate and refuse remote loads.+ litellm_jwtauth = LiteLLM_JWTAuth(+ config_file_path=user_config_file_path,+ **general_settings["litellm_jwtauth"],+ )else:litellm_jwtauth = LiteLLM_JWTAuth()jwt_handler.update_environment(