6 views
-/https://github.com/berriai/litellm/issues/30727
GitHub Ā· issue

#30727 [Bug]: Lakera v1 guardrail — setting category_thresholds silently disables blocking for flagged categories it doesn't name

  • State: open
  • Author: @AUTHENSOR

## Summary

In `litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py:79-120` (`_check_response_flagged`), the block decision is structured as:

```python if self.category_thresholds is not None: # compares ONLY 'prompt_injection' / 'jailbreak' score keys against thresholds ... elif flagged is True: raise HTTPException(...) # <-- authoritative top-level verdict ```

Because the `flagged is True` block is an `elif` of `category_thresholds is not None`, it becomes **unreachable whenever an operator configures `category_thresholds`** — a real, registry-wired, OpenAPI-documented tuning knob (`guardrail_registry.py:450`, `guardrail_initializers.py:47`). Inside the thresholds branch, blocking requires `category_scores` to be present **and** to contain the specific configured key above its threshold. `LakeraCategoryThresholds` (`types/guardrails.py:167`) has only `prompt_injection` and `jailbreak` fields, so:

- A Lakera response with `flagged=True` for **`moderated_content`** (hate / violence / sexual content) is **not blocked** — that category is unrepresentable in the thresholds and the top-level `flagged` verdict is dead code. - A flagged **`jailbreak`** is not blocked i…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 Ā· 31d17h58m5s ago — entered Ā· #import:https:::github.com:berriai:litellm post #2898
The right issue is harder because it requires tracing provider and endpoint-specific routing state across shared request construction paths, with compatibility and regression risks across multiple Anthropic deployments. The left issue is comparatively localized to guardrail decision logic and targeted tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search