Documentation Index
Fetch the complete documentation index at: https://snakysec.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ADR-002 — HashiCorp Vault for runtime secret injection
Date: 2025-01-20 Status: Accepted Deciders: Nicolas (founder)Context
The platform handles sensitive credentials per client (Entra ID client secrets/certificates, tenant IDs) and platform-level secrets (ENCRYPTION_KEY, GitLab token, database URL). These must not be stored in.env files committed to the repo or baked into Docker images.
Decision
HashiCorp Vault KV v2 is used for all runtime secrets, injected viainstrumentation.ts at Next.js server startup.
Rationale
- Zero secrets in Git:
.envonly contains infrastructure URLs (DATABASE_URL, REDIS_URL, VAULT_ADDR) - AES-256-GCM client secrets: Per-client credentials encrypted at rest in PostgreSQL (
ClientSecretmodel), decrypted on demand viaENCRYPTION_KEYfetched from Vault - X.509 cert auth for Entra ID: Certificate private key stored in Vault, never touches disk outside the container
- Audit worker AppRole: Worker uses Vault AppRole (separate role, limited TTL) — principle of least privilege
- Key rotation: Rotate
ENCRYPTION_KEYviavault kv patchwithout redeployment
Architecture
Consequences
VAULT_ADDRmust be set in.env; all other secrets come from Vaultnext buildusesSKIP_ENV_VALIDATION=true— Vault unavailable at build time- Dev mode: Vault dev server in docker-compose, pre-seeded via
docker/vault/init.sh - Production: Vault in HA mode with Raft storage (documented in
docker/vault/vault-prod.hcl)
Alternatives rejected
- AWS Secrets Manager: Vendor lock-in; added cost; overkill for single-region PME MSSP
- Kubernetes Secrets: No Kubernetes in the stack; Docker Swarm / Compose deployment target
- Doppler / Infisical: Third-party SaaS dependency for secrets management violates data residency requirements (EU clients)