16 views
-/https://github.com/berriai/litellm/issues/19499
GitHub · issue

#19499 [Bug]: Prompt Injection Detection Issues

  • State: open
  • Author: @ianmuge
  • Labels: bug, proxy

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Summary

The built-in prompt injection detection feature has two critical bugs: 1. **Heuristics check blocks the event loop**, causing pod restarts in Kubernetes, given that you are running with the default number of workers, which is 1 2. **LLM API check never executes** due to incorrect class inheritance

## Problem 1: Heuristics Check Blocks Event Loop

### Issue When `heuristics_check: true` is enabled, the synchronous similarity calculation in `check_user_input_similarity()` blocks the entire FastAPI event loop, preventing health check endpoints from responding.

### Location `litellm/proxy/hooks/prompt_injection_detection.py:113-137`

### Code ```python async def async_pre_call_hook(self, ...): if self.prompt_injection_params.heuristics_check is True: # This is a BLOCKING synchronous call inside an async function is_prompt_attack = self.check_user_input_similarity( user_input=formatted_prompt )

def check_user_input_similarity(self, user_input: str, ...): # Triple nested loop with O(n*m) Sequ…

GitHub resolver

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

Refresh page
vote history (3 events)
#0 of 0 · 31d18h57m35s ago — entered · #import:https:::github.com:berriai:litellm post #2009
19499 spans asynchronous execution, algorithmic performance, hook inheritance, and security-sensitive behavior, requiring broader investigation and regression testing. 30126 is more likely a localized proxy-route observability integration fix.
The left issue requires cross-layer API and provider integration, including request-shape changes, multipart/input handling, backward compatibility, and end-to-end coverage. The right issue is comparatively localized to hook execution and class wiring, with a narrower implementation and testing surface.
#0 of 0 · 31d18h28m24s ago — current · #import:https:::github.com:berriai:litellm post #2477
19499 requires coordinated fixes across asynchronous execution, control flow, and validation of the detection pipeline, with greater concurrency and regression risk. 24057 is comparatively contained to telemetry attribute serialization and compatibility handling.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search