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

#33086 [Bug]: Bedrock guardrail native hooks don't scan Anthropic tool_result content blocks

  • State: open
  • Author: @bricelalu
  • Labels: proxy, llm translation

#### What happened?

`aws-bedrock-guardrails`' native proxy hooks (`async_pre_call_hook` / `async_moderation_hook` in `litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py`) silently skip PII/content scanning for Anthropic `tool_result` content blocks on live proxy traffic.

This is distinct from #29593 / #29594: those fix the same class of bug in the *Generic Guardrail API* translation layer (`litellm/llms/anthropic/chat/guardrail_translation/handler.py`), used by presidio/lakera/aim and by Bedrock's `/guardrails/apply_guardrail` testing endpoint. `BedrockGuardrail` sets `use_native_during_call_hook = True`, so its live `async_pre_call_hook`/`async_moderation_hook` path never goes through that translation layer at all — it has its own independent extraction logic with the identical bug, untouched by #29594.

#### Root cause

In `get_content_items_for_message` (`litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py`), list-content items are only recognized as text if they carry a top-level `"text"` key:

```python elif isinstance(content, list): for item in content: if isinstance(item, dict) and "text" in item: ... ```

An Anthropic `tool_…

GitHub resolver

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

Refresh page
vote history (2 events)
#0 of 0 · 31d18h50m36s ago — entered · #import:https:::github.com:berriai:litellm post #2029
The right issue is harder because it adds provider-specific structured-output support across Bedrock request transformation, model capability detection, compatibility handling, and regression coverage, whereas the left is a localized extraction fix with comparatively limited behavioral scope.
#0 of 0 · 31d18h44m41s ago — current · #import:https:::github.com:berriai:litellm post #2131
Issue 33086 is harder because it spans proxy hook behavior, provider-specific content normalization, security-sensitive scanning, and regression coverage across multiple request shapes. Issue 34301 is comparatively localized to model capability metadata and parameter-validation rules.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search