litellm/tests/test_litellm/proxy/client
yucheng-berri 6a1d2b0c66
fix(proxy/client): redact api key from key/info client error messages (#31342)
* fix(proxy/client): redact api key from key/info client error messages

The keys management client builds GET /key/info?key=<key> and lets the
requests HTTPError propagate. str(HTTPError) renders the failing request URL
verbatim ("... for url: .../key/info?key=sk-..."), so any caller that logs the
exception leaks the full key; the 401 branch leaked the same way through
UnauthorizedError(str(orig_exception))

Redact both branches with the existing redact_secrets helper so the
secret-bearing query param is scrubbed to ?REDACTED while the status code,
reason, and response object are preserved. Server-side responses already mask
the key, so this closes the remaining client-side surface

* fix: preserve key info unauthorized response

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
(cherry picked from commit 71ee1a852a)
2026-06-29 18:00:11 -07:00
..
cli feat(cli): per-agent lite claude / codex / opencode commands that wrap coding agents through the proxy (#29850) 2026-06-10 13:52:26 -07:00
test_chat.py build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
test_client.py sys.path.insert for cli tests 2025-07-03 15:58:49 -07:00
test_credentials.py Change credential encryption to only affect db credentials 2025-12-09 13:36:40 -08:00
test_http_client.py fix delete callbacks 2025-11-06 17:06:34 -08:00
test_http_commands.py fix delete callbacks 2025-11-06 17:06:34 -08:00
test_keys.py fix(proxy/client): redact api key from key/info client error messages (#31342) 2026-06-29 18:00:11 -07:00
test_model_groups.py fix delete callbacks 2025-11-06 17:06:34 -08:00
test_models.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_users.py sys.path.insert for cli tests 2025-07-03 15:58:49 -07:00