mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
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:
parent
19675c0f5c
commit
a7c83a14e2
3 changed files with 4 additions and 4 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue