I built a prompt injection defense middleware for LLMs (Python/FastAPI) Developer Justin Noel released PromptShield, an open-source middleware for LLMs that detects and blocks prompt injection attacks using four defense layers. The tool, built with Python and FastAPI, claims 100% attack detection with zero false positives in benchmarks and includes features like API key authentication, rate limiting, and a dashboard UI. Production-grade LLM prompt injection defense middleware. PromptShield sits between your users and your AI model, detecting and blocking adversarial attacks before they cause damage. PromptShield runs every user input through 4 layers of defense: | Layer | Name | What It Does | |---|---|---| | 1 | Input Classifier | Detects malicious prompt patterns | | 2 | Context Sanitizer | Strips injected instructions from user input | | 3 | Prompt Integrity Checker | Validates prompt structure hasn't been tampered with | | 4 | Output Monitor | Scans AI responses for signs of successful injection | - ✅ 100% attack detection, zero false positives benchmark tested - ⚙️ Tunable aggression dial — permissive → balanced → strict → paranoid - 🔑 API key authentication + rate limiting - 📊 Audit logging and dashboard UI - 🐍 Python SDK for easy integration - 🐳 Docker support git clone https://github.com/JustiNoel/LLM-Prompt-Injection.git cd LLM-Prompt-Injection docker-compose up Python · FastAPI · Google Gemini · Docker Built by Justin Noel https://github.com/JustiNoel