Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiteLLM Minor Fixes & Improvements (10/23/2024) #6407

Merged
merged 13 commits into from
Oct 25, 2024

Conversation

krrishdholakia
Copy link
Contributor

@krrishdholakia krrishdholakia commented Oct 23, 2024

Title

Relevant issues

Fixes #6387

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

[REQUIRED] Testing - Attach a screenshot of any new tests passing locall

If UI changes, send a screenshot/GIF of working UI fixes

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 0:43am

… routes (model_name: custom_route/* -> openai/*)

Enables user to expose custom routes to users with dynamic handling
@krrishdholakia krrishdholakia changed the title docs(bedrock.md): clarify bedrock auth in litellm docs LiteLLM Minor Fixes & Improvements (10/23/2024) Oct 24, 2024
krrishdholakia and others added 5 commits October 24, 2024 17:43
)

* unit testig for prometheus

* unit testing for success metrics

* use 1 helper for _increment_token_metrics

* use helper for _increment_remaining_budget_metrics

* use _increment_remaining_budget_metrics

* use _increment_top_level_request_and_spend_metrics

* use helper for _set_latency_metrics

* remove noqa violation

* fix test prometheus

* test prometheus

* unit testing for all prometheus helper functions

* fix prom unit tests

* fix unit tests prometheus

* fix unit test prom
* use InitalizeOpenAISDKClient

* use InitalizeOpenAISDKClient static method

* fix  # noqa: PLR0915
…litedebugger, berrispend (#6406)

* code cleanup remove unused and undocumented code files

* fix unused logging integrations cleanup
"AZURE_API_VERSION", litellm.AZURE_DEFAULT_API_VERSION
)

if "gateway.ai.cloudflare.com" in api_base:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

The string
gateway.ai.cloudflare.com
may be at an arbitrary position in the sanitized URL.

Copilot Autofix AI 14 days ago

To fix the problem, we need to parse the URL and check the host value instead of using a substring match. This ensures that the check is performed on the actual host part of the URL, preventing bypasses through crafted URLs.

  • Use the urlparse function from the urllib.parse module to parse the URL.
  • Extract the hostname from the parsed URL and check if it matches the intended domain.
  • Replace the substring check with this more robust method.
Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -239,3 +239,4 @@
 
-                if "gateway.ai.cloudflare.com" in api_base:
+                parsed_url = urlparse(api_base)
+                if parsed_url.hostname == "gateway.ai.cloudflare.com":
                     if not api_base.endswith("/"):
EOF
@@ -239,3 +239,4 @@

if "gateway.ai.cloudflare.com" in api_base:
parsed_url = urlparse(api_base)
if parsed_url.hostname == "gateway.ai.cloudflare.com":
if not api_base.endswith("/"):
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
# only show first 5 chars of api_key
_api_key = _api_key[:8] + "*" * 15
verbose_router_logger.debug(
f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}, Api Key:{_api_key}"

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression

Copilot Autofix AI 14 days ago

To fix the problem, we should avoid logging the api_key entirely. Instead, we can log a message indicating that the client is being initialized without including the sensitive api_key. This ensures that no sensitive information is exposed in the logs.

Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -342,8 +342,4 @@
                 else:
-                    _api_key = api_key
-                    if _api_key is not None and isinstance(_api_key, str):
-                        # only show first 5 chars of api_key
-                        _api_key = _api_key[:8] + "*" * 15
                     verbose_router_logger.debug(
-                        f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}, Api Key:{_api_key}"
+                        f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}"
                     )
EOF
@@ -342,8 +342,4 @@
else:
_api_key = api_key
if _api_key is not None and isinstance(_api_key, str):
# only show first 5 chars of api_key
_api_key = _api_key[:8] + "*" * 15
verbose_router_logger.debug(
f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}, Api Key:{_api_key}"
f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}"
)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
if _api_key is not None and isinstance(_api_key, str):
# only show first 5 chars of api_key
_api_key = _api_key[:8] + "*" * 15
verbose_router_logger.debug(
f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}, Api Key:{_api_key}"
f"Initializing OpenAI Client for {model_name}, Api Base:{str(api_base)}, Api Key:{_api_key}"

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression

Copilot Autofix AI 14 days ago

To fix the problem, we should avoid logging the api_key entirely. Instead, we can log a generic message indicating that the client is being initialized without including sensitive information. This ensures that no part of the sensitive data is exposed in the logs.

Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -454,8 +454,4 @@
             else:
-                _api_key = api_key  # type: ignore
-                if _api_key is not None and isinstance(_api_key, str):
-                    # only show first 5 chars of api_key
-                    _api_key = _api_key[:8] + "*" * 15
                 verbose_router_logger.debug(
-                    f"Initializing OpenAI Client for {model_name}, Api Base:{str(api_base)}, Api Key:{_api_key}"
+                    f"Initializing OpenAI Client for {model_name}, Api Base:{str(api_base)}"
                 )
EOF
@@ -454,8 +454,4 @@
else:
_api_key = api_key # type: ignore
if _api_key is not None and isinstance(_api_key, str):
# only show first 5 chars of api_key
_api_key = _api_key[:8] + "*" * 15
verbose_router_logger.debug(
f"Initializing OpenAI Client for {model_name}, Api Base:{str(api_base)}, Api Key:{_api_key}"
f"Initializing OpenAI Client for {model_name}, Api Base:{str(api_base)}"
)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
credential = ClientSecretCredential(_tenant_id, _client_id, _client_secret)
verbose_router_logger.debug(
"tenant_id %s, client_id %s, client_secret %s",
_tenant_id,

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.

Copilot Autofix AI 14 days ago

To fix the problem, we should avoid logging sensitive information such as tenant_id, client_id, and client_secret. Instead, we can log non-sensitive information or use placeholders to indicate that the values are present without revealing them. This ensures that sensitive data is not exposed in the logs.

  1. Identify the lines where sensitive data is being logged.
  2. Replace the logging of sensitive data with a more secure message that does not include the actual values.
  3. Ensure that the changes do not affect the existing functionality of the code.
Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -581,6 +581,3 @@
         verbose_router_logger.debug(
-            "tenant_id %s, client_id %s, client_secret %s",
-            _tenant_id,
-            _client_id,
-            _client_secret,
+            "tenant_id [REDACTED], client_id [REDACTED], client_secret [REDACTED]"
         )
@@ -590,3 +587,3 @@
 
-        verbose_router_logger.debug("credential %s", credential)
+        verbose_router_logger.debug("credential obtained successfully")
 
@@ -596,3 +593,3 @@
 
-        verbose_router_logger.debug("token_provider %s", token_provider)
+        verbose_router_logger.debug("token_provider initialized successfully")
 
EOF
@@ -581,6 +581,3 @@
verbose_router_logger.debug(
"tenant_id %s, client_id %s, client_secret %s",
_tenant_id,
_client_id,
_client_secret,
"tenant_id [REDACTED], client_id [REDACTED], client_secret [REDACTED]"
)
@@ -590,3 +587,3 @@

verbose_router_logger.debug("credential %s", credential)
verbose_router_logger.debug("credential obtained successfully")

@@ -596,3 +593,3 @@

verbose_router_logger.debug("token_provider %s", token_provider)
verbose_router_logger.debug("token_provider initialized successfully")

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
verbose_router_logger.debug(
"tenant_id %s, client_id %s, client_secret %s",
_tenant_id,
_client_id,

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.

Copilot Autofix AI 14 days ago

To fix the problem, we should avoid logging sensitive information directly. Instead, we can log non-sensitive metadata or masked versions of the sensitive data. This ensures that the logs remain useful for debugging purposes without exposing sensitive information.

  • Replace the logging of tenant_id, client_id, and client_secret with a masked version or remove it entirely.
  • Ensure that the credential and token_provider objects are logged in a way that does not expose sensitive information.
Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -582,5 +582,5 @@
             "tenant_id %s, client_id %s, client_secret %s",
-            _tenant_id,
-            _client_id,
-            _client_secret,
+            _tenant_id[:4] + '****',
+            _client_id[:4] + '****',
+            '****'  # Do not log any part of the client_secret
         )
@@ -590,3 +590,3 @@
 
-        verbose_router_logger.debug("credential %s", credential)
+        verbose_router_logger.debug("credential obtained successfully")
 
@@ -596,3 +596,3 @@
 
-        verbose_router_logger.debug("token_provider %s", token_provider)
+        verbose_router_logger.debug("token_provider initialized successfully")
 
EOF
@@ -582,5 +582,5 @@
"tenant_id %s, client_id %s, client_secret %s",
_tenant_id,
_client_id,
_client_secret,
_tenant_id[:4] + '****',
_client_id[:4] + '****',
'****' # Do not log any part of the client_secret
)
@@ -590,3 +590,3 @@

verbose_router_logger.debug("credential %s", credential)
verbose_router_logger.debug("credential obtained successfully")

@@ -596,3 +596,3 @@

verbose_router_logger.debug("token_provider %s", token_provider)
verbose_router_logger.debug("token_provider initialized successfully")

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
"tenant_id %s, client_id %s, client_secret %s",
_tenant_id,
_client_id,
_client_secret,

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.
This expression logs
sensitive data (secret)
as clear text.

Copilot Autofix AI 14 days ago

To fix the problem, we need to ensure that sensitive information such as client_secret is not logged. Instead of logging the actual values, we can log a placeholder or mask the sensitive parts of the data. This way, we maintain the ability to debug without exposing sensitive information.

  • Replace the logging of tenant_id, client_id, and client_secret with masked versions of these values.
  • Ensure that the changes are made in the get_azure_ad_token_from_entrata_id method where the sensitive data is being logged.
Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -584,3 +584,3 @@
             _client_id,
-            _client_secret,
+            "****" if _client_secret else None,
         )
EOF
@@ -584,3 +584,3 @@
_client_id,
_client_secret,
"****" if _client_secret else None,
)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

verbose_router_logger.debug("credential %s", credential)
verbose_router_logger.debug("credential %s", credential)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.

Copilot Autofix AI 14 days ago

To fix the problem, we should avoid logging sensitive information directly. Instead of logging the entire credential object, we can log a message indicating the successful creation of the credential without including the sensitive details. This way, we maintain the logging functionality for debugging purposes without exposing sensitive data.

Suggested changeset 1
litellm/router_utils/client_initalization_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py
--- a/litellm/router_utils/client_initalization_utils.py
+++ b/litellm/router_utils/client_initalization_utils.py
@@ -590,3 +590,3 @@
 
-        verbose_router_logger.debug("credential %s", credential)
+        verbose_router_logger.debug("Azure AD Token credential created successfully")
 
EOF
@@ -590,3 +590,3 @@

verbose_router_logger.debug("credential %s", credential)
verbose_router_logger.debug("Azure AD Token credential created successfully")

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 87.75510% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
litellm/router_utils/client_initalization_utils.py 83.92% 27 Missing ⚠️
...ils/llm_response_utils/convert_dict_to_response.py 83.33% 2 Missing ⚠️
litellm/router_utils/pattern_match_deployments.py 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@krrishdholakia krrishdholakia merged commit 1cd1d23 into main Oct 25, 2024
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Pydantic serializer warning when following image generation example
2 participants