Security

Protect your AI applications with enterprise-grade security features including threat detection, PII filtering, and policy enforcement.

Security Overview

Cencori provides multiple layers of security to protect your AI applications from common threats and vulnerabilities. Every request flows through our security pipeline before reaching the AI provider.

  • Threat Detection: Identify and block malicious prompts in real-time
  • PII Filtering: Automatically detect and redact sensitive personal information
  • Content Moderation: Filter inappropriate or harmful content
  • Policy Enforcement: Apply custom security rules across all requests

Threat Detection

Cencori automatically detects and blocks various types of malicious prompts and attack patterns.

Prompt Injection Attacks

Detects attempts to manipulate the AI model through carefully crafted prompts that try to override system instructions or extract sensitive information.

example-blocked-prompt.txt

Jailbreak Attempts

Identifies attempts to bypass AI model safety guidelines through role-playing scenarios or hypothetical situations.

Data Exfiltration

Blocks attempts to extract training data, system prompts, or other sensitive information from the AI model.

PII Filtering

Automatically detect and redact personally identifiable information (PII) to ensure compliance with privacy regulations like GDPR and HIPAA.

Detected PII Types

  • Email addresses
  • Phone numbers
  • Social Security Numbers (SSN)
  • Credit card numbers
  • IP addresses
  • Physical addresses
  • Names and personal identifiers

Enabling PII Filtering

lib/cencori.ts

Redaction Example

example-pii-redaction.txt

Content Moderation

Filter inappropriate, harmful, or policy-violating content in both user prompts and AI responses.

Moderation Categories

  • Hate speech and discrimination
  • Violence and graphic content
  • Sexual or explicit content
  • Self-harm or dangerous activities
  • Harassment or bullying
  • Misinformation or fraud

Configuring Content Moderation

dashboard-config.ts

Policy Enforcement

Define custom security policies that apply to all requests in your project. Policies can be configured in the Cencori dashboard or programmatically via the API.

Custom Policy Example

custom-policy.ts

Policy Types

  • Keyword Blocking: Block requests containing specific words or phrases
  • Pattern Matching: Use regex patterns to detect and block complex inputs
  • Rate Limiting: Enforce request limits per user or organization
  • Geographic Restrictions: Block requests from specific regions
  • Time-based Rules: Enforce policies during specific time windows

Security Incidents

All detected threats and policy violations are logged as security incidents in your Cencori dashboard.

Viewing Incidents

Navigate to the "Security" tab in your project dashboard to view:

  • Timeline of all security incidents
  • Incident severity and classification
  • Blocked request details and patterns
  • User/session information for investigation
  • Recommended actions and remediation steps

Handling Security Errors

When a request is blocked, Cencori returns a generic error response to prevent attackers from iterating through different bypass attempts. The detailed detection information is logged server-side for your security team to review.

app/api/chat/route.ts

Error Response Format

Cencori returns structured error responses that hide detection details from end users:

error-response-format.json

Security Note: Detailed detection patterns and reasons are only available in your Cencori dashboard logs. This prevents attackers from using error messages to iterate and bypass security filters.

Client-Side UI Implementation

Display blocked requests gracefully to your users with a clean, professional message:

components/BlockedMessage.tsx

Example Chat Integration

components/ChatInterface.tsx

Security Best Practices

Follow these recommendations to maximize the security of your AI applications:

  • Enable all security features: Turn on threat detection, PII filtering, and content moderation
  • Review incidents regularly: Check your security dashboard weekly for new patterns
  • Customize policies: Add industry-specific or business-specific security rules
  • Test your policies: Use test mode to validate security rules before deploying to production
  • Monitor false positives: Adjust thresholds if legitimate requests are being blocked
  • Educate users: Provide clear error messages when requests are blocked
  • Keep audit logs: Export security logs for compliance and forensic analysis
  • Stay updated: Cencori continuously updates threat detection patterns automatically