Observed since 20 Oct, 21:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Production-ready security layer for AI applications
A production-ready security layer for AI applications that prevents prompt injection, data exfiltration, and policy violations.
Companies deploying LLMs face critical security risks:
LLM Security Firewall sits between your application and AI providers, providing:
✅ Real-time Threat Detection - Block attacks before they reach the AI ✅ Content Filtering - Redact sensitive data in requests and responses ✅ Policy Enforcement - Define and enforce usage policies ✅ Complete Audit Logs - Track every interaction for compliance ✅ Cost Control - Rate limiting and budget management ✅ Multi-Provider Support - Works with OpenAI, Anthropic, Azure, local models
pip install llm-security-firewall
from llm_firewall import LLMFirewall, FirewallConfig
# Initialize firewall
config = FirewallConfig(
providers=["openai", "anthropic"],
enable_prompt_injection_detection=True,
enable_pii_redaction=True,
enable_audit_logging=True,
)
firewall = LLMFirewall(config)
# Protect your LLM calls
async with firewall.protect() as session:
response = await session.chat(
provider="openai",
model="gpt-4",
messages=[{"role": "user", "content": user_input}]
)
# Firewall automatically:
# - Scans for prompt injection
# - Redacts PII
# - Logs the interaction
# - Enforces rate limits
# - Returns safe response
from fastapi import FastAPI
from llm_firewall.middleware import LLMFirewallMiddleware
app = FastAPI()
# Add firewall middleware
app.add_middleware(
LLMFirewallMiddleware,
config=config,
api_key_header="X-API-Key",
)
@app.post("/api/chat")
async def chat(request: ChatRequest):
# Requests automatically protected by firewall
return await llm_client.chat(request)
# Start proxy server
llm-firewall-proxy --config config.yaml --port 8080
# Point your LLM SDK at the proxy
export OPENAI_BASE_URL=http://localhost:8080/openai
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
Prompt Injection Detection
Jailbreak Prevention
Data Exfiltration Protection
PII Redaction
Response Filtering
Data Loss Prevention (DLP)
Access Control
Cost Management
Compliance
Audit Logging
Real-time Monitoring
Analytics
┌─────────────────┐
│ Application │
└────────┬────────┘
│
┌────▼────────────────────────────────────────┐
│ LLM Security Firewall │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Input Protection Layer │ │
│ │ • Prompt Injection Detection │ │
│ │ • PII Redaction │ │
│ │ • Request Validation │ │
│ └──────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Policy Engine │ │
│ │ • Access Control │ │
│ │ • Rate Limiting │ │
│ │ • Cost Management │ │
│ └──────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Output Protection Layer │ │
│ │ • Response Scanning │ │
│ │ • Content Filtering │ │
│ │ • Data Redaction │ │
│ └──────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Audit & Monitoring │ │
│ │ • Event Logging │ │
│ │ • Metrics Collection │ │
│ │ • Alert Management │ │
│ └──────────────────────────────────────┘ │
└────────┬────────────────────────────────────┘
│
┌────────▼────────┐
│ AI Providers │
│ • OpenAI │
│ • Anthropic │
│ • Azure │
│ • Local LLMs │
└─────────────────┘
# config.yaml
firewall:
# Detection settings
detection:
prompt_injection:
enabled: true
threshold: 0.7 # 70% confidence
action: block # or 'warn'
jailbreak:
enabled: true
patterns:
- "ignore previous instructions"
- "pretend you are"
- "act as if"
data_exfiltration:
enabled: true
sensitive_keywords:
- "api key"
- "password"
- "secret"
# Content filtering
content:
pii_redaction:
enabled: true
types:
- email
- phone
- ssn
- credit_card
response_filtering:
enabled: true
block_patterns:
- r"\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b"
# Policy engine
policy:
rate_limiting:
enabled: true
limits:
default: 100/hour
premium: 1000/hour
cost_management:
enabled: true
budget_limits:
daily: 100.00
monthly: 2000.00
access_control:
allowed_models:
- gpt-4
- gpt-4-turbo
- claude-3-sonnet
# Logging & monitoring
logging:
audit_log:
enabled: true
destination: postgresql
retention_days: 90
alerts:
webhook_url: https://hooks.slack.com/services/YOUR/WEBHOOK
alert_on:
- high_risk_threat
- policy_violation
- budget_exceeded
# Provider API keys
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
# Firewall settings
export LLM_FIREWALL_CONFIG=config.yaml
export LLM_FIREWALL_LOG_LEVEL=INFO
export LLM_FIREWALL_DATABASE_URL=postgresql://localhost/firewall
# Security
export LLM_FIREWALL_SECRET_KEY=your-secret-key
export LLM_FIREWALL_ENCRYPTION_KEY=your-encryption-key
# Protect customer-facing chatbot
firewall = LLMFirewall(config)
@app.post("/api/chat")
async def chat(message: str, user_id: str):
# Enforce per-user rate limits
# Block prompt injection
# Redact PII from user messages
# Log all interactions for compliance
async with firewall.protect(user_id=user_id) as session:
return await session.chat(
provider="anthropic",
model="claude-3-sonnet",
messages=[{"role": "user", "content": message}]
)
# Protect code generation assistant
config = FirewallConfig(
enable_prompt_injection_detection=True,
enable_code_safety_analysis=True, # Scan generated code
enable_cost_tracking=True,
cost_alerts={
"daily": 50.00,
"per_request": 0.50,
}
)
firewall = LLMFirewall(config)
# Protect retrieval-augmented generation
async with firewall.protect() as session:
# Prevent prompt injection in retrieved documents
# Block attempts to extract training data
# Redact sensitive data from vector DB results
results = vector_db.search(query)
response = await session.chat(
provider="openai",
model="gpt-4",
messages=[
{"role": "system", "content": "Use these docs: " + results},
{"role": "user", "content": user_query}
]
)
# Pull image
docker pull llmsecurity/firewall:latest
# Run as proxy
docker run -p 8080:8080 \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-v $(pwd)/config.yaml:/app/config.yaml \
llmsecurity/firewall:latest
apiVersion: apps/v1
kind: Deployment
metadata:
name: llm-firewall
spec:
replicas: 3
template:
spec:
containers:
- name: firewall
image: llmsecurity/firewall:latest
env:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: llm-api-keys
key: openai
ports:
- containerPort: 8080
# lambda_handler.py
from llm_firewall import LLMFirewall, FirewallConfig
config = FirewallConfig.from_env()
firewall = LLMFirewall(config)
def lambda_handler(event, context):
user_input = event['body']['message']
async with firewall.protect() as session:
response = await session.chat(
provider="openai",
model="gpt-4",
messages=[{"role": "user", "content": user_input}]
)
return {"statusCode": 200, "body": response}
Latency Overhead:
Throughput:
Resource Usage:
Starter: $99/month
Professional: $499/month
Enterprise: Custom pricing
We welcome contributions! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
Built with ❤️ for secure AI deployments
Proudly part of the AfterDark Security ecosystem
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 12 Jan 2026 | 16 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 21:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:067ce45c6a4132b79c0e350ed720dd49c4afe7e58d0dbd33859f87417ec3e6f1