litellm/tests/test_litellm/proxy/auth/v2
ryan-crabbe-berri 7f84db33ab
Some checks failed
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled
fix(proxy): address greptile review - JWKS cache, model-less inference, policy-admin auth
Three P1 defects from the auth_v2 review, plus the policy-admin flag guard:

- JWKS cache was dead: JWKSProvider was rebuilt per request, so its TTL cache
  never survived and every JWT auth refetched the JWKS over the network. Providers
  are now cached per jwks_uri at module level.
- Inference with no model bypassed casbin: a body omitting "model" skipped the
  call check entirely, so a subject with no grants could reach inference. Now a
  model-less inference request is denied up front (before any enrichment/budget).
- Policy-admin endpoints used a v1 _require_admin role check that rejected
  JWT/OAuth2 admins casbin had already authorized. Removed it - the routes are in
  the casbin route map (policy read/write/delete), so user_api_key_auth enforces
  them - and added a per-request flag guard so the unconditionally-registered
  router 404s when auth_v2 is off.

Regression tests for each. mypy clean on 23 files, 143 tests green.
2026-06-06 23:31:13 -07:00
..
authn fix(proxy): address greptile review - JWKS cache, model-less inference, policy-admin auth 2026-06-06 23:31:13 -07:00
authz refactor(proxy): group auth_v2 into authn/authz/stages subpackages 2026-06-05 12:25:11 -07:00
stages refactor(proxy): group auth_v2 into authn/authz/stages subpackages 2026-06-05 12:25:11 -07:00
test_audit.py feat(proxy): auth_v2 decision audit trail 2026-06-05 15:15:50 -07:00
test_budget_enforcement.py test(proxy): verify auth_v2 budget enforcement on an enriched identity 2026-06-05 11:59:36 -07:00
test_context.py feat(proxy): typed RequestAuthContext - the auth_v2 contract for downstream stages 2026-06-05 10:18:22 -07:00
test_integration_flow.py fix(proxy): address greptile review - JWKS cache, model-less inference, policy-admin auth 2026-06-06 23:31:13 -07:00
test_management_endpoints.py fix(proxy): address greptile review - JWKS cache, model-less inference, policy-admin auth 2026-06-06 23:31:13 -07:00
test_metrics.py feat(proxy): auth_v2 authz observability metrics 2026-06-05 15:20:58 -07:00
test_principal.py refactor(proxy): fully type auth_v2 - eliminate every avoidable Any 2026-06-05 15:11:13 -07:00