Skip to content

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]

Potential fix for code scanning alert no. 3413: Clear-text logging of sensitive information

Sameer Kankute3dac7e28fc17
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 ee3aecd0bfc..f8eb98affcf 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}"
)