diff --git a/litellm/llms/base_llm/auth/token_exchange.py b/litellm/llms/base_llm/auth/token_exchange.py index 6243a97a51a..a6567455490 100644 --- a/litellm/llms/base_llm/auth/token_exchange.py +++ b/litellm/llms/base_llm/auth/token_exchange.py @@ -170,14 +170,14 @@ def _shares_a_credential_run(rendered: str, compacted_secret: str) -> bool: """``unquote`` covers a credential sent form-encoded, without every caller enumerating that shape for itself: percent-escaping is reversible and applies to any field, query string included.""" - for candidate in (rendered, unquote(rendered)): - compacted: Final = _CREDENTIAL_CHARS.sub("", candidate) - if any( - compacted[start : start + _REFLECTION_MIN_RUN] in compacted_secret - for start in range(len(compacted) - _REFLECTION_MIN_RUN + 1) - ): - return True - return False + compacted_candidates: Final = tuple( + _CREDENTIAL_CHARS.sub("", candidate) for candidate in (rendered, unquote(rendered)) + ) + return any( + compacted[start : start + _REFLECTION_MIN_RUN] in compacted_secret + for compacted in compacted_candidates + for start in range(len(compacted) - _REFLECTION_MIN_RUN + 1) + ) def _redact_body_text(body_text: str) -> str: diff --git a/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py b/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py index 3ccb2632fb4..d84bb54eb1a 100644 --- a/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py +++ b/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py @@ -300,6 +300,8 @@ class TestAnthropicWifIdentitySourceKeys: "anthropic_keycloak_auth_method": "client_secret_basic", "anthropic_keycloak_client_secret_ref": "oidc/env/KC_SECRET", "anthropic_keycloak_scope": "anthropic-wif", + # Server-set when a client redirects api_base; carried here so it is not dropped in transit + "anthropic_disable_workload_identity_federation": True, } def test_new_keys_are_exactly_the_non_legacy_registered_set(self): diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 678c3e7ae99..aee0c26bd17 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -27463,6 +27463,8 @@ export interface components { allow_client_keepalive_override: boolean | null; /** Annotation Cost Per Page */ annotation_cost_per_page?: number | null; + /** Anthropic Disable Workload Identity Federation */ + anthropic_disable_workload_identity_federation?: boolean | null; /** Anthropic Federation Rule Id */ anthropic_federation_rule_id?: string | null; /** Anthropic Identity Source */ @@ -36781,6 +36783,8 @@ export interface components { allow_client_keepalive_override: boolean | null; /** Annotation Cost Per Page */ annotation_cost_per_page?: number | null; + /** Anthropic Disable Workload Identity Federation */ + anthropic_disable_workload_identity_federation?: boolean | null; /** Anthropic Federation Rule Id */ anthropic_federation_rule_id?: string | null; /** Anthropic Identity Source */