litellm/tests/test_litellm/proxy/auth
Yuneng Jiang 151d7ab1bc
fix: isolate per-fetch HTTPException in centralized common_checks gate
The asyncio.gather in `_run_centralized_common_checks` ran with
`return_exceptions=False` and a single bare `except HTTPException`
arm, so an HTTPException from any one fetch (the realistic case is a
404 from `get_team_object` when a token references a deleted team)
zeroed out the user, end-user, project, and global-spend contexts in
addition to falling back the team object. That silently skipped the
user budget, end-user budget, and project enforcement passes inside
`common_checks` for the unrelated contexts that had actually fetched
fine.

Switch to `return_exceptions=True` and apply per-fetch fallback
(matches the pre-refactor per-fetch try/except pattern in the builder):

- ProxyException / BudgetExceededError still propagate as authz failures.
- HTTPException on the team fetch reconstructs from the token; on the
  other fetches it nulls only that one context.
- Successful fetches always reach `common_checks` intact.

Adds two unit tests covering the team-404 and user-404 cases to lock
the per-fetch isolation in. Drops the inaccurate `PROXY_ADMIN tokens
short-circuit` claim from the docstring — admin tokens still flow
through `common_checks`; admin status is only honored where the
underlying check exempts it.
2026-04-25 09:58:23 -07:00
..
test_auth_checks.py Merge pull request #26279 from stuxf/fix/post-auth-enforcement 2026-04-24 13:04:29 -07:00
test_auth_exception_handler.py fix(auth): address CI regressions from centralization 2026-04-23 00:13:17 +00:00
test_auth_hot_path_network_requests.py fix: update docker test file to right path 2026-02-19 18:44:28 +05:30
test_auth_utils.py test: add coverage for get_project_model_rpm/tpm_limit and check_complete_credentials 2026-04-17 19:38:13 -07:00
test_cli_auth.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_custom_auth_end_user_budget.py fix(auth): centralize common_checks to close authorization bypass 2026-04-23 00:04:42 +00:00
test_handle_jwt.py fix(proxy): single-team DB fallback when JWT has no team_id (#26418) 2026-04-24 17:51:42 -07:00
test_info_routes.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_litellm_license.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_login_utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_ip_filtering.py Return Clear error message why no tools are available / IP Filtering occured 2026-02-26 09:56:44 +05:30
test_model_checks_fallbacks.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_model_checks.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_multi_budget_windows.py feat: multiple concurrent budget windows per API key and team (#24883) (#25109) 2026-04-06 14:02:04 -07:00
test_object_permission_loading.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_onboarding.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_organization_budget_enforcement.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_password_hashing.py chore: fixes 2026-03-30 18:36:58 -07:00
test_route_checks.py [Fix] Restrict /global/spend/* routes to admin roles 2026-04-24 22:46:07 -07:00
test_team_member_budget.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_unmapped_model_budget_enforcement.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_user_api_key_auth.py fix: isolate per-fetch HTTPException in centralized common_checks gate 2026-04-25 09:58:23 -07:00