mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
Adds a new block_code_execution guardrail that detects markdown fenced code blocks in request/response content and blocks or masks them by language. Includes full UI integration, type definitions, compliance test dataset, and 26 unit tests. Key guardrail capabilities: - Regex-based fenced code block detection with configurable blocked languages - Confidence scoring with tunable threshold - Execution-intent heuristics (request-side only) with conflict resolution - Block or mask actions for detected code - Support for pre_call, post_call, and during_call event hooks Security hardening: - Response-side blocking skips intent heuristics (LLM output doesn't contain user intent phrases, so checking would silently disable post_call blocking) - No-execution short-circuit includes conflict resolution: if both no-execution and execution phrases match, execution intent wins - Tightened overly broad phrases to prevent trivial bypass - _normalize_escaped_newlines only applies to pure-escaped payloads to avoid corrupting content that discusses escape sequences Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| litellm-dashboard | ||