How credential encryption works
When you connect a cloud account, InfraAudit encrypts the credentials before inserting them into the database:- Algorithm: AES-256-GCM
- Key source:
ENCRYPTION_KEYenvironment variable - Key format: 32-byte value, hex-encoded (64 hex characters)
- Nonce: A unique random nonce is generated for each encrypted value and prepended to the ciphertext
ENCRYPTION_KEY is never written to the database. If someone gains access to the database but not the key, the stored credentials are unreadable.
Generate an encryption key
ENCRYPTION_KEY in your .env or Kubernetes Secret.
JWT authentication
InfraAudit validates JWTs using theSUPABASE_JWT_SECRET from your Supabase project. Requests with expired or invalid tokens return 401 Unauthorized.
The SUPABASE_SERVICE_ROLE_KEY is used server-side for privileged Supabase operations such as looking up users by ID. This key bypasses Supabase row-level security — keep it confidential and never expose it to the browser or public APIs.
Managing secrets in production
Choose the approach that fits your deployment:- Docker Compose
- Kubernetes
- External secrets manager
Avoid committing secrets to the Alternatively, use Docker Swarm secrets for more structured secret management.
.env file if the file is visible in CI or on a shared server. Pass secrets as environment variables directly at runtime:Rotating the encryption key
InfraAudit does not automatically re-encrypt credentials when the key changes. You must manually re-enter provider credentials after rotation.Export your provider list
Note all connected providers and their credential details. You’ll need to re-enter them after the rotation.
Rotating the Supabase JWT secret
Rotating the JWT secret in Supabase invalidates all active user sessions immediately. Update your deployment at the same time to avoid downtime.Rotate the secret in Supabase
In your Supabase project, go to Settings → API → JWT Settings and click Rotate JWT Secret. Copy the new value.
Update your deployment
Update
SUPABASE_JWT_SECRET in your .env file or Kubernetes Secret with the new value.Users will need to log in again after a JWT secret rotation. Their data is unaffected.
Production security checklist
Review these items before going live:-
ENCRYPTION_KEYwas generated withopenssl rand -hex 32— not a placeholder or default value -
DB_PASSWORDis unique and not the defaultinfraudit123 -
SUPABASE_SERVICE_ROLE_KEYis not in version control -
ENVIRONMENT=productionis set (disables Swagger UI and debug endpoints) -
DB_SSLMODE=requireis set if the database is not on localhost -
ALLOWED_ORIGINSis set to your frontend URL, not* -
/metricsendpoint is protected withMETRICS_AUTH_TOKENif internet-accessible -
ENCRYPTION_KEYis backed up in a secrets manager