Skip to content

feat(tls): drop ChaCha20 and non-PFS suites from the default cipher list and add a FIPS list - #42926

Open
devin-ai-integration[bot] wants to merge 24 commits into
mainfrom
litellm_fips_tls_cipher_list
Open

devin-ai-integration[bot] wants to merge 24 commits into
mainfrom
litellm_fips_tls_cipher_list

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Outbound TLS offered ChaCha20 and non-PFS AES-GCM suites, both outside FIPS 140-3
  • No way to get a GCM-only ECDHE cipher list when running in FIPS mode

How it solves it:

  • DEFAULT_SSL_CIPHERS drops the three ChaCha20 suites and the two non-PFS AES*-GCM-SHA* suites
  • New FIPS_SSL_CIPHERS also drops the CBC ECDHE-RSA-AES*-SHA* suites, used when LITELLM_FIPS_MODE is on
  • LITELLM_SSL_CIPHERS still overrides the default list; under LITELLM_FIPS_MODE the override is ignored with a warning so a custom list cannot weaken the FIPS posture
  • The cipher list is part of the SSL context cache key, so a default context is never reused in FIPS mode

Builds on #42700 (LITELLM_FIPS_MODE and is_fips_mode()), now merged into main, so this diff is the B7 files only. Not covered here: --ciphers is not applied under granian, one more reason granian is excluded from the FIPS image

User Flow

Before: an operator who must stay inside FIPS 140-3 sees the gateway complete requests to an upstream that only offers ChaCha20

  1. They add a deployment whose api_base only speaks ECDHE-RSA-CHACHA20-POLY1305 and restart the proxy
  2. They send POST https://litellm-domain/v1/chat/completions for that model
  3. They get 200 with the upstream's answer, negotiated over a suite their compliance policy forbids

After: the same request is refused unless the operator explicitly opts back in outside FIPS mode

  1. They add the same deployment and restart the proxy
  2. They send POST https://litellm-domain/v1/chat/completions for that model
  3. They get 500 OpenAIException - Connection error. because the handshake never completes; deployments offering ECDHE AES-GCM keep returning 200
  4. Setting LITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305 and restarting brings back the 200 for that upstream, unless LITELLM_FIPS_MODE is on, where the override is logged and ignored

Linear ticket

Resolves LIT-8431

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

Setup shared by both legs: a real proxy with --num_workers 2, PYTHONPATH pointed at the leg's worktree, three models: gpt-4.1-mini (real OpenAI), tls-gcm-peer (local TLS 1.2 server offering only ECDHE-RSA-AES256-GCM-SHA384) and tls-chacha-peer (local TLS 1.2 server offering only ECDHE-RSA-CHACHA20-POLY1305). Payload for every call:

curl -s localhost:<port>/v1/chat/completions -H 'Authorization: Bearer sk-live-b7' -H 'Content-Type: application/json' \
  -d '{"model":"<model>","messages":[{"role":"user","content":"say ok"}],"max_tokens":5}'

Before (base worktree at merge base c38505d, port 4401)

Real OpenAI upstream

  1. model=gpt-4.1-mini
  2. HTTP 200, {"id":"chatcmpl-EYpEc4ExYMeXIJkFhax08xaX0KMh3",...}

ECDHE AES-GCM only upstream

  1. model=tls-gcm-peer
  2. HTTP 200, {"id":"chatcmpl-",...,"content":"tls ok"...}, peer recorded cipher=ECDHE-RSA-AES256-GCM-SHA384

ChaCha20 only upstream

  1. model=tls-chacha-peer
  2. HTTP 200, {"id":"chatcmpl-",...,"content":"tls ok"...} (the forbidden suite was accepted)

ChaCha20 only upstream with LITELLM_SSL_CIPHERS override

  1. Not applicable on base, the default already accepts it

After (head b5676ba, port 4402, override leg on 4403, FIPS attempt on 4404)

Real OpenAI upstream

  1. model=gpt-4.1-mini
  2. HTTP 200, {"id":"chatcmpl-EYpEfIEdP3DpHpCeldYUgu5TzhDdd",...}

ECDHE AES-GCM only upstream

  1. model=tls-gcm-peer, non-stream
  2. HTTP 200, {"id":"chatcmpl-",...,"content":"tls ok"...}, peer recorded cipher=ECDHE-RSA-AES256-GCM-SHA384
  3. Same with "stream":true
  4. HTTP 200, chunks delta.content="tls", " ok", finish_reason="stop", data: [DONE]

ChaCha20 only upstream

  1. model=tls-chacha-peer
  2. HTTP 500, {"error":{"message":"litellm.InternalServerError: InternalServerError: OpenAIException - Connection error. ...","code":"500"}}, peer recorded no request

ChaCha20 only upstream with LITELLM_SSL_CIPHERS override

  1. Proxy on 4403 started with LITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305, model=tls-chacha-peer
  2. HTTP 200, {"id":"chatcmpl-",...,"content":"tls ok"...}, peer recorded cipher=ECDHE-RSA-CHACHA20-POLY1305

FIPS mode with the override set

  1. Proxy on 4404 started with LITELLM_FIPS_MODE=true and LITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305
  2. Boot logs LITELLM_SSL_CIPHERS override ignored in FIPS mode; using FIPS_SSL_CIPHERS (the new warning), then exits with LiteLLM proxy refused to start: LITELLM_FIPS_MODE is on but this Python does not enforce FIPS because this box runs a non-FIPS OpenSSL, so no request was possible

Live A/B against real providers at the same two legs (OpenAI, Gemini, Azure OpenAI, stream and non-stream): 200 on both legs with the same response shape. Anthropic returned the same 400 credit balance error on both legs, which still proves the handshake. openssl s_client -tls1_2 against api.openai.com, api.anthropic.com, generativelanguage.googleapis.com and the Azure endpoint negotiates a suite that is in both the new default and the FIPS list, and all four negotiate TLS_AES_256_GCM_SHA384 on TLS 1.3

Deterministic integration audit (base c38505d, head b476420)

Rig: real proxy at --num_workers 2 per leg, real Postgres and Redis, local TLS 1.2 peers as the only doubles (one offering ECDHE-RSA-AES256-GCM-SHA384, one ECDHE-RSA-CHACHA20-POLY1305, one a non-PFS AES*-GCM suite, one CBC), no real provider and no credential. Base leg: worktree at the merge base c38505d265 with the head test files checked out. Head leg: b476420917 (plus b5676baadb, a one-line format fix). Head groups sdk and management ran twice with --seed 4106601 --order-seed 0: all 13 sdk/test_tls_cipher_wire.py cells and all 9 configuration/test_tls_cipher_proxy.py cells passing both runs, collected node lists identical, zero skips in the cipher cells. The only sdk-side failure is the known environmental test_sdk_usage_routing_reads_tpm_then_rpm_from_redis (local redis 6.0.16 lacks --set-proc-title; the CI docker redis is unaffected)

cell node id base head
chacha-only peer refused, sync handler tests/integration/sdk/test_tls_cipher_wire.py::test_sync_handler_refuses_chacha20_only_peer FAIL PASS
chacha-only peer refused, async httpx ::test_async_httpx_handler_refuses_chacha20_only_peer FAIL PASS
chacha-only peer refused, aiohttp ::test_async_aiohttp_handler_refuses_chacha20_only_peer FAIL PASS
non-PFS AES256-GCM refused, sync ::test_sync_handler_refuses_non_pfs_aes256_gcm_peer FAIL PASS
non-PFS AES128-GCM refused, async ::test_async_httpx_handler_refuses_non_pfs_aes128_gcm_peer FAIL PASS
CBC peer accepted by default ::test_sync_handler_accepts_cbc_peer_by_default PASS PASS
CBC peer refused under FIPS ::test_sync_handler_refuses_cbc_peer_in_fips_mode FAIL PASS
CBC SHA384 peer refused under FIPS, async ::test_async_httpx_handler_refuses_cbc_sha384_peer_in_fips_mode FAIL PASS
PFS GCM peer accepted, default and FIPS ::test_handlers_accept_pfs_gcm_peer_in_default_and_fips_modes PASS PASS
LITELLM_SSL_CIPHERS override keeps chacha ::test_ssl_ciphers_env_override_keeps_chacha20 PASS PASS
override ignored under FIPS ::test_ssl_ciphers_override_ignored_under_fips_mode FAIL PASS
FIPS toggle in one process, cache keyed by list ::test_cipher_list_follows_fips_mode_toggle_in_one_process FAIL PASS
sdk burst 30 mixed, peer restart ::test_burst_survives_peer_restart_without_cipher_errors PASS PASS
proxy chat sync, async, stream over GCM, spend rows tests/integration/configuration/test_tls_cipher_proxy.py::test_proxy_round_trips_over_pfs_gcm_peer_and_writes_spend PASS PASS
proxy chat over chacha peer ::test_proxy_reports_ssl_error_for_chacha20_only_peer FAIL PASS
proxy chat over non-PFS peer ::test_proxy_reports_ssl_error_for_non_pfs_peer FAIL PASS
proxy /v1/responses over GCM, spend row ::test_proxy_round_trips_responses_over_pfs_gcm_peer_and_writes_spend PASS PASS
proxy /v1/responses over chacha ::test_proxy_reports_ssl_error_for_responses_on_chacha20_only_peer FAIL PASS
proxy /v1/messages (Anthropic SDK) over GCM ::test_proxy_round_trips_messages_over_pfs_gcm_peer PASS PASS
proxy /v1/messages over chacha ::test_proxy_reports_ssl_error_for_messages_on_chacha20_only_peer FAIL PASS
proxy chaos, 30 mixed requests, peer stop and restart mid burst ::test_proxy_burst_survives_peer_restart_with_every_outcome_recorded PASS PASS
kill one uvicorn worker mid burst ::test_proxy_burst_survives_losing_one_worker PASS PASS

Base FAIL rows are the cells the change introduces (the base accepts the forbidden suite, and on base the env override still wins under FIPS so the renamed refusal cell is red there); every other row is green on both legs. Not run: FIPS through a booted proxy (the #42700 gate refuses a non-FIPS OpenSSL, verified again this run in the 4404 boot attempt, so the FIPS list is exercised at the handler level), TLS 1.3 suite selection (no Python API), and real providers (e2e scope). CircleCI integration-sdk, integration-management and integration-management-replica did not run on this head (no run-ci label); they were green at the immediately preceding audit head. GHA on this head: 85 passed, 2 failed, both unrelated to the diff, python and its lint passed aggregate fail only on the Check OpenAPI docs step that main added after our last merge

Mutation check on the regression tests: 8 mutations (re-add ChaCha20, re-add a non-PFS suite, re-add CBC to the FIPS list, always default, always FIPS, drop the cipher list from the cache key, swap the two constants, ignore the ssl_ciphers parameter), 8 killed

Type

New Feature

Caveats (if any)

Severe

  • An upstream whose TLS endpoint only offers ChaCha20 or non-PFS AES-GCM now fails to connect by default; LITELLM_SSL_CIPHERS restores it. This is the LIT-5289 roadmap decision

Medium

Low

  • LITELLM_SSL_CIPHERS is read at import time, unchanged from before
  • Anthropic live leg could not reach 200 (QA key has no credits); the handshake itself succeeded

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/3637f547e0c44b0e946c27c03d76d605
Open in Devin Desktop: https://app.devin.ai/desktop/session/3637f547e0c44b0e946c27c03d76d605?variant=devin
Requested by: @yucheng-berri

yucheng-berri and others added 10 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>
…proxy edges

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ist and add a FIPS list

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…r only

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ccesses

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

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Changes TLS cipher configuration for outbound connections.

No outstanding finding identified in this review blocks merging.

Summary

The PR narrows the default outbound TLS 1.2 cipher list, selects a GCM-only list in FIPS mode, and adds wire and proxy regression tests. The latest head also includes substantial CI, authentication, cache, and Rust-bridge changes.

Reviews (9) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

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

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks


Comparing litellm_fips_tls_cipher_list (ef49340) with main (a93fee9)

Open in CodSpeed

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

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

…TLS cipher lists

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

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

…er_list

# Conflicts:
#	tests/integration/_support/process.py
#	tests/integration/_support/tls.py
#	tests/unit/proxy/common_utils/test_fips.py
#	tests/unit/test_constants.py
@yucheng-berri

Copy link
Copy Markdown
Contributor

@greptileai review latest head

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

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

@yassin-berriai

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 mateo-berri removed the run-ci label Oct 5, 2026
…er_list

# Conflicts:
#	tests/integration/_support/process.py
#	tests/unit/test_constants.py
@yucheng-berri

Copy link
Copy Markdown
Contributor

@greptileai review latest head

@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 f62150d. Configure here.

@yucheng-berri

Copy link
Copy Markdown
Contributor

Small follow-up on the cipher list: LITELLM_SSL_CIPHERS no longer displaces the certified FIPS list when LITELLM_FIPS_MODE is set — the override is ignored with a warning, and non-FIPS behavior is unchanged (override still wins).

@litereview full

@yucheng-berri

Copy link
Copy Markdown
Contributor

bugbot run

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@litereview code-review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@yucheng-berri

Copy link
Copy Markdown
Contributor

Note on the failing python check: the Check OpenAPI docs step comes from main's test-linting.yml (added in bea0d5c on Oct 10) via the pull_request merge ref, but the job checks out the PR head SHA — and this branch last merged main before that commit, so scripts/openapi_docs_gate.py is missing from the branch tree (No such file or directory, exit 2). It is unrelated to the cipher-list change; a main merge into the branch will pick the script up.

yucheng-berri and others added 2 commits October 14, 2026 15:03
…er_list

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>

This branch had an error being deployed

1 failed (outdated) deployment
e2e-changed — 22778958 Deployed Oct 5, 2026 by devin-ai-integration[bot] via oauth #3087
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