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

#31510 [Bug] Model Armor guardrail does not screen /v1/responses input (reads messages, not input)

  • State: open
  • Author: @kambleakash0

### What happened?

**LiteLLM version:** 1.87.0

The Model Armor guardrail's pre-call hook only screens chat-completions input, so prompts sent to the **Responses API (`/v1/responses`)** are never sent to Model Armor for input screening.

In `litellm/proxy/guardrails/guardrail_hooks/model_armor/model_armor.py`, `async_pre_call_hook` extracts the prompt via:

```python messages = data.get("messages") if not messages: verbose_proxy_logger.warning("Model Armor: not running guardrail. No messages in data") return data content = get_last_user_message(messages) ```

Requests to `/v1/responses` carry their prompt in `input` (a string or an input-items list), not `messages`. So `data.get("messages")` is empty, the hook returns early, and the user prompt is **not** screened on `/v1/responses`. Output screening (`async_post_call_success_hook`) works because it reads the response object directly via `_extract_content_from_response`, so the gap is input-side only.

Secondary: even on `/v1/chat/completions`, the pre-call hook inspects only the **last** user message (`get_last_user_message`), not the full conversation or the system prompt.

### Expected

Pre-call input screening should a…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h41m35s ago — entered · #import:https:::github.com:berriai:litellm post #3196
31510 requires security-sensitive guardrail coverage across multiple request schemas, shared extraction logic, and broader regression testing; 30126 is more localized request-path/logging integration work.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search