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
|
||
|---|---|---|
| .. | ||
| guardrail_hooks | ||
| __init__.py | ||
| test_anthropic_sse.py | ||
| test_auto_router_compression.py | ||
| test_content_filter_path_traversal.py | ||
| test_content_utils.py | ||
| test_custom_code_security.py | ||
| test_deferred_guardrail_logging.py | ||
| test_endpoint_image_scan.py | ||
| test_guardrail_coverage.py | ||
| test_guardrail_endpoints.py | ||
| test_guardrail_helpers.py | ||
| test_guardrail_initializers.py | ||
| test_guardrail_load_balancing.py | ||
| test_guardrail_registry.py | ||
| test_init_guardrails.py | ||
| test_llm_as_a_judge.py | ||
| test_mcp_jwt_signer.py | ||
| test_pillar_guardrails.py | ||
| test_prompt_security_guardrails.py | ||
| test_qostodian_nexus_guardrail.py | ||
| test_usage_endpoints.py | ||
| test_usage_tracking.py | ||