Skip to content

Conversation

@krrishdholakia
Copy link
Contributor

Title

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on (make test-unit)[https://docs.litellm.ai/docs/extras/contributing_code]
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

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

Changes

@vercel
Copy link

vercel bot commented Mar 15, 2025

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 Mar 16, 2025 3:45am

### LOAD CONFIG ###
worker_config: Optional[Union[str, dict]] = get_secret("WORKER_CONFIG") # type: ignore
env_config_yaml: Optional[str] = get_secret_str("CONFIG_FILE_PATH")
verbose_proxy_logger.debug("worker_config: %s", worker_config)

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.

Copilot Autofix

AI 10 months ago

To fix the problem, we should avoid logging sensitive information directly. Instead, we can log a message indicating that the configuration was loaded without revealing its contents. This way, we maintain the functionality of logging important events without exposing sensitive data.

  • Replace the line that logs worker_config with a more generic log message.
  • Ensure that no sensitive information is logged in clear text.
Suggested changeset 1
litellm/proxy/proxy_server.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/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -516,3 +516,3 @@
         env_config_yaml: Optional[str] = get_secret_str("CONFIG_FILE_PATH")
-        verbose_proxy_logger.debug("worker_config: %s", worker_config)
+        verbose_proxy_logger.debug("worker_config loaded successfully")
         # check if it's a valid file path
EOF
@@ -516,3 +516,3 @@
env_config_yaml: Optional[str] = get_secret_str("CONFIG_FILE_PATH")
verbose_proxy_logger.debug("worker_config: %s", worker_config)
verbose_proxy_logger.debug("worker_config loaded successfully")
# check if it's a valid file path
Copilot is powered by AI and may make mistakes. Always verify output.
if isinstance(worker_config, dict):
await initialize(**worker_config)
# Register signal handlers
signal.signal(signal.SIGTERM, handle_shutdown)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how this approach works w/ uvicorn and gunicorn's way of handling graceful timeouts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a different signal they issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like both gunicorn and uvicorn issue a SIGTERM, so this should still work

verbose_proxy_logger.info(
f"Graceful shutdown initiated. Waiting up to {shutdown_timeout}s for requests to complete..."
)
await asyncio.sleep(shutdown_timeout)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we condition this on minimum of [all server connections terminating, shutdown_timeout]? From my understanding, this logic will result in all instances taking the full shutdown_timeout which is not as ideal

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants