Prompt Injection Defense System

U

@

·

Design a multi-layer prompt injection defense system with input sanitization, prompt structure hardening, output validation, and attack monitoring.

82 copies0 forks
Design a defense system against prompt injection attacks.

## Application Context
{{application_context}}

## User Input Sources
{{input_sources}}

## Risk Tolerance
{{risk_tolerance}}

Implement layered defenses:

**Layer 1: Input Sanitization**
- Pattern matching for known attacks
- Unicode normalization
- Special character handling

**Layer 2: Prompt Structure**
- Input/instruction separation
- Privileged context isolation
- Output format constraints

**Layer 3: Output Validation**
- Response anomaly detection
- Sensitive data leakage prevention
- Action verification

**Layer 4: Monitoring**
- Attack attempt logging
- Behavioral anomaly detection
- Incident response triggers

Provide:
- Implementation code for each layer
- Testing methodology
- False positive management

Details

Category

Coding

Use Cases

Security hardeningPrompt injection defenseInput validation

Works Best With

claude-sonnet-4-20250514gpt-4o
Created Shared

Create your own prompt vault and start sharing