Skip to content

fix(proxy): sanitize unexpected database errors from /key/info - #46190

Merged
krrish-berri-2 merged 1 commit into
BerriAI:mainfrom
vanrajsinh650:litellm_sanitize_db_exceptions
Oct 19, 2026
Merged

krrish-berri-2 merged 1 commit into
BerriAI:mainfrom
vanrajsinh650:litellm_sanitize_db_exceptions

Conversation

@vanrajsinh650

Copy link
Copy Markdown
Contributor

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-13T10:09:25.907716Z 3389182 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@CLAassistant

CLAassistant commented Oct 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codspeed

codspeed Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks


Comparing vanrajsinh650:litellm_sanitize_db_exceptions (3389182) with main (7700508)

Open in CodSpeed

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@krrish-berri-2
krrish-berri-2 merged commit 8b90649 into BerriAI:main Oct 19, 2026
88 checks passed
@vanrajsinh650

Copy link
Copy Markdown
Contributor Author

@krrish-berri-2 Thanks for reviewing and merging this PR! I appreciate your time and the opportunity to contribute to LiteLLM.

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.

3 participants