Repository navigation
feat(tls): drop ChaCha20 and non-PFS suites from the default cipher list and add a FIPS list - #42926
devin-ai-integration[bot] wants to merge 24 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_tls_cipher_list
…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>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
|
|
bugbot run |
…TLS cipher lists Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot 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
|
@greptileai review latest head |
|
bugbot run |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…er_list # Conflicts: # tests/integration/_support/process.py # tests/unit/test_constants.py
|
@greptileai review latest head |
|
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 f62150d. Configure here.
|
Small follow-up on the cipher list:
|
|
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@litereview code-review |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Note on the failing |
…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>
TLDR
Problem this solves:
How it solves it:
DEFAULT_SSL_CIPHERSdrops the three ChaCha20 suites and the two non-PFSAES*-GCM-SHA*suitesFIPS_SSL_CIPHERSalso drops the CBCECDHE-RSA-AES*-SHA*suites, used whenLITELLM_FIPS_MODEis onLITELLM_SSL_CIPHERSstill overrides the default list; underLITELLM_FIPS_MODEthe override is ignored with a warning so a custom list cannot weaken the FIPS postureBuilds on #42700 (
LITELLM_FIPS_MODEandis_fips_mode()), now merged into main, so this diff is the B7 files only. Not covered here:--ciphersis not applied under granian, one more reason granian is excluded from the FIPS imageUser Flow
Before: an operator who must stay inside FIPS 140-3 sees the gateway complete requests to an upstream that only offers ChaCha20
api_baseonly speaksECDHE-RSA-CHACHA20-POLY1305and restart the proxyAfter: the same request is refused unless the operator explicitly opts back in outside FIPS mode
OpenAIException - Connection error.because the handshake never completes; deployments offering ECDHE AES-GCM keep returning 200LITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305and restarting brings back the 200 for that upstream, unlessLITELLM_FIPS_MODEis on, where the override is logged and ignoredLinear ticket
Resolves LIT-8431
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
Setup shared by both legs: a real proxy with
--num_workers 2,PYTHONPATHpointed at the leg's worktree, three models:gpt-4.1-mini(real OpenAI),tls-gcm-peer(local TLS 1.2 server offering onlyECDHE-RSA-AES256-GCM-SHA384) andtls-chacha-peer(local TLS 1.2 server offering onlyECDHE-RSA-CHACHA20-POLY1305). Payload for every call:Before (base worktree at merge base c38505d, port 4401)
Real OpenAI upstream
model=gpt-4.1-mini{"id":"chatcmpl-EYpEc4ExYMeXIJkFhax08xaX0KMh3",...}ECDHE AES-GCM only upstream
model=tls-gcm-peer{"id":"chatcmpl-",...,"content":"tls ok"...}, peer recordedcipher=ECDHE-RSA-AES256-GCM-SHA384ChaCha20 only upstream
model=tls-chacha-peer{"id":"chatcmpl-",...,"content":"tls ok"...}(the forbidden suite was accepted)ChaCha20 only upstream with LITELLM_SSL_CIPHERS override
After (head b5676ba, port 4402, override leg on 4403, FIPS attempt on 4404)
Real OpenAI upstream
model=gpt-4.1-mini{"id":"chatcmpl-EYpEfIEdP3DpHpCeldYUgu5TzhDdd",...}ECDHE AES-GCM only upstream
model=tls-gcm-peer, non-stream{"id":"chatcmpl-",...,"content":"tls ok"...}, peer recordedcipher=ECDHE-RSA-AES256-GCM-SHA384"stream":truedelta.content="tls"," ok",finish_reason="stop",data: [DONE]ChaCha20 only upstream
model=tls-chacha-peer{"error":{"message":"litellm.InternalServerError: InternalServerError: OpenAIException - Connection error. ...","code":"500"}}, peer recorded no requestChaCha20 only upstream with LITELLM_SSL_CIPHERS override
LITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305,model=tls-chacha-peer{"id":"chatcmpl-",...,"content":"tls ok"...}, peer recordedcipher=ECDHE-RSA-CHACHA20-POLY1305FIPS mode with the override set
LITELLM_FIPS_MODE=trueandLITELLM_SSL_CIPHERS=ECDHE-RSA-CHACHA20-POLY1305LITELLM_SSL_CIPHERS override ignored in FIPS mode; using FIPS_SSL_CIPHERS(the new warning), then exits withLiteLLM proxy refused to start: LITELLM_FIPS_MODE is on but this Python does not enforce FIPSbecause this box runs a non-FIPS OpenSSL, so no request was possibleLive 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_2against 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 negotiateTLS_AES_256_GCM_SHA384on TLS 1.3Deterministic integration audit (base c38505d, head b476420)
Rig: real proxy at
--num_workers 2per leg, real Postgres and Redis, local TLS 1.2 peers as the only doubles (one offeringECDHE-RSA-AES256-GCM-SHA384, oneECDHE-RSA-CHACHA20-POLY1305, one a non-PFSAES*-GCMsuite, one CBC), no real provider and no credential. Base leg: worktree at the merge basec38505d265with the head test files checked out. Head leg:b476420917(plusb5676baadb, a one-line format fix). Head groupssdkandmanagementran twice with--seed 4106601 --order-seed 0: all 13sdk/test_tls_cipher_wire.pycells and all 9configuration/test_tls_cipher_proxy.pycells passing both runs, collected node lists identical, zero skips in the cipher cells. The only sdk-side failure is the known environmentaltest_sdk_usage_routing_reads_tpm_then_rpm_from_redis(local redis 6.0.16 lacks--set-proc-title; the CI docker redis is unaffected)tests/integration/sdk/test_tls_cipher_wire.py::test_sync_handler_refuses_chacha20_only_peer::test_async_httpx_handler_refuses_chacha20_only_peer::test_async_aiohttp_handler_refuses_chacha20_only_peer::test_sync_handler_refuses_non_pfs_aes256_gcm_peer::test_async_httpx_handler_refuses_non_pfs_aes128_gcm_peer::test_sync_handler_accepts_cbc_peer_by_default::test_sync_handler_refuses_cbc_peer_in_fips_mode::test_async_httpx_handler_refuses_cbc_sha384_peer_in_fips_mode::test_handlers_accept_pfs_gcm_peer_in_default_and_fips_modes::test_ssl_ciphers_env_override_keeps_chacha20::test_ssl_ciphers_override_ignored_under_fips_mode::test_cipher_list_follows_fips_mode_toggle_in_one_process::test_burst_survives_peer_restart_without_cipher_errorstests/integration/configuration/test_tls_cipher_proxy.py::test_proxy_round_trips_over_pfs_gcm_peer_and_writes_spend::test_proxy_reports_ssl_error_for_chacha20_only_peer::test_proxy_reports_ssl_error_for_non_pfs_peer::test_proxy_round_trips_responses_over_pfs_gcm_peer_and_writes_spend::test_proxy_reports_ssl_error_for_responses_on_chacha20_only_peer::test_proxy_round_trips_messages_over_pfs_gcm_peer::test_proxy_reports_ssl_error_for_messages_on_chacha20_only_peer::test_proxy_burst_survives_peer_restart_with_every_outcome_recorded::test_proxy_burst_survives_losing_one_workerBase 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-managementandintegration-management-replicadid not run on this head (norun-cilabel); they were green at the immediately preceding audit head. GHA on this head: 85 passed, 2 failed, both unrelated to the diff,pythonand itslint passedaggregate fail only on theCheck OpenAPI docsstep that main added after our last mergeMutation 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_ciphersparameter), 8 killedType
New Feature
Caveats (if any)
Severe
LITELLM_SSL_CIPHERSrestores it. This is the LIT-5289 roadmap decisionMedium
LITELLM_FIPS_MODE=truerefuses to boot on a non-FIPS OpenSSL (feat(proxy): add LITELLM_FIPS_MODE startup gate with provider assertion and loud password migration failure #42700), so the FIPS list was exercised through the SDK path, not a booted proxyssl.SSLContexthas noset_ciphersuites, so TLS 1.3 suite selection is not controllable from Python andTLS_CHACHA20_POLY1305_SHA256stays negotiable on TLS 1.3, as before. In the FIPS image the OpenSSL FIPS provider does not implement ChaCha20-Poly1305, so it cannot be negotiated thereLow
LITELLM_SSL_CIPHERSis read at import time, unchanged from beforeFinal Attestation
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