Repository navigation
fix(auth): fips-aware JWT algorithm allowlists for proxy auth and MCP - #42929
devin-ai-integration[bot] wants to merge 38 commits into
Conversation
…TLS verify guard and loud password migration Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…l semantics Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… return checks Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…and covers markers Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…y instead of patching _setup_prisma_client Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…into litellm_fips_jwt_algorithm_allowlists
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… (LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… JWT algorithms (LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…IT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… keep stored rows readable (LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ce (LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
bugbot run |
|
@greptileai please review the current head a7c83a1. The proxy_server.py finding is B0 code from #42700 merged into this branch, see the thread reply |
…LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…WKS pause cell (LIT-8429) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Addressed both litereview findings in c0077c9: (1) the JWKS drop warning is now deduplicated per key via lru_cache and silent for use=enc encryption keys (Keycloak RSA-OAEP no longer spams); (2) the stored EdDSA client_assertion fallback warning now states the Ed25519 key cannot sign RS256 and the key must be rotated, instead of implying the fallback works. @litereview full |
|
bugbot run |
|
@litereview full |
Review already requestedfull is already reviewing |
| ) | ||
|
|
||
|
|
||
| def _stored_client_assertion_signing_alg(value: object, server_name: str) -> ApprovedJwtAlgorithm: |
There was a problem hiding this comment.
Medium · Stored or configured EdDSA client_assertion_signing_alg is forced to RS256, so token exchange hard-fails even outside FIPS mode
This carries over prior finding 0. The head only rewrote the warning text, so the outcome is the same.
_stored_client_assertion_signing_alg returns "RS256" for every value outside the approved list, EdDSA included. It is called from both:
- the config load path (
load_servers_from_config, line ~2750) - the DB load path (
build_mcp_server_from_table, line ~3343)
Neither call checks is_fips_mode().
Failure scenario
An operator already runs a private-key-JWT MCP server with an Ed25519 client_private_key and client_assertion_signing_alg: EdDSA, with FIPS mode off. After upgrading:
PrivateKeyJwtAuth.signing_algbecomesRS256.token_endpoint._client_assertioncallsjwt.encode(..., <Ed25519 PEM>, algorithm="RS256").- PyJWT raises
InvalidKeyError, whichfetchturns intoCredError.of_misconfigured. - Every tool call that needs this server's token exchange fails.
The new warning says plainly that this will happen. It is still a hard outage for a setup that worked, triggered only by the upgrade.
Proxy JWT auth handles the same algorithm differently: there, EdDSA keeps working outside FIPS with a deprecation warning. The deprecation is therefore inconsistent across surfaces.
Suggested fix: keep honouring EdDSA here when FIPS mode is off, with a deprecation warning, the same way allowed_jwt_algorithms(fips_mode) already does for proxy JWT auth.
This is a backward-incompatible change, and the PR title has no ! marker.
Evidence
mcp_server_manager.py:1610-1631: if value in APPROVED_JWT_ALGORITHMS: return value … return "RS256", with no FIPS check
token_endpoint.py:280: algorithm=auth.signing_alg signs with the stored key
Executed at head: _stored_client_assertion_signing_alg("EdDSA", "srv") returns 'RS256' and logs stored client_private_key cannot sign the RS256 fallback, so token exchange will fail until the key is rotated
Contrast: litellm/proxy/auth/jwt_algorithms.py allowed_jwt_algorithms(fips_mode) keeps EdDSA when fips_mode is False
Latest summary by full · View this review · Reviewed c0077c957aad
There was a problem hiding this comment.
Acknowledged — this is the PR's documented design decision rather than a defect in the fix pass, so I'm escalating it to the PR owner instead of silently changing scope. Rationale: this path signs with a proxy-held key the operator fully controls, and B5 deliberately restricts it to approved algorithms end-to-end — REST create/update already 422-reject EdDSA (litellm/proxy/_types.py: _validated_client_assertion_signing_alg) and MCPServer.client_assertion_signing_alg / PrivateKeyJwtAuth.signing_alg are typed ApprovedJwtAlgorithm. Honoring EdDSA outside FIPS here would require widening those types and re-opening EdDSA in the REST validators (otherwise a stored EdDSA server works but can never be re-saved — a dead-end state). What this fix pass did change: the fallback warning now states the honest outcome (the Ed25519 key cannot sign the RS256 fallback; token exchange fails until rotated to RSA/EC) instead of implying the fallback works. The proxy-JWT-auth vs MCP-signing asymmetry is intentional: inbound verification tolerates legacy IdP keys the operator does not control; the proxy's own signing key does not.
There was a problem hiding this comment.
Unable to conclude
The PR changed during this follow-up. The thread was left unchanged; reply again to reassess the current code.
Reviewed c0077c957aad · View follow-up
| unverified_header: Final = jwt.get_unverified_header(raw_token) | ||
| kid: Final = unverified_header.get("kid") | ||
|
|
||
| approved_keys: Final = jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS) |
There was a problem hiding this comment.
Medium · MCPJWTSigner and OAuth identity binding reject EdDSA IdP tokens regardless of FIPS mode
Two MCP verification paths now filter the JWKS against APPROVED_JWT_ALGORITHMS, a fixed list with no FIPS awareness:
_verify_incoming_jwtcallsjwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS).oauth_identity_binding._select_signing_keyfilters against_ALLOWED_ID_TOKEN_ALGORITHMS, which isAPPROVED_JWT_ALGORITHMS.
OKP/EdDSA keys are therefore always dropped. Proxy JWT auth, by contrast, uses allowed_jwt_algorithms(self._fips_mode()).
Failure scenario
A deployment uses the mcp_jwt_signer guardrail with access_token_discovery_uri pointing at an IdP that signs with Ed25519. FIPS mode is off.
- Before:
PyJWKSetparsed the OKP key and verification succeeded. - After: the only key is filtered out, and
_verify_incoming_jwtraisesPyJWKSetError("No JWKS key at ... uses an approved signing algorithm"). Every MCP request through that guardrail fails verification.
The same IdP token still gets a 200 on /v1/chat/completions through proxy JWT auth. So the PR's "EdDSA still works outside FIPS" promise holds on one surface and not on the other.
The PR caveat mentions that OKP keys are dropped "regardless of FIPS mode". That is a documented decision, but it still breaks existing users outside FIPS, and there is no deprecation step and no recorded approval.
Suggested fix: filter with allowed_jwt_algorithms(is_fips_mode()) and emit the same one-time EdDSA deprecation warning. At minimum, mark the PR as breaking.
Evidence
mcp_jwt_signer.py:457-459: approved_keys = jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS); raises if empty
oauth_identity_binding.py:31,121: _ALLOWED_ID_TOKEN_ALGORITHMS = APPROVED_JWT_ALGORITHMS; for key in jwks_keys_for(keys, _ALLOWED_ID_TOKEN_ALGORITHMS)
Executed at head, no FIPS env: an Ed25519-signed token against a JWKS of one OKP key gives PyJWKSetError No JWKS key at 'https://idp/jwks' uses an approved signing algorithm
handle_jwt.py:272-273: proxy JWT auth uses allowed_jwt_algorithms(self._fips_mode()), which keeps EdDSA outside FIPS
Latest summary by full · View this review · Reviewed c0077c957aad
There was a problem hiding this comment.
Acknowledged — same treatment: the PR caveats explicitly document that OKP/EdDSA IdP keys are dropped on these MCP verification surfaces regardless of FIPS mode, so making MCPJWTSigner._verify_incoming_jwt and oauth_identity_binding._select_signing_key FIPS-aware (allowed_jwt_algorithms(is_fips_mode()) + one-time deprecation) is a behavior change to the PR's documented scope. Escalating to the PR owner rather than changing it unilaterally in a fix pass. One mitigation that did land in c0077c9: when an EdDSA key is dropped from a JWKS anywhere (jwks_keys_for), the operator now gets a once-per-key warning naming alg/kid/kty and pointing at APPROVED_JWT_ALGORITHMS, so the failure mode you describe is no longer a silent PyJWKSetError.
There was a problem hiding this comment.
Unable to conclude
The PR changed during this follow-up. The thread was left unchanged; reply again to reassess the current code.
Reviewed c0077c957aad · View follow-up
…l-read integration test
|
Fixed the Bugbot finding in 1c05d98: the seeded dual-read integration test now expects the per-algorithm fallback wording (HS256 keeps 'not an approved algorithm / using RS256'; EdDSA expects 'cannot sign the RS256 fallback / token exchange will fail / rotated to RSA or EC'). @litereview full |
|
bugbot run |
| ) | ||
|
|
||
|
|
||
| def _stored_client_assertion_signing_alg(value: object, server_name: str) -> ApprovedJwtAlgorithm: |
There was a problem hiding this comment.
Medium · Stored/configured EdDSA client_assertion_signing_alg is forced to RS256, so private_key_jwt token exchange hard-fails after upgrade even with FIPS off
This carries over earlier open findings 892e…:0 and 45df…:0. At this head the code is unchanged except for the warning text, which now openly says the server will break.
_stored_client_assertion_signing_alg maps every value outside APPROVED_JWT_ALGORITHMS to "RS256", EdDSA included. It never consults is_fips_mode(). It runs on both load paths:
load_servers_from_config(around line 2750)build_mcp_server_from_table(around line 3343)
Failure scenario: an operator runs an ID-JAG / private_key_jwt MCP server with an Ed25519 client_private_key and client_assertion_signing_alg: EdDSA, with LITELLM_FIPS_MODE unset. After upgrading:
PrivateKeyJwtAuth.signing_algbecomesRS256.token_endpoint.py:280callsjwt.encode(..., <Ed25519 key>, algorithm="RS256").- PyJWT raises
InvalidKeyError, whichfetchreports as a misconfigured credential. - Every tool call needing that server's token exchange fails until the key is rotated.
Proxy JWT auth keeps EdDSA working outside FIPS, through allowed_jwt_algorithms(fips_mode=False). This surface turns the same deprecation into an immediate outage.
Suggested fix: when FIPS is off, return EdDSA here with a deprecation warning, and only fall back or refuse under FIPS. That needs MCPServer.client_assertion_signing_alg / PrivateKeyJwtAuth.signing_alg to admit the legacy literal. The write-side 422 can stay strict.
This is backward incompatible, and the PR title lacks the ! marker.
Evidence
mcp_server_manager.py:1610-1631: if value in APPROVED_JWT_ALGORITHMS: return value … return "RS256", with no FIPS check
Executed at head: _stored_client_assertion_signing_alg("EdDSA", "srv") → 'RS256', logging the stored client_private_key cannot sign the RS256 fallback, so token exchange will fail
Executed: jwt.encode({...}, <Ed25519 PKCS8 PEM>, algorithm="RS256") → InvalidKeyError ... Invalid Key type for RSAAlgorithm
Contrast: jwt_algorithms.py:18-19 allowed_jwt_algorithms(fips_mode) keeps EdDSA when fips_mode is False
PR body lists this as a Medium caveat ("Stale HS256 or EdDSA stored values now sign with RS256") with no recorded approval
Latest summary by full · View this review · Reviewed 1c05d98791c8
| unverified_header: Final = jwt.get_unverified_header(raw_token) | ||
| kid: Final = unverified_header.get("kid") | ||
|
|
||
| approved_keys: Final = jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS) |
There was a problem hiding this comment.
Medium · MCPJWTSigner now rejects EdDSA IdP tokens regardless of FIPS mode
This carries over the signer half of earlier finding 45df…:1. I dropped the OAuth identity binding half: that path already passed the approved-only algorithms=_ALLOWED_ID_TOKEN_ALGORITHMS to jwt.decode before this PR, so EdDSA was already rejected there.
Before: _verify_incoming_jwt built a PyJWKSet from the IdP JWKS and verified with the key's own algorithm_name. An IdP signing with Ed25519 (OKP, alg: EdDSA) verified fine.
Now: it filters with jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS), a constant that never includes EdDSA. It does not use allowed_jwt_algorithms(is_fips_mode()).
Failure scenario: a deployment uses the MCP JWT signer guardrail with access_token_discovery_uri pointing at an IdP that publishes only an Ed25519 signing key, with FIPS off. After upgrade:
- Every incoming bearer JWT fails with
PyJWKSetError: No JWKS key at ... uses an approved signing algorithm. - MCP calls through that guardrail are refused.
The proxy's own JWT auth accepts the same token with a one-time deprecation warning. The "deprecated outside FIPS" story is therefore not true for this surface.
Suggested fix: use allowed_jwt_algorithms(is_fips_mode()) here, with the same once-per-process deprecation log. Alternatively, record an explicit sign-off for the hard break.
Evidence
mcp_jwt_signer.py:457-459: approved_keys = jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS); raises PyJWKSetError when empty
Executed at head with FIPS off (is_fips_mode() → False): an EdDSA token signed by an Ed25519 key whose JWK is {kty: OKP, alg: EdDSA, kid: ed} → PyJWKSetError No JWKS key at 'https://idp/jwks' uses an approved signing algorithm
handle_jwt.py: allowed_algorithms() → allowed_jwt_algorithms(self._fips_mode()) keeps EdDSA outside FIPS for proxy JWT auth
PR body Medium caveat "MCP JWT signer ... now drop oct and OKP JWKS keys regardless of FIPS mode" has no recorded approval
Latest summary by full · View this review · Reviewed 1c05d98791c8
…ning_alg and guardrail JWKS Defect 1: _stored_client_assertion_signing_alg unconditionally coerced a stored client_assertion_signing_alg=EdDSA to RS256, but the stored key is Ed25519 which cannot sign RS256, so every token exchange for that server failed (CredError misconfigured) with LITELLM_FIPS_MODE unset. Gate the coercion on is_fips_mode(): outside FIPS return the stored EdDSA unchanged with a deprecation warning (read-side grace mirroring handle_jwt); inside FIPS keep the RS256 fallback + rotate-key warning so the exchange fails loudly. Widen the two read-side type surfaces (MCPServer.client_assertion_signing_alg, PrivateKeyJwtAuth.signing_alg) to StoredJwtAlgorithm via LEGACY_JWT_ALGORITHMS; write-side New/Update request validators stay approved-only and still 422 EdDSA. Defect 2: the guardrail JWKS filter used the raw approved list (jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS)), dropping OKP/Ed25519 keys so every guarded MCP call 401'd outside FIPS (mixed JWKS even misreported a kid mismatch). Mirror handle_jwt: jwks_keys_for(jwks_keys, allowed_jwt_algorithms(is_fips_mode())); EdDSA keys verify outside FIPS with the standard once-per-process deprecation notice, and are still dropped inside FIPS.
|
@litereview full |
|
Automatic reviews are disabled for this repository. |
|
bugbot run |
| value, | ||
| ) | ||
| return "RS256" | ||
| if value is not None: |
There was a problem hiding this comment.
Medium · Stored HS256 client_assertion_signing_alg is coerced to RS256, breaking working HMAC-signed client assertions on upgrade
What changed. Before this PR, build_mcp_server_from_table and load_servers_from_config passed the stored client_assertion_signing_alg through as-is. token_endpoint._client_assertion then ran jwt.encode(..., client_private_key, algorithm=auth.signing_alg).
An ID-JAG server configured with client_assertion_signing_alg: HS256 and a shared secret in client_private_key produced a valid HMAC client assertion. Okta and others accept this as client_secret_jwt-style auth, so the setup worked.
At head, _stored_client_assertion_signing_alg maps every value that is neither approved nor legacy (so HS256, HS384, HS512) to "RS256", regardless of FIPS mode.
Failure scenario. An existing DB row or config entry has client_assertion_signing_alg: HS256 and an HMAC secret as client_private_key. After upgrade:
- The boot log says it is "using RS256".
- Every token exchange calls
jwt.encode(secret, algorithm="RS256"), which raisesInvalidKeyError. fetchturns that intoCredError.of_misconfigured("could not sign the client assertion").- Every MCP call to that server fails.
No FIPS opt-in is involved.
Why the PR's reasoning doesn't cover it. The PR treats HS256 as a typo that "fails at the IdP". With a symmetric key, though, the configuration was valid. RS256 cannot be produced from an HMAC secret, so the fallback guarantees failure; it does not degrade gracefully. This is the same shape as the EdDSA issue already fixed for the legacy branch.
The caveat has no sign-off. The PR body caveat "Stale HS256 … stored values now sign with RS256" describes an operator-observable break and has no recorded approval.
Suggested fix. Pick one:
- Treat stored
HS*like legacy EdDSA: honour it outside FIPS with a deprecation warning, refuse it under FIPS. - Fail loudly at load, saying the server cannot sign, instead of substituting an algorithm the stored key cannot produce.
Whichever you choose, record the decision against the caveat.
Evidence
mcp_server_manager.py:1637-1644: values that are neither approved nor legacy log not an approved algorithm, using RS256 and return "RS256", with no is_fips_mode() check
Base code (removed in the diff at build_mcp_server_from_table): credentials_dict.get("client_assertion_signing_alg") ... or "RS256" passed HS256 through unchanged
token_endpoint.py:268-281: jwt.encode(..., auth.private_key.get_secret_value(), algorithm=auth.signing_alg, ...)
Executed at head (uv run python /tmp/hs.py): _stored_client_assertion_signing_alg("HS256", "okta_srv") returned RS256; jwt.encode(secret, algorithm="HS256") (base behaviour) succeeded; token_endpoint._client_assertion with the coerced RS256 raised InvalidKeyError Could not parse the provided public key.
PR body Caveats: "Stale HS256 or EdDSA stored values now sign with RS256 after a boot warning; the row is not rewritten", with no recorded approval
Latest summary by full · View this review · Reviewed ff348d1be4b0
…signing algs litereview round on ff348d1: a stored client_assertion_signing_alg=HS256 with a shared secret in client_private_key produced a working client_secret_jwt-style assertion before the allowlist; coercing it to RS256 guarantees failure since an HMAC secret cannot sign RSA, and the boot log claimed it was 'using RS256'. Apply the same FIPS-gated read-side grace as stored EdDSA: outside FIPS the stored HS* value is honoured with a rotate-to-approved warning so the secret keeps signing; inside FIPS the RS256 fallback stands with an honest cannot-sign warning so the exchange fails loudly. Write-side New/Update validators still 422 HS*, and the verification-side allowlists (allowed_jwt_algorithms / jwks_keys_for) are untouched — oct/HS256 JWKS keys stay dropped in every mode. Also: the guardrail EdDSA deprecation notice now fires only after the signature verifies (Bugbot: a failed EdDSA token no longer logs 'accepted'), and the integration JWKS allowlist suite pins the new flag-off EdDSA-verifies behaviour (the OKP rejection cell moved to unit level where LITELLM_FIPS_MODE can be set without the boot-time FIPS runtime checks refusing a non-FIPS OpenSSL).
|
Addressed the latest review round in a3f06ab, extending the owner-approved rule (the FIPS flag decides whether non-approved crypto may RUN; read-side grace outside FIPS, loud refusal inside):
|
|
@litereview full |
|
bugbot run |
…ce warnings Bugbot round on a3f06ab: the seeded-row integration cells still waited for the pre-grace 'using RS256' / 'cannot sign the RS256 fallback' boot warnings, which no longer fire outside FIPS mode where the stored values are now honoured. Point them at the accepted-outside-FIPS deprecation warnings instead; the FIPS-on fallback wording stays pinned at the unit level (LITELLM_FIPS_MODE cannot be set on the integration proxy without the boot-time FIPS runtime checks refusing a non-FIPS OpenSSL).
|
@litereview full |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8311e84. Configure here.
| _APPROVED_JWT_ALGORITHM_ADAPTER: Final = TypeAdapter(ApprovedJwtAlgorithm) | ||
|
|
||
|
|
||
| def _validated_client_assertion_signing_alg(credentials: MCPCredentials | None) -> MCPCredentials | None: |
There was a problem hiding this comment.
Low · POST/PUT /v1/mcp/server rejects EdDSA/HS* signing algs that the read path still honours outside FIPS
The PR is FIPS-aware on the read side but not on the write side.
- Read side:
_stored_client_assertion_signing_algkeepsEdDSAandHS256/384/512signing when FIPS is off. That covers both stored DB rows andconfig.yaml. - Write side:
_validated_client_assertion_signing_algvalidates againstApprovedJwtAlgorithmwithout checking FIPS. BothNewMCPServerRequestandUpdateMCPServerRequestattach it as afield_validator("credentials").
Concrete scenario (FIPS off): an operator manages MCP servers through the API, e.g. a GitOps/Terraform-style apply that re-POSTs or PUTs the full server definition. One server uses an Ed25519 private key with client_assertion_signing_alg: EdDSA. After upgrade:
- The existing row keeps working, with a deprecation warning.
- The next re-apply, clone to a staging proxy, or delete-and-recreate gets a 422:
client_assertion_signing_alg must be one of RS256, .... - The same definition placed in
config.yamlloads fine.
So during the stated deprecation window outside FIPS, a working configuration can be loaded but can no longer be submitted through the management API. That is a backward-incompatible API contract change.
The PR body calls this out as intentional ("write-side requests stay approved-only and 422 it"). However, the title fix(auth): ... has no ! breaking-change marker, and I see no recorded sign-off for the write-side break.
The dashboard edit flow is unaffected: the field is redacted on read and empty strings are dropped, so the UI does not re-send it.
Options:
- Gate the validator on
is_fips_mode(): allowLEGACY_JWT_ALGORITHMSandSYMMETRIC_JWT_ALGORITHMSwith a warning when FIPS is off, matchingallowed_jwt_algorithms. Typos would still be rejected. - Or keep the hard 422 and mark the PR breaking (
fix(auth)!:) with an explicit approval.
Evidence
_types.py:1618-1628: _APPROVED_JWT_ALGORITHM_ADAPTER = TypeAdapter(ApprovedJwtAlgorithm); any value outside the nine approved ones raises ValueError, with no is_fips_mode() check
_types.py:1719-1722 and 1818-1821: the validator is attached to both NewMCPServerRequest and UpdateMCPServerRequest
mcp_server_manager.py:1612-1658: the read path returns EdDSA/HS* unchanged when not is_fips_mode()
Executed probe at head with LITELLM_FIPS_MODE=false: _stored_client_assertion_signing_alg('EdDSA') → 'EdDSA' and ('HS256') → 'HS256'
Before this PR, MCPCredentials.client_assertion_signing_alg: str | None (types/mcp.py:277) had no request-side validation
Latest summary by full · View this review · Reviewed 8311e8463068
|
On the remaining Low (write-side 422s EdDSA/HS* outside FIPS while the read side honours them): keeping the hard 422 is the owner-directed design for this change — the approved rule is read-side grace only ('the NewMCPServerRequest/UpdateMCPServerRequest validators stay strict — EdDSA in new/updated config still 422s'), i.e. your option (b). The deprecation window keeps existing rows/config working; new declarations via the management API are steered to approved algorithms, and the dashboard edit flow is unaffected as you noted. Whether to additionally mark the PR title breaking (fix(auth)!:) needs an owner call — flagging here and to the owner rather than changing the contract unilaterally. |
TLDR
Problem this solves:
client_assertion_signing_algaccepts any string, including HS256 typosHow it solves it:
litellm/types/proxy/auth/jwt_algorithms.pyLITELLM_FIPS_MODE=true/v1/mcp/serverrejects non approvedclient_assertion_signing_algwith a 422User Flow
Before: a proxy admin registers an MCP server with a typo in the signing algorithm and nothing tells them
"credentials": {"client_assertion_signing_alg": "HS256", "client_private_key": "..."}After: the typo is caught at registration and Ed25519 users get a heads up
"client_assertion_signing_alg": "HS256"client_assertion_signing_algand the nine approved values; resending with"ES256"returns 201LITELLM_FIPS_MODE=trueLinear ticket
Resolves LIT-8429
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Final head is
80bcabdf83000d4df26f65c796210af6057031c8against merge base04f0ea8c338cc855ebb823a0721af61b2114a1b5(#42700 is already in that base). Product code last changed atb20805b7; the later commits merge main, fix the test imports those merges broke, and make three type-only follow ups (ApprovedJwtAlgorithmasTypeAlias,jwks_keys_forgeneric over the mapping element type,Finalon the TypeVar) with no behavior change. Every number below was recorded at80bcabdfand nothing from earlier heads is keptLive legs (real OpenAI gpt-5.4, real Postgres, JWKS servers on :4190/:4191)
Two proxies, two workers each: base worktree at
04f0ea8con :4110, head at80bcabdfon :4111, fresh databases, aLiteLLM_MCPServerTablerowlpr6_seeded_hs256withclient_assertion_signing_alg = 'HS256'inserted into both after boot. JWKS carriesrsa(RS256),rsa2(RSA, no alg),ec1(EC P-256, no alg),ed(OKP EdDSA) andsym(oct HS256) under oneJWT_PUBLIC_KEY_URL, plusmulti(RS256) on a second URLBefore (04f0ea8)
curl -X POST http://127.0.0.1:4110/v1/chat/completions -H "Authorization: Bearer <EdDSA jwt>" -d '{"model":"gpt-5.4","messages":[{"role":"user","content":"say hi"}]}'gives HTTP 200 andgrep -c "EdDSA, which is deprecated" base.logprints 0. RS256, RS256 without alg, ES256 without alg, the second JWKS URL, the RS256 stream and/v1/messagesall 200; the HS256 token is 401 (Validation fails: 'k')curl -X POST http://127.0.0.1:4110/v1/mcp/server -H "Authorization: Bearer sk-****" -d '{"server_name":"lpr6_EdDSA","transport":"http","url":"https://mcp.example.com","token_exchange_endpoint":"https://idp.example.com/oauth/token","credentials":{"client_assertion_signing_alg":"EdDSA","client_private_key":"<pem>"}}'gives HTTP 201 and stores the value;hs256and""also 201, PUT withEdDSAon an existing server 202GET /v1/mcp/serverlistslpr6_seeded_hs256andgrep -c "lpr6_seeded_hs256: client_assertion_signing_alg" base.logprints 0select count(*) from "LiteLLM_SpendLogs" where request_id in (<the 6 chat and stream ids>)returns 6, 8 rows totalAfter (80bcabd)
grep -c "EdDSA, which is deprecated" head.logprints exactly 1 across both workers:JWT Auth: accepted a token signed with EdDSA, which is deprecated and not FIPS 140-3 approved; it is rejected when LITELLM_FIPS_MODE=true. Move the IdP signing key to RS256, PS256 or ES256. The other seven JWT cells return the same status as before; the HS256 token is still 401, nowNo matching public key found ... kid=symbecause the oct key is filtered before parsing{"detail":[{"type":"value_error","loc":["body","credentials"],"msg":"Value error, client_assertion_signing_alg must be one of RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512","input":{"client_assertion_signing_alg":"EdDSA"},...}]};hs256and""return the same 422 shape, PUT withEdDSA422, POST with each of the nine approved values 201 and PUT withES384202GET /v1/mcp/serverstill listslpr6_seeded_hs256and the grep prints 2 (one per worker):MCP server lpr6_seeded_hs256: client_assertion_signing_alg 'HS256' is not an approved algorithm, using RS256; the config.yaml MCP entry with HS256 logs the same fallback at bootLITELLM_FIPS_MODE=trueboot exits with the feat(proxy): add LITELLM_FIPS_MODE startup gate with provider assertion and loud password migration failure #42700 refusal (this Python does not enforce FIPS), so the FIPS on leg is covered by unit tests only (test_handle_jwt.py::test_fips_mode_rejects_eddsa*)GET /key/infowith a JWT bearer returns 500 on both legs, pre existing and outside this ticketDeterministic audit (tests/integration, scripted upstream, no provider calls)
Legs: head
80bcabdf83000d4df26f65c796210af6057031c8on :4310/:4311, base04f0ea8c338cc855ebb823a0721af61b2114a1b5on :4300/:4301 with the three audit test files overlaid, own Postgres databases and Redis on :4380/:4381. Runner and owned proxies under theenv -iwhitelist from.circleci/scripts/run_integration.shwithLITELLM_LICENSEforwarded exactly as main does. Groupsmanagement(1241 nodes) andmcp(511 nodes,INTEGRATION_WORKERS=4) run once on base and twice on head with seed 4106601 and order seed 0, results inaudit/80bcabdf83000d4df26f65c796210af6057031c8/{base-management,head-management,head-management2,base-mcp,head-mcp,head-mcp2}. Every cell intest_mcp_jwt_signer_jwks_allowlist.pyruns on a module scoped owned proxy so itsdefault_onsigner guardrail cannot interfere with parallel workers. Management: collected and skipped identical between the two head runs (1241/7), the failed set differs only by unrelated flakes (loopback port collisions intest_cli_sso_login_ui_disabled, a once seen killed worker readiness timeout, redis chaos churn). MCP: collected and skipped identical (511/0), passed differs only by the sse parametrization flake churn (test_mcp_transports,test_mcp_access_matrix,test_mcp_credentials) that also fails on mainCells red on base and green on both head runs:
authorization/test_jwt_algorithm_allowlist.py::test_eddsa_signed_token_is_accepted_and_logged_as_deprecated_outside_fips_mode,::test_eddsa_non_stream_request_reaches_upstream_and_logs_deprecation,::test_eddsa_streamed_request_through_openai_sdk_reaches_upstream_and_logs_deprecation,::test_five_eddsa_requests_warn_at_most_once_per_worker;mcp/test_mcp_client_assertion_signing_alg.py::test_non_approved_client_assertion_signing_alg_is_rejected_on_create_and_update,::test_post_with_lowercase_hs256_is_rejected_naming_the_field,::test_put_with_eddsa_on_existing_server_is_rejected,::test_client_assertion_signing_alg_payload_variants[empty],[five-kb],::test_seeded_hs256_row_loads_with_rs256_fallback_warning,::test_seeded_eddsa_row_loads_with_rs256_fallback_warning;mcp/test_mcp_jwt_signer_jwks_allowlist.py::test_jwks_key_with_non_approved_alg_cannot_verify_the_incoming_token[oct-HS256],[OKP-EdDSA]Cells green on both legs: RS256 control, RS256 through the Anthropic SDK on
/v1/messages, async OpenAI SDK on/v1/responses, ES256, HS256 token against an oct key (401), EdDSA signature under an RS256 header (401), no bearer (401), empty JWKS (401), master key on the JWT enabled proxy, the nine approved MCP values stored and read back from the DB row, integer and list values (422), null and absent key (201), unauthenticated MCP POST (401), chat after a 422, RSA JWKS key without alg, RSA key next to an OKP key, JWKS 404 and non JSON (401 plus liveliness 200). Chaos: a 30 request mixed JWT burst across chat, messages and responses with the JWKS server stopped and restarted (every 200 id, streamed ones included, lands exactly once inLiteLLM_SpendLogs), one of the two serving workers killed mid burst with the other still answering, and the MCP signer JWKS server paused with SIGSTOP then resumedCircleCI integration shards did not build for this head (PR branches no longer build automatically). The
managementandmcpgroups those shards run were executed locally at80bcabdfas described above, every PR cell green on both head runs and the remaining failures shared with the merge base legNot run: the FIPS on leg (runner OpenSSL does not enforce FIPS). Out of scope: x5c chain verification and JWKS rotation against a real IdP, which belong in
tests/e2e/. Unrelated pre existing failures in themcpandmanagementgroups (redis outage chaos, MCP credential classes, the 41 stdio transport nodes that 422 on registration in this rig) are the same on both legs. A once seen owned proxy port collision in the shared harness is tracked as LIT-8522Type
🐛 Bug Fix
Caveats (if any)
Severe
/v1/mcp/servernow returns 422 forclient_assertion_signing_algoutside the nine approved values (was accepted silently)LITELLM_FIPS_MODE=true, EdDSA signed JWTs are rejected with 401Medium
octand OKP JWKS keys regardless of FIPS mode, so a token whosekidpoints at one fails verificationLow
Link to Devin session: https://app.devin.ai/sessions/94142fc65ef14e1eb038c25fa7bb5485
Open in Devin Desktop: https://app.devin.ai/desktop/session/94142fc65ef14e1eb038c25fa7bb5485?variant=devin
Requested by: @yucheng-berri
Note
High Risk
Changes authentication and JWT verification across the proxy and MCP OAuth/token exchange; misconfiguration or FIPS toggles can reject previously working EdDSA/HS256 JWKS or MCP client assertions until keys are rotated.
Overview
Introduces a shared approved JWT algorithm set (RS/PS/ES 256–512) and wires it through proxy JWT auth, MCP OAuth, and JWKS verification, with FIPS mode tightening what may be used at runtime.
Proxy JWT auth now decodes with
allowed_algorithms()(approved only whenLITELLM_FIPS_MODE=true; EdDSA still allowed outside FIPS with a once-per-process deprecation warning). JWKS lookups filter keys by allowed algorithms before picking akid, so symmetricoctkeys and non-approved entries no longer verify tokens.MCP changes split write vs read: POST/PUT
/v1/mcp/server422 onclient_assertion_signing_algoutside the nine approved values. Stored/config-loaded values go through_stored_client_assertion_signing_alg, which honours legacy EdDSA/HS* outside FIPS (with rotate warnings) and falls back to RS256 in FIPS or for garbage values so upgrades do not drop servers silently. The same allowlist filtering applies to MCP JWT signer incoming-token verification and OAuth identity binding id_token JWKS selection.Integration and unit tests cover EdDSA grace, MCP registration validation, seeded DB rows, and token-exchange signing for EdDSA/HS256 read-side paths.
Reviewed by Cursor Bugbot for commit 8311e84. Bugbot is set up for automated code reviews on this repo. Configure here.