Encryption Troubleshooting Guide
Quick Diagnostics
Check Encryption Status
Verify Database Encryption
Common Issues
Issue: “DB_ENCRYPTION_KEY environment variable is not set”
Solution:
Issue: “Invalid encrypted data or wrong encryption key”
Cause: Using different encryption key than when data was encrypted
Solution:
- Verify same key across all instances:
echo $DB_ENCRYPTION_KEY | md5sum - Check if key was recently changed - restore correct key from backup
- Ensure Kubernetes secrets match across environments
Issue: Endpoint/Model API Calls Failing
Cause: Token not decrypting properly
Diagnosis:
Solution:
- Verify encryption key is correct
- Check logs for decryption errors:
kubectl logs -l app=rhesis-backend | grep -i decrypt - Re-save the record to re-encrypt with current key
Issue: Migration Failed Partway Through
Solution:
- Migration is idempotent - safe to re-run:
alembic upgrade head - Already encrypted values will be skipped
- Check database connection and timeout settings
Issue: Performance Degradation
Expected: ~1-2ms overhead per encrypt/decrypt operation
Check:
- Monitor CPU usage:
kubectl top pods -l app=rhesis-backend - Verify connection pool settings (pool_size=10, max_overflow=20)
- Check for N+1 query patterns
Issue: “Found unencrypted value” Warnings
Solution:
- Re-run migration:
alembic upgrade head - Or manually re-save affected records to trigger encryption
Debug Script
Verification Queries
Getting Help
Log Collection
Support
- Review Database Field Encryption
- Check Security Documentation
- Create GitHub issue with
encryptionlabel - Contact DevOps team for production issues