litellm/tests/test_litellm/secret_managers
Yassin Kortam f22eeb2ce0
fix(proxy): initialize the secret manager before resolving os.environ config references (#37544)
`ProxyConfig.get_config()` walked the parsed config and replaced every
`os.environ/<KEY>` string with `get_secret(value)` before anything initialized
the secret manager, so a key held only by the manager resolved to `None` and
that `None` was written back into the config. The later fallback in
`load_config` could not recover it, because the key now existed with a `None`
value.

Hoist the initialization into `get_config()`, ahead of the resolution pass, so
every entrypoint gets it: the CLI already did this itself, but the microservice
entrypoints (`gateway/main.py`, `backend/main.py`) uvicorn the app directly and
bypass the CLI. `load_config`'s own call is now redundant and is dropped, so
startup builds the manager once instead of building one and discarding it.

`get_config()` also runs on management-endpoint request paths, so this returns
early once a manager exists rather than rebuilding the client per request.

Also warn when a reference the manager would have been asked for resolves to
`None`. The reporter had no log line at all to work from. `get_secret` only
reaches the manager when reads are enabled and the name is in `hosted_keys`, so
`secret_manager_would_be_consulted` mirrors that gate and keeps the warning off
env-only references, which are expected rather than an error.
2026-08-19 17:00:26 -07:00
..
test_aws_secret_manager_replication.py chore: litellm oss staging160626 (#30527) 2026-06-16 18:23:13 -07:00
test_aws_secret_manager_rotation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_aws_secret_manager_v2.py fix(tests): isolate flaky files endpoint tests from global proxy state (#21788) 2026-02-21 11:20:32 -08:00
test_base_secret_manager.py fix(proxy): harden secret name validation for external secret manager integrations (LIT-4201) (#32092) 2026-07-08 10:36:00 -07:00
test_custom_secret_manager.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_get_azure_ad_token_provider.py test(test_get_azure_ad_token_provider.py): add unit test to ensure default azure credentials used in the right context 2025-09-11 16:07:32 -07:00
test_secret_managers_main.py fix(proxy): initialize the secret manager before resolving os.environ config references (#37544) 2026-08-19 17:00:26 -07:00