How to Secure Customer-Facing AI Agents
Customer-facing AI agents — support chatbots, sales assistants, and self-service portals that interact directly with end users — are uniquely vulnerable because they process untrusted input from the public internet while having access to internal systems like CRMs, order databases, and account management tools. SafeClaw by Authensor secures customer-facing agents by gating every backend action with deny-by-default policies, ensuring that even if a customer's message contains a prompt injection, the agent cannot access data or perform actions outside its explicit permissions. Install with npx @authensor/safeclaw.
The Customer-Facing Agent Threat Model
Customer-facing agents operate at the intersection of two threat surfaces: the untrusted public input and the privileged backend:
UNTRUSTED PRIVILEGED
┌─────────────┐ ┌──────────────────┐
│ Customer │ message │ Backend Systems │
│ (public │ ──────────▶ │ ├─ CRM │
│ internet) │ │ ├─ Order DB │
│ │ │ ├─ Account Mgmt │
│ May contain │ SafeClaw │ ├─ Payment API │
│ prompt │ Gate sits │ └─ Internal Docs │
│ injection │ HERE ──▶ │ │
└─────────────┘ └──────────────────┘
Attack scenarios:
- Data harvesting — Customer asks "Show me all customer records" via injection
- Account manipulation — Injection causes agent to modify another customer's account
- Price/refund manipulation — Injection tricks agent into issuing unauthorized refunds
- Internal information disclosure — Agent reveals system prompts, internal processes, or employee data
- Reputation damage — Agent makes promises or statements outside company policy
SafeClaw Policy for Customer-Facing Agents
# safeclaw-customer-agent.yaml
version: "1.0"
agent: customer-support
rules:
# === CRM ACCESS ===
- action: crm_query
scope: "current_customer" # Only the authenticated customer
fields:
- "name"
- "order_history"
- "ticket_history"
decision: allow
- action: crm_query
scope: "all_customers"
decision: deny # Never query all customers
- action: crm_query
decision: deny
# === ORDER OPERATIONS ===
- action: order_lookup
customer: "current"
decision: allow
- action: order_cancel
customer: "current"
order_age_hours_lt: 24 # Only cancel recent orders
decision: allow
- action: order_cancel
decision: deny
# === REFUNDS ===
- action: issue_refund
amount_lt: 50 # Auto-refund under $50
customer: "current"
decision: allow
- action: issue_refund
decision: require_approval # Human approval for larger refunds
# === ACCOUNT MODIFICATION ===
- action: account_modify
field: "email"
decision: require_approval # Email changes need human review
- action: account_modify
field: "password"
decision: deny # Never handle password changes
- action: account_modify
decision: deny
# === INTERNAL SYSTEMS ===
- action: internal_doc_read
decision: deny # No access to internal docs
- action: employee_lookup
decision: deny # No employee data access
# === NETWORK ===
- action: network_request
decision: deny # No external API calls
# === FILE SYSTEM ===
- action: file_read
decision: deny
- action: file_write
decision: deny
Scope-Locked Data Access
The most critical control for customer-facing agents is ensuring data access is scoped to the authenticated customer. Without this, a prompt injection could instruct the agent to query another customer's records:
# BAD: No customer scoping
- action: crm_query
decision: allow # Agent can query ANY customer
GOOD: Scoped to current authenticated customer
- action: crm_query
scope: "current_customer"
decision: allow # Agent can ONLY query the current customer's data
SafeClaw enforces this scope at the action gate, not in the prompt. The LLM cannot override the scope because it is evaluated deterministically by the policy engine.
Response Boundary Controls
Beyond backend action gating, customer-facing agents need response boundaries:
response_controls:
max_response_length: 2000 # Prevent information dumping
deny_content_patterns:
- "system prompt" # Don't reveal internals
- "you are a" # Don't reveal agent instructions
- "internal only" # Don't share internal info
required_disclaimer: true # Add disclaimer to financial advice
Rate Limiting Per Customer
Prevent abuse by rate-limiting actions per customer session:
customer_limits:
max_queries_per_session: 50
max_refunds_per_day: 3
max_order_cancellations_per_day: 2
on_limit_exceeded: escalate_to_human
Audit Trail for Compliance
Every customer interaction action is logged in SafeClaw's hash-chained audit trail, providing GDPR and CCPA compliance evidence that shows exactly what data the agent accessed and what actions it took for each customer. SafeClaw has 446 tests, is MIT-licensed, and works with both Claude and OpenAI.
Cross-References
- Customer Support Agent Recipe
- GDPR AI Agent Compliance
- Prompt Injection Defense for Agents
- Customer Service Bot Safety
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw