Security Best Practices
Security is critical when deploying AI agents to production. This guide covers essential practices to keep your agents, data, and users safe.
The Security Mindset
Section titled “The Security Mindset”Principle: Assume breach. Design systems that remain secure even if one component is compromised.
Key Principles:
- Least Privilege - Minimum permissions needed
- Defense in Depth - Multiple security layers
- Zero Trust - Verify everything, trust nothing
- Fail Secure - Errors should deny access, not grant it
Authentication & Authorization
Section titled “Authentication & Authorization”API Keys
Section titled “API Keys”Do’s ✅
- Create org API keys under Settings → Security → API keys with New key (
sk_live_...); owners and admins can - Store third-party tokens only in Integrations connection setup (encrypted)
- Use environment variables in your own apps that call the Auteryn API — never commit keys to git
OAuth Tokens
Section titled “OAuth Tokens”Best Practices:
- Use OAuth over API keys when available
- Request minimum scopes needed
- Refresh tokens before expiry
- Revoke unused tokens
User Authentication
Section titled “User Authentication”For user-facing agents:
# Verify user identityif not user.is_authenticated(): return "Please log in first"
# Check permissionsif not user.has_permission("view_data"): return "Access denied"Data Protection
Section titled “Data Protection”Sensitive Data Handling
Section titled “Sensitive Data Handling”PII (Personally Identifiable Information):
# ❌ Bad: Logging PIIlogger.info(f"User email: {user.email}")
# ✅ Good: Redact PIIlogger.info(f"User: {user.id}")
# ✅ Good: Hash PIIimport hashlibhashed = hashlib.sha256(user.email.encode()).hexdigest()logger.info(f"User hash: {hashed[:8]}")Credit Card Data:
Data Encryption
Section titled “Data Encryption”At Rest:
# Auteryn encrypts stored data. In your own app, for extra sensitive fields:import osfrom cryptography.fernet import Fernet
key = os.environ["ENCRYPTION_KEY"]cipher = Fernet(key)
# Encryptencrypted = cipher.encrypt(b"sensitive data")
# Decryptdecrypted = cipher.decrypt(encrypted)In Transit:
- Always use HTTPS for APIs
- Verify SSL certificates
- Use TLS 1.2 or later
Input Validation
Section titled “Input Validation”Sanitize User Input
Section titled “Sanitize User Input”SQL Injection Prevention:
# ❌ Bad: String concatenationquery = f"SELECT * FROM users WHERE email = '{user_input}'"
# ✅ Good: Parameterized queriesquery = "SELECT * FROM users WHERE email = %s"cursor.execute(query, (user_input,))XSS Prevention:
# ❌ Bad: Raw HTMLhtml = f"<div>{user_input}</div>"
# ✅ Good: Escape HTMLfrom html import escapehtml = f"<div>{escape(user_input)}</div>"Command Injection Prevention:
# ❌ Bad: Shell injection riskos.system(f"ls {user_input}")
# ✅ Good: Use subprocess with listimport subprocesssubprocess.run(["ls", user_input])Validate All Inputs
Section titled “Validate All Inputs”def validate_email(email): import re pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' if not re.match(pattern, email): raise ValueError("Invalid email") return email
# Use validationtry: email = validate_email(user_input)except ValueError: return "Please provide a valid email"Access Control
Section titled “Access Control”Role-Based Access Control (RBAC)
Section titled “Role-Based Access Control (RBAC)”Define roles and permissions:
roles = { "admin": ["read", "write", "delete", "manage_users"], "editor": ["read", "write"], "viewer": ["read"]}
# Check permissionif "write" not in user.permissions: return "Access denied"Principle of least privilege
Section titled “Principle of least privilege”Avoid: Granting write/admin scopes on GitHub, Google, or Slack when the agent only reads data.
Prefer: Read-only connection scopes in Integrations, then add write scopes only when the agent must create or update resources.
Credentials
Section titled “Credentials”Store integration tokens in Integrations → [connection] setup — they are encrypted at rest. Never paste API keys into agent instructions or commit them to git.
Audit Logging
Section titled “Audit Logging”What to Log
Section titled “What to Log”Do log:
- Authentication attempts
- Permission checks
- Data access
- Configuration changes
- Integration calls
- Errors and exceptions
Don’t log:
- Passwords or API keys
- Credit card numbers
- PII (unless necessary and encrypted)
- Full request/response bodies
Log Format
Section titled “Log Format”import logging
logger.info({ "event": "data_access", "user_id": user.id, "resource": "customer_data", "action": "read", "timestamp": "2026-04-02T10:15:23Z", "ip_address": request.ip, "result": "success"})Compliance
Section titled “Compliance”Data subject requests (GDPR)
Section titled “Data subject requests (GDPR)”Your users may ask you to honor these rights:
- Right to access data
- Right to deletion
- Right to portability
- Right to rectification
To export or delete your organization’s data in Auteryn:
- Export: the organization’s owner chooses Export data in Settings → Organization and downloads a zip of your files and data. It never contains passwords, tokens or Connection credentials. A closed organization cannot export, so export first. See Export your data.
- Delete: the owner chooses Close organization in the same place. The organization can be reopened for 30 days, and its content is deleted after that. See Close your organization.
- Delete without the 30-day wait: send a formal erasure request to privacy@auteryn.ai or support@auteryn.ai. The organization then cannot be reopened.
- Delete one person’s account: that person chooses Delete my account in Account settings. See Delete your account.
See also Data handling.
Data Retention
Section titled “Data Retention”When an organization is closed, its content is deleted on day 30: conversations, files, Library documents, Knowledge, memory, Agents, Skills, Loops, Voices and snapshots. People’s names, emails and sign-ins are deleted too.
Copies can remain for a short time after that:
- Database backups: up to 7 days
- Deleted files in cloud storage: up to 7 days
- Service logs: up to 90 days
- Error reports: per our error-tracking provider’s retention
The billing ledger and audit records are kept, with no name, email or IP address attached. Invoices are held by Stripe, our payment processor, and show the billing name and email. We keep the Stripe customer for tax records.
For other retention requirements, contact security@auteryn.ai.
Incident Response
Section titled “Incident Response”Response Plan
Section titled “Response Plan”- Detect - Monitoring alerts on issue
- Contain - Isolate affected systems
- Investigate - Determine root cause
- Remediate - Fix the issue
- Recover - Restore normal operations
- Review - Post-mortem and improvements
Emergency Contacts
Section titled “Emergency Contacts”- Security issues: security@auteryn.ai
- Critical bugs: support@auteryn.ai
Security Checklist
Section titled “Security Checklist”Before Deployment
Section titled “Before Deployment”- All secrets in environment variables
- Input validation on all user inputs
- SQL injection prevention
- XSS prevention
- CSRF protection
- Rate limiting configured
- Audit logging enabled
- Error messages don’t leak info
- HTTPS only
- Security headers configured
Ongoing
Section titled “Ongoing”- Review audit logs weekly
- Rotate secrets quarterly
- Update dependencies monthly
- Security training for team
- Incident response drills
- Penetration testing annually
Resources
Section titled “Resources”Questions?
Section titled “Questions?”- Is Auteryn SOC 2 compliant, or ready for HIPAA? Ask security@auteryn.ai for our current compliance status before you rely on either.
- Where is data stored? Primarily in the United States. There is no EU or custom region today.
- Can I use my own encryption keys? Customer-managed keys (BYOK) are available on an Enterprise contract.
- How do I report a security issue? Email security@auteryn.ai. We aim to acknowledge reports within 2 business days.

