litellm/tests/integration/security
Mateo Wang 961fabbb76
feat(secret_managers): resolve oidc/google api_key references per request (#47703)
* test(secret_managers): cover oidc/google api_key references resolved per request

Unit tests send a metadata server ID token for an admin oidc/google/<audience> api_key, reuse it within its
lifetime, refresh it before it expires, fetch it off the event loop, fail closed with a 401 that names only the
kind, and honor GCE_METADATA_HOST. The integration file scripts a metadata server and checks the bearer the
upstream receives for config, stored credential and DB credential sources, plus a metadata failure

* feat(secret_managers): resolve oidc/google api_key references per request

An admin-set oidc/google/<audience> api_key now resolves on each call to the GCE metadata server's ID token for that audience, cached until a minute before it expires. Async callers fetch on a cache miss in a worker thread, so the event loop never waits on the metadata server. A failed fetch answers 401 naming only the kind, and GCE_METADATA_HOST points the fetch at another metadata server.

* fix(oidc): bound the Google metadata fetch and answer 503 when it fails

A Google OIDC api_key fetch now waits at most GCE_METADATA_TIMEOUT seconds
(default 3), runs on its own thread pool instead of the loop's default
executor, and sends the token read from the cache at call start even if it
expires mid-call. A metadata timeout, network error, or 5xx answers a
retryable 503, while a 4xx or empty token stays a 401. The expiry and
empty-token warnings log the secret name on one line.

* test(oidc): expect 503 when the metadata server answers 5xx in the integration test

* fix(oidc): answer 503 on token-count routes during a metadata outage and fall back on a bad GCE_METADATA_TIMEOUT

* fix(secret_managers): keep get_secret's metadata wait, share concurrent google token fetches, refuse oidc/google on pass-through

A model's api_key fetch keeps the 3 second GCE_METADATA_TIMEOUT wait while get_secret callers keep the handler default. Any metadata transport error answers a retryable 503. Async cache misses for one reference share one fetch, and a call the reference may not go to is refused before any fetch. Pass-through routes answer 401 for an oidc/google credential instead of sending the reference text. The metadata client is closed after each fetch, and the unused sync resolver is removed.

* fix(utils): refuse an oidc/google api_key on pass-through calls before any fetch

A router-model or credential-name pass-through call with an oidc/google
reference now fails before the metadata fetch and sends nothing upstream,
since the pass-through config never sends the resolved key. The
single-flight test also waits on the fetch-start signal with a bounded
window instead of a fixed sleep.
2026-10-29 08:44:46 -07:00
..
_callback_traffic.py test(integration): callback credential canary slots C1-C3 and D5 (#43630) 2026-09-29 10:49:30 -07:00
_canary.py test(integration): sweep proxy logs, metrics, a Datadog intake and the Logs drawer for credential canaries (#43306) 2026-09-29 17:57:28 +00:00
_sinks.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
_sweeps.py perf(ci): isolate and shard integration suites (#44146) 2026-10-10 11:15:19 -07:00
test_air_gapped_boot.py test: migrate local_testing SDK and provider tests out of build_and_test (#45760) 2026-10-10 23:14:25 +00:00
test_api_key_secret_reference.py feat(secret_managers): resolve oidc/google api_key references per request (#47703) 2026-10-29 08:44:46 -07:00
test_callback_credentials.py test(integration): callback credential canary slots C1-C3 and D5 (#43630) 2026-09-29 10:49:30 -07:00
test_config_deployment_key.py
test_config_overrides.py test(integration): cover config_utils endpoint contracts (#44737) 2026-10-14 07:00:23 +00:00
test_container_ownership.py test(integration): cover videos_containers endpoint contracts (#44691) 2026-10-14 03:49:01 +00:00
test_datadog_sink.py test(integration): sweep proxy logs, metrics, a Datadog intake and the Logs drawer for credential canaries (#43306) 2026-09-29 17:57:28 +00:00
test_files_batches_access.py test(files): audit #40621 (#48788) 2026-10-28 04:13:03 -07:00
test_fine_tuning_managed_ids.py fix(managed_files): send provider file ids when creating a fine-tuning job from managed files (#46552) 2026-10-19 14:40:15 -07:00
test_hide_secrets_tool_compatibility.py fix(guardrails)!: redact secrets in tool traffic and system prompts (#47122) 2026-10-27 18:11:03 -07:00
test_hide_secrets_tool_traffic.py fix(guardrails)!: make hide-secrets honor skip_tool_message_in_guardrail (#48689) 2026-10-28 14:49:48 -07:00
test_managed_file_listing.py fix(files)!: scope provider and model file lists to the caller's managed files under require_managed_files (#47682) 2026-10-28 13:42:22 -07:00
test_master_key_not_in_db.py test: migrate proxy security, schema migration and MCP legacy tests (#45937) 2026-10-11 16:17:24 -07:00
test_mcp_slots.py
test_metrics_text.py test(integration): sweep proxy logs, metrics, a Datadog intake and the Logs drawer for credential canaries (#43306) 2026-09-29 17:57:28 +00:00
test_offline_mode.py feat(proxy): add LITELLM_OFFLINE_MODE, one switch for the fetches LiteLLM makes on its own (#48096) 2026-10-23 16:54:19 -07:00
test_passthrough_slots.py test: move routing, caching and callback tests out of local_testing (#45761) 2026-10-10 09:33:09 -07:00
test_proxy_logs.py test(integration): sweep proxy logs, metrics, a Datadog intake and the Logs drawer for credential canaries (#43306) 2026-09-29 17:57:28 +00:00
test_request_path_slots.py test(integration): request-path credential canary slots D1-D4 (#43307) 2026-09-29 10:52:13 -07:00
test_stored_config_slots.py test(integration): cover guardrails_policies endpoint contracts (#44722) 2026-10-14 04:07:26 +00:00
test_sweep_sensitivity.py feat(ui): source Home What's new from day 0 support blog posts (#46260) 2026-10-13 13:11:59 -07:00