litellm/tests/pass_through_unit_tests
yucheng-berri 210ffe65fe
fix(proxy): re-assert the authenticated identity on passthrough requests (#36121)
* fix(proxy): re-assert the authenticated identity on passthrough requests

The passthrough merges the client's litellm_metadata into the request metadata
and then re-asserts only user_api_key and the parent span. Every other identity
field the spend and budget pipeline reads stays whatever the request body set,
so a body carrying user_api_key_user_id, user_api_key_team_id,
user_api_key_org_id or user_api_key_end_user_id charges that user, team, org or
end user instead of the caller.

Re-assert the whole sanitized identity after the merge, so the client's copy of
any of those fields is overwritten by the authenticated key's own values.

* test(passthrough): assert no authenticated identity field is client settable

The existing regression names seven fields; the re-assertion covers every field
get_sanitized_user_information_from_key returns, which is twenty today. Derive
the set from the helper so a field added to StandardLoggingUserAPIKeyMetadata is
covered without touching the test.

Two of the twenty were not covered before, including user_api_key_hash, which is
distinct from user_api_key and was client settable.
2026-08-07 00:41:29 +00:00
..
messages_api_structured_output style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
base_anthropic_messages_prompt_caching_test.py test(vcr): close out the remaining VCR live-call leaks (#29603) 2026-06-03 13:46:43 -07:00
base_anthropic_messages_tool_search_test.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
base_anthropic_unified_messages_test.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
conftest.py test(vcr): close out the remaining VCR live-call leaks (#29603) 2026-06-03 13:46:43 -07:00
test_anthropic_messages_passthrough.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_anthropic_messages_prompt_caching.py fix(tests): use Sonnet 4.5 for Bedrock invoke prompt-caching tests 2026-04-28 14:51:47 -07:00
test_anthropic_messages_tool_search.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_assemblyai_unit_tests_passthrough.py fix: block path traversal SSRF in BitBucket, Arize Phoenix, and AssemblyAI clients (#26943) 2026-05-01 11:45:12 -07:00
test_bedrock_anthropic_messages_test.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_bedrock_tool_use_beta_header.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_claude_code_marketplace.py fix(claude-code): create-only skill registration with a PUT update route (LIT-4110) (#31752) 2026-08-05 01:44:56 +00:00
test_context_management_polyfill.py feat(context_management): compact_20260112 polyfill for non-Anthropic providers (#28868) 2026-05-30 09:20:05 -07:00
test_custom_logger_passthrough.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_pass_through_unit_tests.py fix(proxy): re-assert the authenticated identity on passthrough requests (#36121) 2026-08-07 00:41:29 +00:00
test_passthrough_managed_ids.py fix(passthrough): walk scalar request bodies through managed-id rewrite again 2026-08-05 11:02:07 -07:00
test_passthrough_registry_updates.py Fix passthrough tests 2026-02-20 17:28:06 -08:00
test_unit_test_anthropic_pass_through.py fix: passthrough endpoints duplicate logs (#29598) 2026-06-03 12:13:02 -07:00
test_unit_test_passthrough_router.py fix(proxy): resolve pass-through credentials live from router deployments 2026-08-04 23:01:37 -07:00
test_unit_test_streaming.py test(proxy): set status_code on chunk_processor response mocks 2026-07-04 12:49:54 -07:00
test_vertex_ai_anthropic_streaming_cost_injection.py fix(streaming): stamp completion_start_time on first chunk for /v1/messages and /v1/responses (#32284) 2026-07-06 19:30:31 -07:00
test_vertex_ai_live_passthrough.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_websearch_interception_e2e.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00