Security Option C — AWS KMS envelope encryption (operator opt-in)
For business
Mnueron now supports FIPS 140-2 Level 3 certified encryption for stored credentials, backed by AWS KMS. Per-row Data Encryption Keys, envelope encryption, and full CloudTrail audit on every key operation.
- Operator enables it per-deployment with two env vars; mixed-mode reads supported so legacy rows keep working.
- Per-org migration runs with one command:
npm run migrate:org-to-kms(idempotent + dry-run mode). - Cost: ~$1/month for the operator KMS key + ~$0.03 per 10k decrypt calls.
- Unlocks healthcare-with-BAA, banking, and federal procurement conversations that were previously blocked.
- BYOK (customer-managed keys) schema is in place — UI ships when a customer asks for it.
For developers
- supabase/migrations/058_org_secrets_envelope.sql (encryption_mode + encrypted_dek + iv + kms_key_id)
- src/lib/secrets/kms.ts (@aws-sdk/client-kms GenerateDataKey + Decrypt)
- src/lib/secrets/envelope.ts (AES-256-GCM, 12B IV, 16B auth tag)
- src/lib/secrets/db.ts (dispatch on row.encryption_mode at read; flag at write)
- scripts/migrate-org-to-kms.mjs (per-org, idempotent, DRY_RUN supported)
Env required to enable: MNUERON_KMS_ENABLED=true, AWS_KMS_KEY_ID=<arn>, AWS_REGION, plus AWS credentials. Without them, the pgcrypto path stays active — no breakage.
See Security architecture for the envelope flow diagram.