litellm/tests/test_litellm/proxy
Darien Kindlund f54e4e664b
fix(proxy): use _hash_token_if_needed for cache invalidation in bulk update and key rotation (#25552)
Two code paths in key_management_endpoints.py call hash_token()
unconditionally when invalidating the user_api_key_cache after a key
update.  When the caller passes a pre-hashed token ID (not an sk-
prefixed key), hash_token() double-hashes it, producing a cache key
that does not match the actual cached entry.  Cache invalidation
silently fails.

This is compounded by update_cache() which writes the stale cached key
object back with a fresh 60s TTL after every successful request,
preventing natural TTL expiry.  The stale entry (with outdated fields
like max_budget=None) persists indefinitely under load.

PR #24969 fixed this in update_key_fn but missed two other call sites:
- _process_single_key_update (bulk update path)
- _execute_virtual_key_regeneration (key rotation path)

Fix: replace hash_token() with _hash_token_if_needed() in both
locations, matching the pattern already used elsewhere in the file.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 19:36:40 -07:00
..
_experimental/mcp_server fix(mcp): address Greptile review feedback 2026-04-08 19:42:41 +05:30
agent_endpoints test(a2a): assert create_a2a_client default timeout uses DEFAULT_A2A_AGENT_TIMEOUT 2026-04-10 21:18:15 +03:00
anthropic_endpoints Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
auth fix(auth): support selective jwt override oauth2 routing (#25252) 2026-04-07 13:52:47 -07:00
client
common_utils Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
db cherry-pick: tag query fix + MCP metadata support (#25145) 2026-04-04 16:44:02 -07:00
discovery_endpoints feat: add control plane for multi-proxy worker management 2026-03-19 22:50:19 -07:00
experimental/mcp_server
google_endpoints
guardrails fix(proxy): preserve dict guardrail HTTPException.detail + bedrock context (#25558) 2026-04-11 09:40:39 -07:00
health_endpoints
hooks Litellm ishaan april1 try2 (#25110) 2026-04-03 14:57:44 -07:00
image_endpoints
management_endpoints fix(proxy): use _hash_token_if_needed for cache invalidation in bulk update and key rotation (#25552) 2026-04-11 19:36:40 -07:00
management_helpers Merge branch 'main' into litellm_audit_log_s3_export 2026-03-20 16:39:54 -07:00
middleware [Fix] Fix test failures and Docker build from pinned dependency upgrade 2026-04-01 09:43:33 -07:00
openai_files_endpoint Refactor file content streaming handling to improve routing and support 2026-04-11 18:56:15 +00:00
pass_through_endpoints fix(proxy): pass-through multipart uploads and Bedrock custom body 2026-04-09 19:43:57 -07:00
policy_engine Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
prompts feat: add POST /team/permissions_bulk_update endpoint 2026-04-06 17:45:35 -07:00
public_endpoints feat(ui): expose Azure Entra ID credential fields in provider form 2026-04-04 11:19:45 -07:00
rag_endpoints
realtime_endpoints
response_api_endpoints
spend_tracking Merge pull request #25458 from BerriAI/litellm_team_members_logs 2026-04-11 13:55:00 -07:00
test_configs
ui_crud_endpoints
vector_store_endpoints
__init__.py
conftest.py remove conftest patch. TODO: make a different PR for this 2026-04-09 22:29:49 +00:00
test_aiohttp_cleanup_closed.py
test_aiohttp_session_recovery.py
test_api_key_masking_in_errors.py
test_audio_speech_prometheus_hooks.py
test_batch_expiry.py
test_batch_metadata_none_fix.py
test_caching_routes.py
test_chat_completion_metadata.py
test_common_request_processing.py fix(proxy): preserve dict guardrail HTTPException.detail + bedrock context (#25558) 2026-04-11 09:40:39 -07:00
test_custom_proxy.py
test_empty_model_list.py
test_enforce_user_param.py
test_fallback_management_endpoints.py
test_fastapi_offline_routes.py
test_health_check_functions.py Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
test_health_check_max_tokens.py
test_litellm_pre_call_utils.py feat(proxy): add credential overrides per team/project via model_config metadata (#24438) 2026-04-09 07:22:27 -07:00
test_max_budget_env_var.py Fix PR review issues: gpt-4-0314 prompt caching, case-insensitive data URL check, test I/O mocking 2026-03-21 11:30:29 -07:00
test_model_dump_with_preserved_fields.py
test_model_id_header_propagation.py
test_model_info_default_limits.py
test_model_level_guardrails.py
test_openapi_schema_validation.py
test_prometheus_cleanup.py
test_proxy_cli.py
test_proxy_server.py [Fix] Include access group models in UI model listing 2026-03-28 12:32:12 -07:00
test_proxy_types.py
test_proxy_utils.py fix(proxy): preserve dict guardrail HTTPException.detail + bedrock context (#25558) 2026-04-11 09:40:39 -07:00
test_pyroscope.py
test_response_model_sanitization.py fix: return winning model name instead of comma-separated list for fastest_response 2026-03-27 22:34:26 -07:00
test_route_a2a_models.py
test_route_llm_request.py
test_shared_health_check.py Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
test_spend_log_cleanup.py
test_swagger_chat_completions.py
test_team_member_update.py
test_tools_allowlist_enforcement.py
test_update_llm_router_resilience.py