Security Best Practices for TerraScale
Security isn’t optional. Here’s everything you need to know to keep your TerraScale databases secure.
API Key Security
Section titled “API Key Security”Use Specific Scopes
Section titled “Use Specific Scopes”Never use * (full access) in production. Grant only the permissions each service needs:
// Bad: Full access{ "scopes": ["*"] }
// Good: Specific permissions{ "scopes": ["database:read"] } // Read-only service{ "scopes": ["database:read", "database:write"] } // Backend API{ "scopes": ["repository:read", "repository:write"] } // Specific to repositoriesSeparate Keys by Environment
Section titled “Separate Keys by Environment”Use different API keys for different environments:
| Environment | Key Name | Scopes |
|---|---|---|
| Production | prod-backend | database:read, database:write |
| Staging | staging-backend | database:read, database:write |
| Development | dev-local | database:* |
| CI/CD | ci-tests | database:read |
Rotate Keys Regularly
Section titled “Rotate Keys Regularly”API keys should be rotated every 90 days:
- Create a new key with the same scopes
- Update your application configuration
- Deploy and verify
- Revoke the old key
Never Commit Keys
Section titled “Never Commit Keys”API keys should never be in source control:
// Bad: Hardcodedvar apiKey = "ts_live_abc123...";
// Good: Environment variablevar apiKey = Environment.GetEnvironmentVariable("TERRASCALE_API_KEY");
// Good: Secret managervar apiKey = await secretManager.GetSecretAsync("terrascale-api-key");Add to your .gitignore:
.env.env.local*.envappsettings.Development.jsonAccount Security
Section titled “Account Security”Enable Two-Factor Authentication
Section titled “Enable Two-Factor Authentication”Every account should have 2FA enabled. TerraScale supports:
- Authenticator apps (Google Authenticator, Authy, 1Password) - Recommended
- Email codes - Good as a backup
To enable:
- Go to Settings > Security
- Click “Add Method”
- Scan the QR code with your authenticator app
- Enter the verification code
Use Strong Passwords
Section titled “Use Strong Passwords”Requirements:
- Minimum 12 characters (we recommend 16+)
- Mix of uppercase, lowercase, numbers, symbols
- Unique to TerraScale (not reused from other services)
Consider using a password manager.
Review Active Sessions
Section titled “Review Active Sessions”Periodically check Settings > Security > Sessions:
- Look for unfamiliar locations or devices
- Revoke any sessions you don’t recognize
- Consider revoking all sessions after password changes
Team Security
Section titled “Team Security”Principle of Least Privilege
Section titled “Principle of Least Privilege”Assign the minimum role needed:
| Role | Use Case |
|---|---|
| Owner | Only the account creator (one person) |
| Admin | Team leads who need to manage members |
| Member | Developers who create and manage resources |
| Read-only | Auditors, analysts, support staff |
Audit Team Members
Section titled “Audit Team Members”Review your team quarterly:
- Remove people who’ve left the organization
- Downgrade permissions that are no longer needed
- Verify all members have 2FA enabled
Handle Departures Promptly
Section titled “Handle Departures Promptly”When someone leaves:
- Remove them from the organization immediately
- Revoke any API keys they created
- Review any resources they had access to
- Consider rotating shared credentials
Network Security
Section titled “Network Security”Use HTTPS Only
Section titled “Use HTTPS Only”All TerraScale APIs require HTTPS. Never attempt to use HTTP.
Validate TLS Certificates
Section titled “Validate TLS Certificates”Don’t disable certificate validation in production:
// Never do this in productionServicePointManager.ServerCertificateValidationCallback = (s, c, ch, e) => true;IP Allowlisting (Enterprise)
Section titled “IP Allowlisting (Enterprise)”Enterprise customers can restrict API access to specific IP ranges. Contact support to enable this feature.
Data Security
Section titled “Data Security”Sensitive Data Handling
Section titled “Sensitive Data Handling”Don’t store highly sensitive data directly:
// Bad: Storing raw SSN["ssn"] = "123-45-6789"
// Better: Store a hash or encrypted value["ssnHash"] = Hash("123-45-6789")
// Best: Don't store it at all if you don't need itEncryption at Rest
Section titled “Encryption at Rest”All data in TerraScale is encrypted at rest using AES-256. This is automatic and requires no configuration.
Encryption in Transit
Section titled “Encryption in Transit”All data in transit uses TLS 1.3. This is automatic and required.
Monitoring and Alerting
Section titled “Monitoring and Alerting”Enable Audit Logs
Section titled “Enable Audit Logs”Track who’s accessing your data:
- API key usage by operation type
- Failed authentication attempts
- Administrative actions (member changes, key creation)
Set Up Alerts
Section titled “Set Up Alerts”Configure alerts for:
- Unusual API usage patterns
- Failed authentication spikes
- New API key creation
- Team member changes
Regular Reviews
Section titled “Regular Reviews”Monthly security checklist:
- Review API key usage - any surprises?
- Check for inactive API keys - revoke them
- Verify team member list is accurate
- Confirm all team members have 2FA
- Review any security alerts
Incident Response
Section titled “Incident Response”If an API Key is Compromised
Section titled “If an API Key is Compromised”- Revoke immediately - Don’t wait, revoke the key now
- Create a new key - Generate a replacement
- Update applications - Deploy the new key
- Audit usage - Check logs for unauthorized access
- Review data - Look for any data modifications
- Document - Record what happened and how you responded
If an Account is Compromised
Section titled “If an Account is Compromised”- Change password immediately
- Revoke all sessions
- Review and revoke API keys
- Enable 2FA if not already enabled
- Check for unauthorized team members
- Contact support at mariogk@terrascale.tech
Summary
Section titled “Summary”Security is everyone’s responsibility:
- Use specific API key scopes
- Rotate keys every 90 days
- Enable 2FA for all accounts
- Use the principle of least privilege
- Never commit secrets to source control
- Monitor for unusual activity
- Have an incident response plan
Questions about security? Contact mariogk@terrascale.tech.