refactor: type the MCP credentials validators and drop stray whitespace (LIT-8429)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-24 09:24:27 +00:00
parent 19675c0f5c
commit a7c83a14e2
3 changed files with 4 additions and 4 deletions

View file

@ -1586,7 +1586,7 @@ class NewMCPServerRequest(LiteLLMPydanticObjectBase):
@field_validator("credentials")
@classmethod
def check_client_assertion_signing_alg(cls, credentials):
def check_client_assertion_signing_alg(cls, credentials: MCPCredentials | None) -> MCPCredentials | None:
return _validated_client_assertion_signing_alg(credentials)
@model_validator(mode="before")
@ -1690,7 +1690,7 @@ class UpdateMCPServerRequest(LiteLLMPydanticObjectBase):
@field_validator("credentials")
@classmethod
def check_client_assertion_signing_alg(cls, credentials):
def check_client_assertion_signing_alg(cls, credentials: MCPCredentials | None) -> MCPCredentials | None:
return _validated_client_assertion_signing_alg(credentials)
@model_validator(mode="before")

View file

@ -20,7 +20,8 @@ def allowed_jwt_algorithms(fips_mode: bool) -> tuple[str, ...]:
def jwks_keys_for(
keys: Sequence[Mapping[str, object]], algorithms: Collection[str]
) -> tuple[Mapping[str, object], ...]:
"""Keep keys whose declared alg is allowed; keys without alg are kept only when their kty can sign with an allowed algorithm."""
"""Keep keys whose declared alg is allowed; keys without alg are kept only when their kty can sign with an
allowed algorithm."""
return tuple(key for key in keys if _key_allowed(key, frozenset(algorithms)))

View file

@ -85,4 +85,3 @@ async def test_the_hook_drops_the_slot_only_once_the_origin_changes() -> None:
foreign = httpx.Request("GET", "https://attacker.example.com/x", headers={"esb-oauth": "Bearer x"})
await hook(foreign)
assert "esb-oauth" not in foreign.headers