Repository navigation
fix(proxy): sanitize unexpected database errors from /key/info - #46190
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@krrish-berri-2 Thanks for reviewing and merging this PR! I appreciate your time and the opportunity to contribute to LiteLLM. |
TL;DR
Unexpected database errors in /key/info may expose raw database-driver details in HTTP 500 responses.
This change returns a generic error response for unexpected internal failures and logs the full exception server-side for debugging.
What changed
Sanitize unexpected exceptions in the /key/info handler.
Log the full exception traceback server-side.
Add regression tests to prevent database exception details from leaking into responses.
Preserve expected 403 Forbidden and 404 Not Found behavior.
Relevant issues
Addresses the /key/info exception-leakage failure path described in #46076.
Complements #46175: this change handles unexpected exceptions in /key/info beyond the specific null-byte validation path.
Testing
Six /key/info tests passed.
The regression test fails against unmodified upstream/main, reproducing the database exception leak.
The regression test passes with this fix restored.
Verified that the client receives a generic error while the full exception is captured in server-side logs.
Type
Bug fix