Consumer
Protect customer data, deter abuse, screen content and verify consent in public-facing AI services.
What it checks
| Policy | On | Checks | Action |
|---|---|---|---|
| prompt-injection | Request | 4 attack patterns; similarity threshold 0.76 | Block |
| bot-detector | Request | More than 8 similar requests in 60 seconds; similarity ≥ 0.94 | Block |
| pii-detector | Request | Payment-card data (PCI mode); 4 custom identifier patterns | Redact |
| dlp-filter | Request | 5 blocked terms such as “full card number” and “password reset token”; 4 custom patterns; near-miss spellings | Redact |
| safety-filter | Request | Built-in education patterns; 7 extra blocked phrases such as “self-harm” and “suicide”; near-miss spellings | Block |
| gdpr-compliance | Request | Requires the X-User-Consent-Token header | Block |
| quality-scorer | Response | Accuracy ≥ 0.76; relevancy ≥ 0.80; combined score ≥ 0.78; at least 120 characters and 2 sentences | Fallback |
| audit-logger | Request | Adds an allow-only audit marker to the decision | Record |
Rate limit: 900 requests per minute across all gateway replicas.
Policy YAML
pack:
id: "cfg_demo_consumer"
name: "demo-consumer-trust"
version: "0.2.0"
enabled: true
author: "local"
description: "Consumer AI starter with abuse controls, privacy minimization, and consent-aware response quality"
# Public-facing assistants receive bursty traffic, so limits should stay consistent across replicas.
distributed_rate_limit:
backend: valkey
url_env: VERDICTAN_REDIS_URL
global_rate_limit:
max_requests: 900
window_seconds: 60
# The current schema-safe way to avoid raw retention is metadata-only history capture with blocked-event visibility.
history:
capture:
enabled: true
mode: metadata_only
include_blocked: true
fail_open: true
policies:
chain: [prompt-injection, bot-detector, pii-detector, dlp-filter, safety-filter, gdpr-compliance, quality-scorer, audit-logger]
policy:
# Attackers often try to override refund or checkout rules, so request-boundary defense comes first.
prompt-injection:
embedding_threshold: 0.76
attack_patterns: ["ignore.*store.*policy", "override.*refund.*rules", "reveal.*internal.*prompt", "bypass.*checkout.*restriction"]
encoding: {decode_base64: true, normalize_unicode: true, detect_homoglyphs: true}
boundaries: {enforce_delimiters: true, reject_fake_boundaries: true}
# Fingerprinting helps distinguish scripted traffic from genuine customers before abuse drives cost or latency.
bot-detector:
fingerprint_fields: [user-agent, x-forwarded-for, body, model]
profile_window_seconds: 60
similarity_threshold: 0.94
max_requests_per_window: 8
action: block
# Redact customer and payment identifiers rather than forcing users to restate their issue.
pii-detector:
action: redact
pci_mode: true
detect_patterns: ['(?i)\b(?:order|return|ticket)\s*#?\s*[0-9]{6,12}\b', '(?i)\b(?:customer|member|loyalty)\s*(?:id|number)?\s*[:#-]?\s*[A-Z0-9]{6,14}\b', '(?i)\b(?:gift\s*card|payment\s*token)\s*[:#-]?\s*[A-Z0-9_-]{8,32}\b', '(?i)\b(?:shipment|tracking)\s*[:#-]?\s*[A-Z0-9]{8,24}\b']
redaction:
marker_format: label
include_metadata: true
custom_markers: {generic_id: "[REDACTED-CUSTOMER-ID]"}
# Customer-service prompts often include order and auth artifacts that should be minimized before provider transit.
dlp-filter:
detect_patterns: ['(?i)\bORD-[0-9]{8,12}\b', '(?i)\bCUST-[A-Z0-9]{6,12}\b', '(?i)\b(?:session|reset|auth)[_-]?token\b\s*[:=]?\s*[A-Za-z0-9._-]{12,}\b', '(?i)\b(?:gift\s*card\s*pin|otp)\b\s*[:=]?\s*[0-9]{4,8}\b']
blocked_terms: ["full card number", "password reset token", "government id upload", "complete purchase history export", "customer support backoffice password"]
action: redact
fuzzy_matching: true
max_distance: 1
# Consumer experiences must not amplify harmful, abusive, or fraudulent instructions.
safety-filter:
mode: education
block_if: ["self-harm", "suicide", "violent threat", "illegal drug instructions", "phishing kit", "refund fraud", "sexual content involving minors"]
action: block
fuzzy_matching: true
max_distance: 1
# Consent gating and erasure-request detection matter when personalization depends on lawful basis across multiple jurisdictions.
gdpr-compliance:
consent_required: true
consent_header: X-User-Consent-Token
data_categories: [personal, contact, behavioral, payment]
# Consumer assistants need a moderate quality floor so answers stay useful without over-blocking support volume.
quality-scorer:
min_output_chars: 120
min_sentences: 2
thresholds: {min_aggregate: 0.78, min_relevancy: 0.80, min_accuracy: 0.76}
weights: {relevancy: 0.6, accuracy: 0.4}
failure_action:
action: fallback
fallback_message: "Sorry, I could not produce a safe and reliable customer response. Please retry or route this case to human support."
industry_profiles: {consumer: {min_aggregate: 0.78, min_relevancy: 0.80, min_accuracy: 0.76}}
# Keep the audit marker active so privacy, fraud, and safety decisions stay visible in downstream reviews.
audit-logger: {}