mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Potential fix for code scanning alert no. 3413: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
61a450f2e2
commit
3dac7e28fc
1 changed files with 5 additions and 1 deletions
|
|
@ -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}"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue