diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py index ee3aecd0bf..f8eb98affc 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py @@ -372,9 +372,13 @@ class VertexAILivePassthroughLoggingHandler(BasePassthroughLoggingHandler): kwargs["model"] = model kwargs["custom_llm_provider"] = custom_llm_provider + # Safely log the model name: only allow known safe formats, redact otherwise. + import re + allowed_pattern = re.compile(r"^[A-Za-z0-9._\-:]+$") + safe_model = model if isinstance(model, str) and allowed_pattern.match(model) else "[REDACTED]" verbose_proxy_logger.debug( f"Vertex AI Live API passthrough cost tracking - " - f"Model: {model}, Cost: ${response_cost:.6f}, " + f"Model: {safe_model}, Cost: ${response_cost:.6f}, " f"Prompt tokens: {usage.prompt_tokens}, " f"Completion tokens: {usage.completion_tokens}" )