Rebuff is an open-source LLM prompt injection detector designed to protect AI applications from prompt injection attacks through multiple layers of defense. The project is maintained by protectai, and the code is hosted on GitHub.
Purpose: Rebuff is used to detect and defend against prompt injection attacks targeting large language models (LLMs), helping developers improve the security of AI applications.
Main capabilities: Rebuff provides a four-layer defense mechanism: 1. Heuristics: filter out potentially malicious input before it reaches the LLM; 2. LLM-based detection: use a dedicated LLM to analyze incoming prompts and identify potential attacks; 3. Vector database: store embeddings of previous attacks in a vector database to identify and prevent similar future attacks; 4. Canary tokens: add canary tokens to prompts to detect leakage, allowing the framework to store embeddings of incoming prompts in a vector database and prevent future attacks. In addition, Rebuff also supports prompt injection detection, canary word leakage detection, attack signature learning, a JavaScript/TypeScript SDK, a Python SDK (feature parity with the TS SDK), local-only mode, user-defined detection policies, and heuristics for adversarial suffixes.
How to use: Rebuff provides Python and JavaScript/TypeScript SDKs, and developers can integrate them into their own AI applications. To self-host the Rebuff Playground, you need to set up the necessary providers, such as Supabase, OpenAI, and a vector database (Pinecone or Chroma). After setup is complete, you need to create the relevant SQL and vector databases on Supabase and Pinecone respectively. Then use npm to start the Rebuff server. Create a .env.local file in the server directory and add the environment variables, install the packages, and run the server. The server runs by default on http://localhost:3000。服务器配置中有一个 the BILLING_RATE_INT_10K parameter, which is used to set the number of credits deducted per request.
Use cases: Rebuff is suitable for developers and organizations that need to protect LLM applications from prompt injection attacks, especially teams building chatbots, AI assistants, or other interactive applications based on LLMs.
Limitations: Rebuff is still a prototype and cannot provide 100% protection. The project documentation clearly states that it cannot fully defend against prompt injection attacks. In addition, self-hosting requires configuring multiple external services (such as Supabase, OpenAI, Pinecone, or Chroma), which may increase deployment complexity.