8 views
-/https://github.com/berriai/litellm/issues/32369
GitHub ยท issue

#32369 [Bug]: _rotate_master_key skips callback_vars in verification tokens & teams โ€” decryption errors after master key rotation (LIT-1531)

  • State: open
  • Author: @krrish-berri-2
  • Labels: bug, proxy

## Bug: `_rotate_master_key` skips callback_vars in verification tokens & teams

### Summary

When a proxy admin rotates the master key via `POST /key/regenerate` with `new_master_key`, the `_rotate_master_key()` function in `litellm/proxy/management_endpoints/key_management_endpoints.py` re-encrypts:

1. โœ… `LiteLLM_ProxyModelTable` โ€” litellm_params (provider API keys) 2. โœ… `LiteLLM_Config` โ€” environment_variables 3. โœ… `LiteLLM_MCPServerTable` โ€” credentials 4. โœ… `LiteLLM_MCPUserCredentials` โ€” user-scoped BYOK/OAuth2 tokens 5. โœ… `LiteLLM_MCPUserEnvVars` โ€” per-user env vars 6. โœ… `LiteLLM_CredentialsTable` โ€” credential_values

But it does **NOT** re-encrypt:

7. โŒ `LiteLLM_VerificationToken.metadata` โ†’ `logging[*].callback_vars` (e.g. `LANGFUSE_SECRET_KEY`, `LANGSMITH_API_KEY`) 8. โŒ `LiteLLM_TeamTable.metadata` โ†’ `logging[*].callback_vars` and `callback_settings.callback_vars` 9. โŒ Config rows for `vantage_settings` / `cloudzero_settings` 10. โŒ SSO config table

After rotation, the proxy starts using the new master key for decryption but those values are still encrypted with the old key, producing the recurring error every 30 seconds:

``` Error decrypting value for key: api_key, Did โ€ฆ

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 ยท 31d18h1m11s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #2830
Issue 32369 is harder because it spans multiple persistence models, encryption formats, nested metadata, rotation semantics, backward compatibility, and broad regression testing. Issue 35590 is comparatively localized to adaptive-router state initialization and numerical validation, with a narrower code and test surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search