Aligned with SOC 2 Type II trust service criteria (Security, Availability, Confidentiality).
Access Control
- Super-admin routes require
checkIsSuperAdmin()plus a separate rate-limit layer (see admin notes). - RBAC roles:
VIEWER,EDITOR,ADMIN,OWNER- enforced server-side on every request. - Session validation runs in
proxy.ts, the middleware entry point. - Principle of least privilege: API routes expose only the data the caller's role permits.
Secrets Management
- All secrets are stored as environment variables; none are committed to source control.
- BYOK (Bring Your Own Key) API keys are encrypted at rest using AES-256-GCM before storage (
lib/crypto/). - Encryption keys are stored separately from encrypted data.
- Platform API keys (OpenAI, ElevenLabs, etc.) are accessed only server-side.
Transport Security
- All traffic is served over TLS 1.2+ (enforced by Vercel and Railway).
- Internal service communication (Next.js → worker) uses authenticated requests (an HMAC bearer).
- Cloudflare R2 audio files are accessed via signed URLs with short expiry (15 minutes).
Input Validation
- All API request bodies are validated with Zod schemas before processing.
- URL inputs from users are validated through
lib/validateUrl.tsto prevent SSRF. - Admin endpoints apply stricter validation against
VALID_PLANSand schema constants.
Rate Limiting
- Per-user rate limits applied on all mutating API routes.
- Admin routes apply tighter per-admin rate limits keyed by
clerkId. - Rate-limit responses include
Retry-Afterheaders.
Audit Logging
- All super-admin actions are recorded in the append-only
AuditLogtable. - Logs capture: actor, action type, target resource, timestamp, and request metadata.
- Retention: 24 months, removed by the daily cleanup job (see DATA-RETENTION.md).
Vulnerability Management
- Dependabot or equivalent keeps dependencies updated.
- Security reports are triaged within 5 business days.
- Critical/high CVEs are patched within 30 days of a viable fix being available.
Incident Response
- Detect - Sentry alerts, log anomalies, or external report.
- Contain - Revoke affected sessions, disable compromised keys.
- Assess - Determine scope, data categories, and affected users.
- Notify - Follow GDPR 72-hour rule if personal data is involved (see GDPR.md).
- Remediate - Deploy fix, rotate secrets, audit trail updated.
- Review - Post-incident write-up within 5 business days.
Penetration Testing
Scheduled annually (minimum). Critical findings are treated as P0 and resolved before the next release. Reports are stored in reports/ and reviewed by the engineering lead.