mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-29 01:03:17 +00:00
* 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.
20 lines
658 B
Python
20 lines
658 B
Python
from collections.abc import Iterator
|
|
|
|
import pytest
|
|
|
|
from litellm.proxy.mcp_server.outbound_credentials.bridge_credentials import envelope_keys_from_master_key
|
|
from litellm.proxy.mcp_server.outbound_credentials.session_credentials import session_keys_from_master_key
|
|
|
|
|
|
@pytest.fixture
|
|
def openssl_enforcing_fips(fips_openssl: None) -> Iterator[None]:
|
|
envelope_keys_from_master_key.cache_clear()
|
|
session_keys_from_master_key.cache_clear()
|
|
yield
|
|
envelope_keys_from_master_key.cache_clear()
|
|
session_keys_from_master_key.cache_clear()
|
|
|
|
|
|
@pytest.fixture
|
|
def fips_mode_on(openssl_enforcing_fips: None, fips_mode: None) -> None:
|
|
return None
|