litellm/tests/test_litellm/llms/custom_httpx
Yassin Kortam ae1d1cb05e
fix(http): stop pooled clients persisting cookies on the aiohttp jar too (#36149)
#35978 stopped the pooled A2A client replaying one upstream's Set-Cookie to
another by installing a blocking policy on that client's httpx cookie jar. That
covers only one of the two jars on the request path. AiohttpTransport is the
default transport unless it is explicitly disabled, and the aiohttp ClientSession
behind it keeps its own cookie jar which no httpx-level assertion can observe, so
the leak is still live on the default path: a live proxy on that commit still
delivers agent-alpha's session cookie to agent-beta's card fetch and JSON-RPC
call.

The reason it looked fixed is that aiohttp's default CookieJar is built with
unsafe=False and refuses to store cookies for IP hosts, so a proof addressed to
127.0.0.1 comes back clean whether or not that jar is blocked.

Cookie persistence is now blocked where the clients are built rather than at one
call site: blocked_cookie_jar() gives every httpx client, async and sync, a jar
whose DefaultCookiePolicy(allowed_domains=()) rejects every domain in both
directions, and both ClientSession constructions litellm owns, the transport's
session factory and the proxy's shared startup session, get a DummyCookieJar.
LiteLLM reads a response cookie nowhere, and an explicitly supplied Cookie header
still goes out, so passthrough forwarding and an agent's extra_headers are
unaffected. The A2A-scoped policy #35978 added is removed, since it is now dead.

The two suites that drive the aiohttp session factory synchronously mock
ClientSession because a real one needs a running event loop; DummyCookieJar has
the same requirement, so they mock it for the same reason.
2026-08-07 11:05:59 -07:00
..
test_aiohttp_cleanup_closed.py fix(http): stop pooled clients persisting cookies on the aiohttp jar too (#36149) 2026-08-07 11:05:59 -07:00
test_aiohttp_handler.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_aiohttp_so_keepalive.py fix(http): stop pooled clients persisting cookies on the aiohttp jar too (#36149) 2026-08-07 11:05:59 -07:00
test_aiohttp_transport.py fix(aiohttp): dispose recycled client sessions deterministically (#33428) 2026-07-31 16:48:08 +00:00
test_async_client_cleanup.py fix(async_client_cleanup): stop cleanup from resurrecting healed clients 2026-08-04 22:43:40 -07:00
test_credential_leak_prevention.py Litellm agent oss staging 05 11 2026 (#27733) 2026-05-13 14:09:12 -07:00
test_gemini_session_leak.py Fix __main__ exit bug, close litellm_async_client, restore global state 2026-03-14 18:14:42 -07:00
test_http_handler.py fix(http): stop pooled clients persisting cookies on the aiohttp jar too (#36149) 2026-08-07 11:05:59 -07:00
test_llm_http_handler.py fix(anthropic): honor messages request timeout (#33418) 2026-07-15 14:37:48 -07:00
test_mock_transport.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00