litellm/tests/test_litellm/proxy/management_endpoints
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
..
policy_endpoints
scim [Feature] UI - Default Team Settings: Modernize page and fix defaults application 2026-03-14 00:01:25 -07:00
search_endpoints
usage_endpoints
test_access_group_endpoints.py
test_access_group_management.py
test_budget_endpoints.py
test_cache_settings_endpoints.py
test_callback_management_endpoints.py
test_common_daily_activity.py Revert "fix(proxy): restore per-entity breakdown in aggregated daily activity endpoint" 2026-03-21 21:37:29 -07:00
test_common_utils.py
test_compliance_endpoints.py
test_config_override_endpoints.py
test_cost_tracking_settings.py
test_customer_budget.py
test_customer_endpoints.py
test_delete_callbacks_endpoint.py
test_delete_verification_tokens_failed.py
test_entraid_app_roles.py
test_internal_user_endpoints.py fix(proxy): sanitize user_id input and block dangerous env var keys 2026-03-27 20:38:36 +05:30
test_key_management_endpoints.py 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
test_mcp_management_endpoints.py Ishaan - March 18th changes (#24056) 2026-03-19 10:20:35 -07:00
test_model_management_endpoints.py test: add unit tests for _get_team_deployments filtering logic 2026-04-04 14:34:39 -07:00
test_org_admin_team_access.py
test_organization_endpoints.py
test_policy_endpoints.py
test_router_settings_endpoints.py
test_tag_management_endpoints.py [Fix] Fix tag/list 500 error from invalid Prisma group_by kwargs 2026-03-13 21:38:20 -07:00
test_team_default_params.py feat: add POST /team/permissions_bulk_update endpoint 2026-04-06 17:45:35 -07:00
test_team_endpoints.py [Fix] Address Greptile review: POST /organization/info auth bypass, inline imports, team access denial tests 2026-04-11 12:40:55 -07:00
test_tool_management_endpoints.py
test_ui_sso.py fix(sso): pass decoded JWT access token to role mapping during SSO login 2026-03-27 13:50:30 -07:00