litellm/tests/test_litellm/proxy
user 76aa97f77b
fix(proxy): close three variant metadata/tag injection paths
Close three variant bypasses adjacent to VERIA-28 found during post-fix
variant audit:

1. _guardrail_modification_check had the same isinstance(dict) bypass
   Veria-AI just flagged on the pre-call strip. A caller sending
   `{"metadata": "{…}"}` as a JSON-encoded string (multipart/form-data
   or extra_body) skipped the guard, got parsed to dict downstream, and
   reached guardrail logic with bypass flags intact. Coerce strings via
   safe_json_loads before evaluating.

2. The allow_client_tags strip only covered body metadata.tags and
   litellm_metadata.tags — caller-supplied tags arriving via the
   x-litellm-tags header or root-level data["tags"] bypassed it. Gate
   add_request_tag_to_metadata's result on the same flag.

3. requester_metadata was deepcopied BEFORE the strip, so attacker
   injections (user_api_key_metadata shadows, disallowed tags,
   _pipeline_managed_guardrails) persisted in the snapshot. The PANW
   guardrail (and any future consumer) trusting requester_metadata
   would see forged values. Move the deepcopy to after the strip.

Regression tests added for each.
2026-04-16 23:35:26 +00:00
..
_experimental/mcp_server Merge remote-tracking branch 'origin/main' into worktree-foamy-jumping-coral 2026-04-15 18:29:55 -07:00
agent_endpoints test(a2a): assert create_a2a_client default timeout uses DEFAULT_A2A_AGENT_TIMEOUT 2026-04-10 21:18:15 +03:00
anthropic_endpoints Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
auth fix(proxy): close three variant metadata/tag injection paths 2026-04-16 23:35:26 +00:00
client build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
common_utils test: add unit tests for path_utils safe_join and safe_filename 2026-04-16 03:25:42 +00:00
db fix: make PodLockManager.release_lock atomic compare-and-delete (re-land #21226) (#24466) 2026-04-15 17:33:21 -07:00
discovery_endpoints feat: add control plane for multi-proxy worker management 2026-03-19 22:50:19 -07:00
experimental/mcp_server
google_endpoints
guardrails Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_yj_apr15 2026-04-16 09:17:20 -07:00
health_endpoints address review feedback 2026-04-11 21:52:39 -07:00
hooks Litellm ishaan april1 try2 (#25110) 2026-04-03 14:57:44 -07:00
image_endpoints
management_endpoints Merge pull request #25665 from BerriAI/litellm_oss_staging_04_13_2026_p1 2026-04-14 23:50:08 +05:30
management_helpers fix(proxy): enforce team membership in team-scoped key management checks 2026-04-14 12:11:11 +03:00
middleware [Fix] Fix test failures and Docker build from pinned dependency upgrade 2026-04-01 09:43:33 -07:00
openai_files_endpoint test: update tag-merge tests for default-deny client tag policy 2026-04-16 22:40:43 +00:00
pass_through_endpoints fix(proxy): pass-through multipart uploads and Bedrock custom body 2026-04-09 19:43:57 -07:00
policy_engine Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
prompts test(prompts): isolate in-memory version tests 2026-04-14 23:37:13 +00:00
public_endpoints feat(ui): expose Azure Entra ID credential fields in provider form 2026-04-04 11:19:45 -07:00
rag_endpoints
realtime_endpoints
response_api_endpoints
spend_tracking fix: hash sk- api_key in /spend/logs date-range path and add filter tests 2026-04-11 23:33:15 -07:00
test_configs
ui_crud_endpoints
vector_store_endpoints
__init__.py
conftest.py remove conftest patch. TODO: make a different PR for this 2026-04-09 22:29:49 +00:00
test_aiohttp_cleanup_closed.py
test_aiohttp_session_recovery.py fix: use AsyncMock for concurrent test consistency 2026-03-18 00:54:23 +00:00
test_api_key_masking_in_errors.py
test_audio_speech_prometheus_hooks.py
test_batch_expiry.py
test_batch_metadata_none_fix.py
test_caching_routes.py
test_chat_completion_metadata.py
test_common_request_processing.py fix(proxy): preserve dict guardrail HTTPException.detail + bedrock context (#25558) 2026-04-11 09:40:39 -07:00
test_cors_config.py refactor: extract _get_cors_config() for testability, fix no-op CORS tests 2026-04-11 22:24:04 +05:30
test_custom_proxy.py
test_empty_model_list.py
test_enforce_user_param.py
test_fallback_management_endpoints.py
test_fastapi_offline_routes.py
test_health_check_functions.py Optimize database query which fetches latest model_id, model_name pairs and dedupes them in memory. 2026-04-15 00:54:37 +00:00
test_health_check_max_tokens.py style: black format test_health_check_max_tokens.py 2026-04-15 18:18:56 -07:00
test_litellm_pre_call_utils.py fix(proxy): close three variant metadata/tag injection paths 2026-04-16 23:35:26 +00:00
test_max_budget_env_var.py Fix PR review issues: gpt-4-0314 prompt caching, case-insensitive data URL check, test I/O mocking 2026-03-21 11:30:29 -07:00
test_model_dump_with_preserved_fields.py
test_model_id_header_propagation.py
test_model_info_default_limits.py refactor: consolidate duplicate helpers and eliminate success-handler double lookup 2026-03-19 07:26:43 -04:00
test_model_level_guardrails.py
test_openapi_schema_validation.py
test_prometheus_cleanup.py
test_proxy_cli.py build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
test_proxy_server.py Fix failing test and code qa + lint 2026-04-14 20:53:17 +05:30
test_proxy_types.py
test_proxy_utils.py fix(proxy): preserve dict guardrail HTTPException.detail + bedrock context (#25558) 2026-04-11 09:40:39 -07:00
test_pyroscope.py
test_response_model_sanitization.py fix: return winning model name instead of comma-separated list for fastest_response 2026-03-27 22:34:26 -07:00
test_route_a2a_models.py
test_route_llm_request.py
test_shared_health_check.py Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
test_spend_log_cleanup.py fix: harden CORS, create_views exception handling, and spend log cleanup loop 2026-04-11 18:58:04 +05:30
test_swagger_chat_completions.py
test_team_member_update.py
test_tools_allowlist_enforcement.py
test_update_llm_router_resilience.py
test_utils.py add NO_OPENAPI env var to disable /openapi.json endpoint (#25547) 2026-04-14 23:37:49 +05:30