Boardroom Answers · Security & Compliance · Security & Cyber Risk
Secrets Management: API Keys and Encryption Keys
The question a Chief Information Security Officer (CISO) asks: “Where do your secrets live — API keys, database credentials, encryption keys — and how do you know one hasn't already leaked into your codebase?”
The short answer
Env-only secrets with a public/server naming firewall, gitleaks scanning every commit, customer keys stored only as hashes, and AWS KMS envelope encryption for the most sensitive fields — the gap is scheduled auto-rotation, planned with SOC 2 readiness.
The full executive answer
Secrets live in exactly one place: encrypted environment variables in the deployment platform (Vercel), injected at runtime into server-side code only. The codebase enforces a naming firewall — anything prefixed NEXT_PUBLIC_ is deliberately public and shippable to browsers; everything else is server-only and structurally unavailable to client code. Every new secret must be declared in a template file (.env.example) with a placeholder, so the inventory of what secrets exist is itself version-controlled and reviewable, while the values never are.
On "how do you know one hasn't leaked": we don't rely on knowing — we scan. Gitleaks runs in the Security CI workflow against every push, pattern-matching for credentials across the repository and its history. Our own logging layer masks secrets and personal data before anything is written, so a leak via log files is defended too. And for the customer-facing surface: API keys we issue to customers are stored only as salted scrypt hashes with timing-safe comparison — a database breach yields no usable keys — and webhook secrets support rotation with a grace window so customers can rotate without downtime.
The deepest layer is envelope encryption for sensitive stored fields: data is encrypted with AES-GCM under per-write data keys, which are themselves wrapped by a master key that never leaves AWS KMS — Amazon's hardware-backed key service. Plaintext key material never touches disk. Honest maturity note: we don't yet run a dedicated secrets-manager product with automatic scheduled rotation for our own operational secrets; rotation is manual-but-fast today, and scheduled rotation policy is written into the SOC 2 readiness workplan for Q4 2026.
Grounded in: NIST SP 800-53 SC-12/SC-28 (key management, protection at rest); SOC 2 TSC CC6.1; CIS Controls v8 #3.
The natural next questions
Related governed answers
- You host every customer's board-level secrets in one database. Prove to me that tenant A cannot read tenant B's data. Has anyone actually tried to break that boundary?
- Your admin service credential bypasses your vaunted Row Level Security. If that one key leaks, every tenant is exposed at once. What's the blast radius, and what limits it?
- Describe your Zero Trust posture. What do you trust by default, and what do you verify?
Want this answered live, on your data?