mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(guardrails): opt-in pre_call scan of tool descriptions as text for PANW and Presidio PANW Prisma AIRS and Presidio only scan text, so the tools[] sent to the model reached it unscanned. The new per-guardrail scan_tool_descriptions_as_text flag scans every description string in tools[] on pre_call, one guardrail call per tool, so a block returns 400 and a mask rewrites the description in place. Other guardrails are unchanged and reject the flag at startup. Resolves LIT-8384 * fix(guardrails): also scan legacy functions[] descriptions as text With scan_tool_descriptions_as_text on, a Chat Completions client could move a tool definition into the legacy functions[] list and skip the scan. The scan now covers both tools[] and functions[], writing masks back to whichever field held the definition. Test helpers are now fully typed. * test(guardrails): cover untouched tools through PANW instead of patching Presidio The Presidio case replaced a private session method. Its one unique check, that a tool without a flagged description is sent unchanged, now runs through PANW's injected HTTP client. Real Presidio is covered by the live proof in the PR. * chore(ui): regenerate OpenAPI snapshot and UI types for scan_tool_descriptions_as_text * refactor(guardrails): return tool-scan failures as values and raise them in one place An over-deep tool definition and a guardrail that returns the wrong number of descriptions now come back as _ToolNotScanned values, and _raise_public maps them to the existing 400 body, as endpoint_image_scan does. Adds tests for both paths. * fix(guardrails): scan tool descriptions carried in Responses additional_tools and tool_search_output input items Tool definitions sent inside /v1/responses input items reach the model the same way top-level tools do, through the chat bridge hoist or native forwarding, but the opt-in pre_call scan only read the top-level tools and functions lists. Each tool is now located by its path in the request and masked text is written back at that path. * chore(guardrails): drop docstrings that restate the tool-description scan code |
||
|---|---|---|
| .. | ||
| 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 | ||