mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(guardrails): reject requests that name an unregistered guardrail when reject_unregistered_guardrails is on
A request whose merged guardrails (request body, key, team, project, policy and model level) name a guardrail that is not registered on the proxy is served today with no guardrail and no error. With general_settings.reject_unregistered_guardrails: true, pre_call_hook now returns 400 naming the unregistered guardrails, including when no guardrails are registered at all. Off by default; skip_guardrails callers are not checked.
Resolves LIT-4787
* fix(guardrails): read every requested guardrail shape and a string "true" setting in the unregistered-guardrail check
The check skipped a metadata.guardrails value that was not a clean list of names, so an unregistered name in a {name: true} toggle map, a bare string, or a list with a non-name entry was still served unguarded, while the runtime does run registered names from those shapes. It now reads names from all of them. reject_unregistered_guardrails is parsed as a boolean the way fail_closed_rate_limit_enforcement is, so "true" turns it on and a non-boolean value logs a warning instead of being dropped silently.
* fix(guardrails): validate legacy toggles, policy steps, and A2A guardrails
* fix(a2a): validate agent guardrails before reserving rate limits
* test(guardrails): use raw strings for regex assertions
* fix(guardrails): validate selected fallback deployments before dispatch
* fix(router): keep guardrail validation imports proxy-scoped
|
||
|---|---|---|
| .. | ||
| core | ||
| __init__.py | ||
| test_enforce_model_rate_limits.py | ||
| test_io_token_rate_limits.py | ||
| test_router.py | ||
| test_router_callback_hook_sequence.py | ||
| test_router_endpoints.py | ||
| test_router_entry_points.py | ||
| test_router_facade.py | ||
| test_router_fallbacks.py | ||
| test_router_fuzz_regressions_rust_only.py | ||
| test_router_get_deployments.py | ||
| test_router_helper_utils.py | ||
| test_router_host.py | ||
| test_router_max_parallel_requests.py | ||
| test_router_provider_endpoints.py | ||
| test_router_retries.py | ||
| test_router_surface_check.py | ||
| test_router_timeout.py | ||
| test_router_vector_store_endpoints.py | ||