Secret management
Qodex encrypts sensitive credentials before storing them in Postgres. The encryption key comes fromQODECLAW_SECRET_KEY. In production, this value is one of the most important secrets in the deployment.
What gets encrypted
Qodex encrypts values that could authenticate to another system:- BYOK provider API keys.
- OAuth access and refresh tokens.
- Customer auth profile credentials used by API scenarios.
- Sensitive inbox answers, such as passwords or tokens.
How encryption works
Qodex derives an AES-256-GCM key fromQODECLAW_SECRET_KEY and encrypts sensitive values before persistence.
Encrypted values are stored in a versioned format:
Production requirement
SetQODECLAW_SECRET_KEY to a high-entropy string at least 32 characters long.
If the key is missing
For local development, Qodex can fall back to a derived development key and log a warning. Do not rely on that fallback in production. If the container restarts with a different or missing key, previously encrypted values may become unreadable.Rotating the key
ChangingQODECLAW_SECRET_KEY invalidates existing encrypted values.
For small deployments, the practical rotation path is:
- Generate a new key.
- Restart Qodex with the new key.
- Re-enter BYOK keys.
- Re-authenticate OAuth-based auth profiles.
- Re-supply any other credentials stored through Qodex.
Backups
Database backups do not includeQODECLAW_SECRET_KEY.
If you restore Postgres without the matching key, most product data comes back, but encrypted credentials must be re-supplied. Store and back up the key with the same care as the database.
JWT secret vs encryption key
JWT_SECRET and QODECLAW_SECRET_KEY are different and should not share a value.
| Secret | Used for | Rotation impact |
|---|---|---|
JWT_SECRET | Signing sessions and OAuth state. | Users may need to log in again. |
QODECLAW_SECRET_KEY | Decrypting stored credentials. | Stored secrets must be re-entered unless re-encrypted. |
Next steps
Environment variables
See where
QODECLAW_SECRET_KEY is configured.Single-container deploy
Add the key to a Docker deployment.
Storage backends
Understand artifact storage separately from secrets.
AWS Terraform reference
Inject secrets into a production ECS task.