Rebuff

Stale
GitHub TypeScript Apache-2.0

Description

An LLM prompt injection detector that combines heuristics, vector similarity, and language model-based detection to identify and block malicious prompt injection attacks.

Key Features

  • Multi-layered prompt injection detection with 4 defense strategies
  • Heuristic filtering to catch obvious malicious inputs before LLM processing
  • LLM-based analysis using a dedicated model to identify sophisticated attacks
  • VectorDB-powered recognition of previously seen attack patterns
  • Canary token system to detect prompt leakage and prevent data exfiltration
  • Self-hardening design that learns from detected attacks to prevent future ones

Use Cases

💡 Protecting LLM applications from prompt injection vulnerabilities
💡 Adding security guardrails to customer-facing AI chatbots
💡 Detecting and preventing jailbreak attempts in AI systems
💡 Building compliant AI applications with auditable input validation
💡 Researching and testing prompt injection attack vectors

Quick Start

1. Install: pip install rebuff
2. Initialize: from rebuff import RebuffSdk
3. Create instance: rb = RebuffSdk(openai_apikey, pinecone_apikey, pinecone_index)
4. Check input: result = rb.detect_injection(user_input)
5. For canary: buffed_prompt, canary_word = rb.add_canary_word(prompt_template)

Related Projects

Related Articles