Two paths previously treated ``_is_available_team`` as a blanket authorization bypass — the function was meant to let standard users self-join a public team but was wired into the broader admin gate without bounding the action being performed. Three concrete exposures resulted: 1. ``/team/member_add``: the bypass let an unprivileged caller add themselves as a Team Admin, or add an arbitrary other ``user_id`` into the team. 2. ``/team/permissions_update``: the same bypass let any authenticated user overwrite a team's ``team_member_permissions`` array, mutating the access policy for every member. 3. (Read endpoint ``/team/permissions_list`` is unchanged — it leaks read-only policy state to non-members but is out of scope of the advisory's recommendation; tracking separately.) This commit: - Splits ``_validate_team_member_add_permissions`` into early-return admin checks followed by an available-team self-join branch that enforces ``member.user_id == caller.user_id`` AND ``member.role == "user"`` for every member entry in the request. The bulk shape (``member: List[Member]``) is checked the same way, so a list with one valid self-entry plus one ``role=admin`` entry is rejected. Email-only members are rejected on the self-join path: matching by ``user_id`` is the only safe primitive at pre-validation time (resolving email→user_id earlier would let unauthenticated callers probe user existence). - Removes the ``_is_available_team`` clause from ``update_team_member_permissions`` entirely. Only proxy / team / org admins can update permission policies. Tests: - Update the two existing ``_validate_team_member_add_permissions`` unit tests to pass the new ``data`` argument. - Add six regression tests covering the privesc shape (role=admin), the cross-user-injection shape (other user_id), the no-caller-uid fail-closed case, the email-only rejection, and the bulk shape. - ``test_team_endpoints.py`` 133/133 pass. |
||
|---|---|---|
| .. | ||
| agent_tests | ||
| audio_tests | ||
| basic_proxy_startup_tests | ||
| batches_tests | ||
| benchmarks | ||
| code_coverage_tests | ||
| documentation_tests | ||
| enterprise | ||
| guardrails_tests | ||
| image_gen_tests | ||
| litellm | ||
| litellm_core_utils | ||
| litellm_utils_tests | ||
| litellm-proxy-extras | ||
| llm_responses_api_testing | ||
| llm_translation | ||
| load_tests | ||
| local_testing | ||
| logging_callback_tests | ||
| mcp_tests | ||
| multi_instance_e2e_tests | ||
| ocr_tests | ||
| old_proxy_tests/tests | ||
| openai_endpoints_tests | ||
| otel_tests | ||
| pass_through_tests | ||
| pass_through_unit_tests | ||
| proxy_admin_ui_tests | ||
| proxy_e2e_anthropic_messages_tests | ||
| proxy_security_tests | ||
| proxy_unit_tests | ||
| router_unit_tests | ||
| scim_tests | ||
| search_tests | ||
| spend_tracking_tests | ||
| store_model_in_db_tests | ||
| test_litellm | ||
| unified_google_tests | ||
| vector_store_tests | ||
| windows_tests | ||
| __init__.py | ||
| eval_swe_bench.py | ||
| gettysburg.wav | ||
| large_text.py | ||
| openai_batch_completions.jsonl | ||
| README.MD | ||
| test_budget_management.py | ||
| test_callbacks_on_proxy.py | ||
| test_config.py | ||
| test_debug_warning.py | ||
| test_default_encoding_non_root.py | ||
| test_end_users.py | ||
| test_entrypoint.py | ||
| test_fallbacks.py | ||
| test_gpt5_azure_temperature_support.py | ||
| test_health.py | ||
| test_keys.py | ||
| test_litellm_proxy_responses_config.py | ||
| test_logging.conf | ||
| test_models.py | ||
| test_new_vector_store_endpoints.py | ||
| test_openai_endpoints.py | ||
| test_organizations.py | ||
| test_otel_thread_leak.py | ||
| test_passthrough_endpoints.py | ||
| test_presidio_latency.py | ||
| test_proxy_server_non_root.py | ||
| test_ratelimit.py | ||
| test_resource_cleanup.py | ||
| test_service_logger_otel.py | ||
| test_spend_logs.py | ||
| test_team_logging.py | ||
| test_team_members.py | ||
| test_team.py | ||
| test_users.py | ||
In total litellm runs 1000+ tests
[02/20/2025] Update:
To make it easier to contribute and map what behavior is tested,
we've started mapping the litellm directory in tests/test_litellm
This folder can only run mock tests.