text
[Channel Input] → [INPUT FILTER] → [Agent/Model] → [OUTPUT FILTER] → [Channel Output]
↓ ↓
┌─────────────┐ ┌──────────────┐
│ Block List │ │ Secret Scan │
│ Pattern DB │ │ PII Redact │
│ Rate Limit │ │ Path Scrub │
│ Encoding Det│ │ URL Checker │
└─────────────┘ └──────────────┘
#FilterDescription1Injection patternsRegex + heuristic match for "ignore previous", "you are now", role confusion2Unicode sanitizerStrip zero-width chars, control characters, RTL overrides3Encoding detectorDetect Base64, hex, ROT13 encoded payloads in user messages4Role confusionDetect fake system messages, assistant impersonation5Rate limiterMax messages per user per channel per minute6Size limiterReject inputs exceeding token budget
#FilterDescription1Secret scannerHigh-entropy strings + known patterns (AWS key, GitHub token)2PII redactorEmail, phone, SSN, credit card → [REDACTED]3Path scrubberRemove internal filesystem paths from outputs4URL checkerBlock responses containing known malicious URLs5Consistency checkVerify output doesn't contradict system prompt directives
yaml
# .security/firewall-rules.yaml
input:
injection_patterns:
- pattern: "ignore (all )?previous instructions"
action: BLOCK
severity: CRITICAL
- pattern: "you are now (?!helping)"
action: BLOCK
severity: HIGH
rate_limit:
max_per_minute: 30
max_per_hour: 500
max_input_tokens: 4096
output:
secret_patterns:
- name: aws_key
pattern: "AKIA[0-9A-Z]{16}"
action: REDACT
- name: github_token
pattern: "gh[ps]_[A-Za-z0-9_]{36,}"
action: REDACT
pii_redaction: true
path_scrubbing: true