Repository navigation
fix(proxy): never render credential-bearing config keys in the bug report - #42493
Conversation
…port Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
bugbot run |
|
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4fbceeb. Configure here.
| return key not in ENUM_KEYS_WITH_CREDENTIAL_PARTS and not CREDENTIAL_KEY_PARTS.isdisjoint(key.lower().split("_")) | ||
|
|
||
|
|
||
| def _render_json(key: str, value: JsonValue) -> str | None: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
redisended up in the issue URL and proxy logHow it solves it:
key_management_systemis the one such key that holds an enum, so it is exceptedUser Flow
Before: a proxy admin whose dev Redis password is
redisgets that password printed into the prefilled GitHub issue linklitellm_settings.cache_params.password: redisandrouter_settings.redis_password: simple-shufflehttps://github.com/BerriAI/litellm/issues/new?...linklitellm_settings.cache_params.password = redisandrouter_settings.redis_password = simple-shuffleAfter: the same link carries no credential fields at all
cache_params.type = localandrouting_strategy = simple-shufflebut nopasswordorredis_passwordlineRelevant issues
Follow-up to the Veria finding on #42428: #42428 (comment)
Affected release
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Screen recording of the run below, captured at tip 4fbceeb, is in the Slack thread: https://berriaillm.slack.com/archives/C0B302ZJU05/p1789865287481439
Two proxies, one worker each, same config, real OpenAI key. Base is
origin/mainat the merge base, head is this PR's tip. The config holds two secrets that collide with LiteLLM enum words, a custom callback that raises a bareKeyErrorfor thetrigger-bugalias so the proxy emits the bug report link, and the realgpt-4o-miniDecoding the last bug report link in a proxy log down to its Config block:
Before (c835a1a)
curl -s -o /dev/null -w "HTTP %{http_code}\n" -H "Authorization: Bearer $MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"trigger-bug","messages":[{"role":"user","content":"hi"}],"max_tokens":2}' http://127.0.0.1:18451/v1/chat/completionsHTTP 500, and the proxy log ends withThis looks like a bug in LiteLLM rather than in your request. File it with one click ... https://github.com/BerriAI/litellm/issues/new?template=bug_report.yml&...After (4fbceeb)
HTTP 500, same bug report line in the proxy logcurl -s -H "Authorization: Bearer $MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Say hello from the credential key demo"}],"max_tokens":20}' http://127.0.0.1:18452/v1/chat/completions | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['model'], repr(d['choices'][0]['message']['content']))"gpt-4o-mini 'Hello from the credential key demo! How can I assist you today?'Type
🐛 Bug Fix
Caveats (if any)
Low
Final Attestation
Note
Low Risk
Narrows what config is serialized into bug-report URLs and logs; behavior change is limited to redaction of credential-key strings with no impact on runtime proxy config.
Overview
Fixes a information disclosure path where proxy bug-report links could echo secrets when the secret string happened to match a LiteLLM-known enum value (e.g.
password: redis).safe_config_linesnow treats config keys whose underscore-separated parts match credential-like tokens (password,secret,token,url,host, etc.) as non-renderable for string values, even when the value is in the known-values allowlist.key_management_systemis explicitly allowed through so legitimate enum values likeaws_secret_managerstill appear. Rendering helpers_render/_render_jsontake the field name so this check applies across general settings, cache params, router settings, and guardrail params.A regression test sets every credential-shaped field to a known LiteLLM token and asserts those lines never appear in the output.
Reviewed by Cursor Bugbot for commit 4fbceeb. Bugbot is set up for automated code reviews on this repo. Configure here.
Link to Devin session: https://app.devin.ai/sessions/b7cc1b2b8d9d48a8b6a62d6b3a5e01bc
Open in Devin Desktop: https://app.devin.ai/desktop/session/b7cc1b2b8d9d48a8b6a62d6b3a5e01bc?variant=devin