Skip to content

fix(auth): fips-aware JWT algorithm allowlists for proxy auth and MCP - #42929

Open
devin-ai-integration[bot] wants to merge 38 commits into
mainfrom
litellm_fips_jwt_algorithm_allowlists
Open

devin-ai-integration[bot] wants to merge 38 commits into
mainfrom
litellm_fips_jwt_algorithm_allowlists

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Proxy JWT auth accepts EdDSA, which FIPS 140-3 does not approve
  • MCP client_assertion_signing_alg accepts any string, including HS256 typos
  • MCP JWKS verification never filters keys by algorithm

How it solves it:

  • One approved tuple (RS/PS/ES 256/384/512) in litellm/types/proxy/auth/jwt_algorithms.py
  • JWT auth: EdDSA still works outside FIPS with a one time deprecation warning, rejected under LITELLM_FIPS_MODE=true
  • JWKS keys outside the allowed set are dropped before verification (JWT auth, MCP JWT signer, OAuth identity binding)
  • POST/PUT /v1/mcp/server rejects non approved client_assertion_signing_alg with a 422
  • Stored or configured stale values keep loading and fall back to RS256 with a warning (dual read)

User Flow

Before: a proxy admin registers an MCP server with a typo in the signing algorithm and nothing tells them

  1. They send POST https://litellm-domain/v1/mcp/server with "credentials": {"client_assertion_signing_alg": "HS256", "client_private_key": "..."}
  2. The proxy answers 201 and stores HS256, so every later token exchange fails at the IdP with an opaque error
  3. Meanwhile a developer with an IdP that signs with Ed25519 sends POST https://litellm-domain/v1/chat/completions and gets 200 with nothing in the logs about it

After: the typo is caught at registration and Ed25519 users get a heads up

  1. The admin sends the same POST https://litellm-domain/v1/mcp/server with "client_assertion_signing_alg": "HS256"
  2. The proxy answers 422 naming client_assertion_signing_alg and the nine approved values; resending with "ES256" returns 201
  3. The Ed25519 developer sends the same POST https://litellm-domain/v1/chat/completions and still gets 200, and the proxy log now carries one warning that EdDSA is deprecated and rejected under LITELLM_FIPS_MODE=true
  4. An admin who already had HS256 stored sees the server still listed at GET https://litellm-domain/v1/mcp/server after upgrade, with a boot warning that it now signs with RS256

Linear ticket

Resolves LIT-8429

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Final head is 80bcabdf83000d4df26f65c796210af6057031c8 against merge base 04f0ea8c338cc855ebb823a0721af61b2114a1b5 (#42700 is already in that base). Product code last changed at b20805b7; the later commits merge main, fix the test imports those merges broke, and make three type-only follow ups (ApprovedJwtAlgorithm as TypeAlias, jwks_keys_for generic over the mapping element type, Final on the TypeVar) with no behavior change. Every number below was recorded at 80bcabdf and nothing from earlier heads is kept

Live legs (real OpenAI gpt-5.4, real Postgres, JWKS servers on :4190/:4191)

Two proxies, two workers each: base worktree at 04f0ea8c on :4110, head at 80bcabdf on :4111, fresh databases, a LiteLLM_MCPServerTable row lpr6_seeded_hs256 with client_assertion_signing_alg = 'HS256' inserted into both after boot. JWKS carries rsa (RS256), rsa2 (RSA, no alg), ec1 (EC P-256, no alg), ed (OKP EdDSA) and sym (oct HS256) under one JWT_PUBLIC_KEY_URL, plus multi (RS256) on a second URL

Before (04f0ea8)

  1. 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 and grep -c "EdDSA, which is deprecated" base.log prints 0. RS256, RS256 without alg, ES256 without alg, the second JWKS URL, the RS256 stream and /v1/messages all 200; the HS256 token is 401 (Validation fails: 'k')
  2. 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; hs256 and "" also 201, PUT with EdDSA on an existing server 202
  3. GET /v1/mcp/server lists lpr6_seeded_hs256 and grep -c "lpr6_seeded_hs256: client_assertion_signing_alg" base.log prints 0
  4. select count(*) from "LiteLLM_SpendLogs" where request_id in (<the 6 chat and stream ids>) returns 6, 8 rows total

After (80bcabd)

  1. Same EdDSA curl against :4111 gives HTTP 200 with a real completion, and grep -c "EdDSA, which is deprecated" head.log prints 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, now No matching public key found ... kid=sym because the oct key is filtered before parsing
  2. Same MCP POST gives HTTP 422 with body {"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"},...}]}; hs256 and "" return the same 422 shape, PUT with EdDSA 422, POST with each of the nine approved values 201 and PUT with ES384 202
  3. GET /v1/mcp/server still lists lpr6_seeded_hs256 and 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 boot
  4. The same spend query returns 6, 8 rows total, so every id landed once on both legs
  5. LITELLM_FIPS_MODE=true boot 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/info with a JWT bearer returns 500 on both legs, pre existing and outside this ticket

Deterministic audit (tests/integration, scripted upstream, no provider calls)

Legs: head 80bcabdf83000d4df26f65c796210af6057031c8 on :4310/:4311, base 04f0ea8c338cc855ebb823a0721af61b2114a1b5 on :4300/:4301 with the three audit test files overlaid, own Postgres databases and Redis on :4380/:4381. Runner and owned proxies under the env -i whitelist from .circleci/scripts/run_integration.sh with LITELLM_LICENSE forwarded exactly as main does. Groups management (1241 nodes) and mcp (511 nodes, INTEGRATION_WORKERS=4) run once on base and twice on head with seed 4106601 and order seed 0, results in audit/80bcabdf83000d4df26f65c796210af6057031c8/{base-management,head-management,head-management2,base-mcp,head-mcp,head-mcp2}. Every cell in test_mcp_jwt_signer_jwks_allowlist.py runs on a module scoped owned proxy so its default_on signer 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 in test_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 main

Cells 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 in LiteLLM_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 resumed

CircleCI integration shards did not build for this head (PR branches no longer build automatically). The management and mcp groups those shards run were executed locally at 80bcabdf as described above, every PR cell green on both head runs and the remaining failures shared with the merge base leg

Not 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 the mcp and management groups (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-8522

Type

🐛 Bug Fix

Caveats (if any)

Severe

  • POST/PUT /v1/mcp/server now returns 422 for client_assertion_signing_alg outside the nine approved values (was accepted silently)
  • Under LITELLM_FIPS_MODE=true, EdDSA signed JWTs are rejected with 401

Medium

  • Stale HS256 or EdDSA stored values now sign with RS256 after a boot warning; the row is not rewritten
  • MCP JWT signer and OAuth identity binding now drop oct and OKP JWKS keys regardless of FIPS mode, so a token whose kid points at one fails verification

Low

  • The EdDSA deprecation warning fires once per process, not once per token
  • The FIPS on leg was not run live because this runner's OpenSSL does not enforce FIPS

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 when LITELLM_FIPS_MODE=true; EdDSA still allowed outside FIPS with a once-per-process deprecation warning). JWKS lookups filter keys by allowed algorithms before picking a kid, so symmetric oct keys and non-approved entries no longer verify tokens.

MCP changes split write vs read: POST/PUT /v1/mcp/server 422 on client_assertion_signing_alg outside 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.

yucheng-berri and others added 14 commits September 23, 2026 07:20
…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>
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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@codspeed

codspeed Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_fips_jwt_algorithm_allowlists (80bcabd) with main (d34ad35)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (145d382) during the generation of this report, so d34ad35 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical impact] The PR appears safe to merge, with no new actionable findings or outstanding numbered findings

Summary

This PR adds shared JWT algorithm lists, FIPS-aware proxy authentication, stricter MCP registration checks, and regression tests

  • Proxy JWT checks use approved algorithms and warn about EdDSA.
  • MCP server writes check signing algorithms and old values fall back to RS256.
  • MCP token checks ignore JWKS keys with unapproved algorithms.

Reviews (19) · Last reviewed commit: "test(mcp): run jwt signer jwks allowlist..." · Reviewed by Greptile

Comment thread litellm/proxy/proxy_server.py Resolved
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.80952% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
..._experimental/mcp_server/oauth_identity_binding.py 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mateo-berri mateo-berri changed the title fix(auth): FIPS aware JWT algorithm allowlists for proxy auth and MCP fix(auth): fips-aware JWT algorithm allowlists for proxy auth and MCP Sep 24, 2026
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@mateo-berri

Copy link
Copy Markdown
Contributor

@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>
@yucheng-berri

Copy link
Copy Markdown
Contributor

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

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor

@litereview full

@litereview

litereview Bot commented Oct 14, 2026

Copy link
Copy Markdown

Review already requested

full is already reviewing c0077c957aad. View existing review.

)


def _stored_client_assertion_signing_alg(value: object, server_name: str) -> ApprovedJwtAlgorithm:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. PrivateKeyJwtAuth.signing_alg becomes RS256.
  2. token_endpoint._client_assertion calls jwt.encode(..., &lt;Ed25519 PEM>, algorithm="RS256").
  3. PyJWT raises InvalidKeyError, which fetch turns into CredError.of_misconfigured.
  4. 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_jwt calls jwks_keys_for(jwks_keys, APPROVED_JWT_ALGORITHMS).
  • oauth_identity_binding._select_signing_key filters against _ALLOWED_ID_TOKEN_ALGORITHMS, which is APPROVED_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: PyJWKSet parsed the OKP key and verification succeeded.
  • After: the only key is filtered out, and _verify_incoming_jwt raises PyJWKSetError("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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@yucheng-berri

Copy link
Copy Markdown
Contributor

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

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

)


def _stored_client_assertion_signing_alg(value: object, server_name: str) -> ApprovedJwtAlgorithm:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. PrivateKeyJwtAuth.signing_alg becomes RS256.
  2. token_endpoint.py:280 calls jwt.encode(..., &lt;Ed25519 key>, algorithm="RS256").
  3. PyJWT raises InvalidKeyError, which fetch reports as a misconfigured credential.
  4. 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({...}, &lt;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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Every incoming bearer JWT fails with PyJWKSetError: No JWKS key at ... uses an approved signing algorithm.
  2. 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.
@yucheng-berri

Copy link
Copy Markdown
Contributor

@litereview full

@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

value,
)
return "RS256"
if value is not None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. The boot log says it is "using RS256".
  2. Every token exchange calls jwt.encode(secret, algorithm="RS256"), which raises InvalidKeyError.
  3. fetch turns that into CredError.of_misconfigured("could not sign the client assertion").
  4. 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).
@yucheng-berri

Copy link
Copy Markdown
Contributor

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):

  1. litereview: stored HS* coerced to RS256 — valid, same defect shape as the stored-EdDSA lockout. A stored HS256 with a shared secret in client_private_key signed working client_secret_jwt-style assertions pre-allowlist. Stored HS* is now honoured outside FIPS with a rotate-to-approved deprecation warning; inside FIPS the RS256 fallback stands with an honest cannot-sign warning (decision recorded here per the finding's ask). Write-side New/Update validators still 422 HS*, and the verification-side allowlists are untouched — oct/HS256 JWKS keys stay dropped in every mode, so no symmetric-verification surface was opened.
  2. Bugbot: stale integration OKP-EdDSA rejection cell — moved that expectation to the unit level (where LITELLM_FIPS_MODE flips without boot-time FIPS runtime checks refusing a non-FIPS OpenSSL); the integration suite now pins flag-off EdDSA-verifies end-to-end.
  3. Bugbot: EdDSA warning fired before verification — the once-per-process notice now emits only after the signature verifies, matching handle_jwt.

@yucheng-berri

Copy link
Copy Markdown
Contributor

@litereview full

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous 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).
@yucheng-berri

Copy link
Copy Markdown
Contributor

@litereview full

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

Comment thread litellm/proxy/_types.py
_APPROVED_JWT_ALGORITHM_ADAPTER: Final = TypeAdapter(ApprovedJwtAlgorithm)


def _validated_client_assertion_signing_alg(credentials: MCPCredentials | None) -> MCPCredentials | None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_alg keeps EdDSA and HS256/384/512 signing when FIPS is off. That covers both stored DB rows and config.yaml.
  • Write side: _validated_client_assertion_signing_alg validates against ApprovedJwtAlgorithm without checking FIPS. Both NewMCPServerRequest and UpdateMCPServerRequest attach it as a field_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:

  1. The existing row keeps working, with a deprecation warning.
  2. 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, ....
  3. The same definition placed in config.yaml loads 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(): allow LEGACY_JWT_ALGORITHMS and SYMMETRIC_JWT_ALGORITHMS with a warning when FIPS is off, matching allowed_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

@yucheng-berri

Copy link
Copy Markdown
Contributor

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.

This branch had an error being deployed

1 failed (outdated) deployment
e2e-changed — 80bcabdf Deployed Oct 9, 2026 by devin-ai-integration[bot] via oauth #4026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants