godelgate Book a demo

Encryption and key management

How Godelgate encrypts stored credentials, and how to use HashiCorp Vault and rotate keys.

Godelgate encrypts every stored credential with AES-256-GCM: server tokens and headers, OAuth tokens, OpenTelemetry headers, model provider keys, and local servers' environment variables. API keys, invite links, SCIM tokens and sign-in sessions are stored only as SHA-256 hashes.

#Where the key comes from

  1. HashiCorp Vault Transit (envelope encryption): set VAULT_ADDR, VAULT_TOKEN (and VAULT_NAMESPACE if you use namespaces) and GODELGATE_VAULT_TRANSIT_KEY, the name of a transit key. On first start Godelgate asks Vault for a data key and stores only Vault's wrapped copy; on every start Vault unwraps it. Without Vault, the stored data can't be read. The mount defaults to transit (GODELGATE_VAULT_TRANSIT_MOUNT).
  2. GODELGATE_SECRET_KEY: any long random string.
  3. Otherwise, a key generated into secret.key next to the database.

#Rotating keys

Set the new key and keep the old one readable for one start:

bash
GODELGATE_SECRET_KEY=<new> GODELGATE_SECRET_KEY_PREVIOUS=<old> godelgate

At start-up Godelgate re-encrypts every stored secret with the current key and logs how many. After that, GODELGATE_SECRET_KEY_PREVIOUS can be removed. Moving to Vault works the same way: values sealed with the old local key are re-encrypted with Vault's data key.