litellm/tests/unit/proxy/mcp_server/outbound_credentials
yucheng-berri b603e84c02
fix(mcp): derive MCP bridge and session keys with the FIPS provider's KBKDF (#50032)
* fix(mcp): derive MCP bridge and session keys with the FIPS provider's KBKDF

With OpenSSL enforcing FIPS, hashlib.scrypt raises, so every MCP session
token and bridge envelope request failed with a 500. Under FIPS the keys
now come from LITELLM_SALT_KEY through SP 800-108r1 KBKDF run by the
provider's EVP_KDF. Without FIPS the scrypt keys are unchanged

* fix(mcp): keep master key rotation invalidating MCP tokens under FIPS

Pass the master key as the KBKDF context, so rotating it changes the
three FIPS-mode keys as it changes the scrypt keys

* test(mcp): annotate new FIPS key test locals with Final

* fix(mcp): derive the FIPS MCP keys only when general_settings.fips_mode is on

On a FIPS OpenSSL 1.1.1 host (RHEL 8) scrypt still works, so keying the switch on
openssl_enforces_fips() sent those hosts to the OpenSSL 3 only KBKDF and broke MCP
sessions and bridge envelopes that worked on main. fips_mode_active() is the same
reader B1 adds, set by enforce_fips_mode at startup.

* refactor(fips): move the salt key KBKDF into encrypt_decrypt_utils

The KBKDF helper derives keys from LITELLM_SALT_KEY, so it now sits next to the other salt key helpers, and fips.py goes back to main's version.

* Pin the MCP key KBKDF fetch to the FIPS provider

Fetch KBKDF with the property query fips=yes, so a change to the process's default
properties after boot can't move the derivation to a non-FIPS provider. The shared
fips_openssl test fixture drops the pin, since the test OpenSSL has no FIPS provider.
2026-11-07 13:33:27 -08:00
..
__init__.py
conftest.py
test_adapter.py
test_authz_code_refresher.py
test_bridge_credentials.py
test_client_credentials.py
test_dual_cache_token_backend.py
test_envelope.py
test_httpx_auth.py
test_login_assertion_exchange.py
test_oauth_token_store.py
test_per_user_oauth_store.py
test_presented_token_store.py
test_redis_distributed_lock.py
test_redis_refresh_coordinator.py
test_resolver.py
test_result.py
test_session_credentials.py
test_session_token.py
test_sso_assertion_refresher.py
test_sso_assertion_store.py
test_token_cache_codec.py
test_token_endpoint.py
test_token_exchange_provider.py
test_token_exchanger.py
test_types.py
test_v2_token_store.py