DocumentationAgent Action Firewall

Data Loss Prevention (DLP)

Agent Action Firewall includes built-in DLP capabilities to detect, mask, or block sensitive data in agent actions before it reaches external systems.

How DLP Works

  1. Every action payload is scanned before policy evaluation
  2. Built-in and custom patterns detect sensitive data
  3. Configurable actions: mask, block, or flag

Built-in Detectors

DetectorPatternExample Match
SSN (US)\d{3}-\d{2}-\d{4}123-45-6789
Credit CardLuhn-validated 13-19 digits4111-1111-1111-1111
Email AddressRFC 5322 compliantuser@example.com
Phone (US)(\d{3}) \d{3}-\d{4}(555) 123-4567
API KeyCommon formatssk_live_xxx, AKIA...
AWS Secret40-char base64aws_secret_access_key
Private KeyPEM format-----BEGIN RSA PRIVATE KEY-----
JWTBase64.Base64.Base64eyJhbG...

Configuration

Organization-Level Settings

await api.put('/dlp/settings', {
  enabled: true,
  default_action: 'mask', // 'mask' | 'block' | 'flag'
  detectors: {
    ssn: { enabled: true, action: 'block' },
    credit_card: { enabled: true, action: 'mask' },
    email: { enabled: true, action: 'flag' },
    api_key: { enabled: true, action: 'block' }
  }
});

Per-Policy Overrides

# Override DLP for specific actions
dlp_config = {
  "enabled": false
} {
  # Disable DLP for internal analytics pipeline
  input.action.tool == "http_proxy"
  contains(input.action.params.url, "internal-analytics.example.com")
}

Custom Patterns

Define organization-specific patterns:

await api.post('/dlp/patterns', {
  name: 'employee_id',
  description: 'Internal employee ID format',
  pattern: 'EMP-[A-Z]{2}\\d{6}',
  action: 'flag',
  severity: 'medium',
  examples: ['EMP-AB123456', 'EMP-XY789012']
});

Pattern Testing

Test patterns before deploying:

POST /api/v1/dlp/test
{
  "pattern": "EMP-[A-Z]{2}\\d{6}",
  "test_data": "Contact employee EMP-AB123456 for details"
}

# Response
{
  "matches": [
    {
      "value": "EMP-AB123456",
      "start": 17,
      "end": 29
    }
  ]
}

Masking Strategies

StrategyBeforeAfter
Full4111111111111111****************
Last44111111111111111************1111
First6Last44111111111111111411111******1111
Hashsecret123sha256:abc123...
RedactMy SSN is 123-45-6789My SSN is [REDACTED]

Configure per detector:

await api.put('/dlp/detectors/credit_card', {
  action: 'mask',
  mask_strategy: 'last4',
  audit_original: true // Store original in audit (encrypted)
});

DLP Events

All detections are logged:

{
  "event_type": "dlp.detected",
  "timestamp": "2024-01-15T10:30:00Z",
  "action_request_id": "act-456",
  "detections": [
    {
      "detector": "credit_card",
      "field": "params.body.payment_info",
      "action_taken": "mask",
      "masked_value": "************4242"
    }
  ]
}

Allowlists

Exclude known-safe values:

await api.post('/dlp/allowlist', {
  detector: 'email',
  values: [
    'noreply@example.com',
    'support@example.com'
  ],
  reason: 'Internal service accounts'
});

// Or pattern-based allowlist
await api.post('/dlp/allowlist', {
  detector: 'api_key',
  patterns: [
    '^test_.*',  // Test keys
    '^pk_test_' // Stripe test keys
  ],
  reason: 'Test/development keys'
});

Scanning Locations

DLP scans these locations by default:

LocationScanned
params.bodyYes
params.headersYes (sensitive headers only)
params.urlYes (query strings)
contextNo (user metadata)

Configure custom scan locations:

await api.put('/dlp/settings', {
  scan_locations: [
    'params.body',
    'params.headers.Authorization',
    'params.query',
    'context.user_data' // Enable scanning context
  ]
});

Performance

DLP scanning adds minimal latency:

Payload SizeScan Time
1 KB<1ms
10 KB1-2ms
100 KB5-10ms
1 MB50-100ms

For large payloads, consider:

  • Streaming scan mode (Pro+)
  • Async scanning with webhook callback
  • Sampling for bulk operations

Compliance

DLP helps with:

  • PCI DSS: Credit card data detection and masking
  • HIPAA: PHI detection (SSN, medical IDs)
  • GDPR: PII detection and minimization
  • SOC 2: Data handling controls

Best Practices

Tip: Start with 'flag' mode. Monitor detections before blocking to avoid false positives.

Tip: Use allowlists carefully. Only allowlist values you're certain are safe.

Tip: Review DLP logs regularly. Detection patterns reveal what sensitive data your agents are handling.

Tip: Test custom patterns thoroughly. False positives disrupt workflows; false negatives leak data.

Next Steps