Security Best Practices
Security is critical when working with AI platforms. This guide covers best practices for protecting your Claro API keys, managing access, and maintaining a secure integration.API Key Management
Creating Secure API Keys
1
Use Descriptive Names
Name API keys by environment and purpose:
2
Create Environment-Specific Keys
Never share API keys across environments:
- Development - Local testing only
- Staging - Pre-production validation
- Production - Live applications only
3
Document Key Purpose
Keep a record of what each key is used for:
4
Save Keys Immediately
API keys are only shown once during creation. Save them securely immediately.
Storing API Keys Securely
Never commit API keys to version control or share them publicly:- Environment Variables
- Cloud Secrets Manager
- CI/CD Secrets
- Docker
Local DevelopmentLoad in your application:
Key Rotation
Regular key rotation reduces the risk of compromised keys:Rotation Schedule
Development
Every 6 months
Lower risk, less frequent rotation
Staging
Every 3 months
Regular rotation for testing
Production
Every 90 days
Highest security standard
Safe Rotation Process
1
Create New Key
Generate a new API key in the Claro dashboard
2
Deploy New Key
Update your application with the new key:
- Update environment variables
- Deploy to staging first
- Test thoroughly
- Deploy to production
3
Monitor for Issues
Watch for errors over 24-48 hours:
- Check error rates
- Monitor authentication failures
- Verify all services updated
4
Delete Old Key
Once confirmed the new key works everywhere, delete the old key
Emergency Key Rotation
If you suspect a key is compromised:1
Immediately Create New Key
Don’t wait - create a replacement key right away
2
Quick Deploy
Deploy the new key as quickly as possible, even if it means brief downtime
3
Delete Compromised Key
Delete the compromised key immediately to prevent unauthorized access
4
Audit Access
Review API access logs to understand the extent of unauthorized use
5
Notify Team
Alert your security team and stakeholders
Access Control
Workspace Permissions
Limit who can create and manage API keys:Permission Levels for API Keys
Permission Levels for API Keys
| Role | Can Create Keys | Can View Keys | Can Delete Keys |
|---|---|---|---|
| Owner | ✓ | ✓ | ✓ |
| Admin | ✓ | ✓ | ✓ |
| Member | ✗ | ✗ | ✗ |
| Viewer | ✗ | ✗ | ✗ |
Service Accounts
For production systems, use service accounts instead of personal accounts:1
Create Service Account
Create a dedicated account for your application (e.g.,
[email protected])2
Add to Workspace
Invite the service account to your workspace with appropriate permissions
3
Generate API Keys
Create API keys from the service account
4
Document Ownership
Document which team owns each service account
Audit Logging
Monitoring API Usage
Track API key usage in the Claro dashboard:1
Navigate to API Keys
Go to Settings → API Keys in the Claro dashboard
2
View Usage Statistics
For each key, review:
- Last used timestamp
- Total requests
- Error rates
- Usage patterns
3
Identify Anomalies
Look for suspicious activity:
- Unexpected spikes in usage
- Requests from unusual locations
- High error rates
- Usage of supposedly inactive keys
Automated Monitoring
Set up alerts for suspicious activity:Secrets Management
Environment-Specific Secrets
Never mix secrets across environments:Secrets in Configuration Files
Never commit secrets to git:OWASP Considerations
Preventing Common Vulnerabilities
Injection Attacks
Injection Attacks
Risk: User input injected into prompts could manipulate LLM behaviorPrevention:
Data Exposure
Data Exposure
Risk: Sensitive data leaked through prompts or API responsesPrevention:
- Never include PII in prompts
- Redact sensitive data before logging
- Use environment-specific prompts
- Implement data classification
Insufficient Logging
Insufficient Logging
Risk: Unable to detect or investigate security incidentsPrevention:
Missing Authentication
Missing Authentication
Risk: Unauthorized access to your application’s AI featuresPrevention:
Always validate users before allowing prompt access:
Rate Limiting
Rate Limiting
Risk: API abuse or DoS attacksPrevention:
Implement rate limiting on your endpoints:
Compliance
Data Privacy Regulations
- GDPR
- CCPA
- HIPAA
General Data Protection Regulation (EU)Key requirements:
- Data minimization - collect only necessary data
- Right to deletion - allow users to delete their data
- Data portability - export user data on request
- Consent management - explicit user consent required
Security Checklist
Development Security
Development Security
- API keys stored in environment variables, never in code
-
.envfiles added to.gitignore - No hardcoded secrets in configuration files
- Sensitive data redacted in logs
- Code review process includes security checks
Production Security
Production Security
- Production API keys different from dev/staging
- Keys stored in secrets manager (AWS/GCP/Azure)
- Regular key rotation schedule (every 90 days)
- Service accounts used instead of personal accounts
- HTTPS enforced for all API calls
- Rate limiting implemented
- Authentication required for AI endpoints
Monitoring & Audit
Monitoring & Audit
- API usage monitored for anomalies
- Security events logged
- Alerts configured for suspicious activity
- Regular access reviews conducted
- Unused API keys deleted
- Audit trail maintained for compliance
Incident Response
Incident Response
- Incident response plan documented
- Emergency key rotation procedure tested
- Security contact information current
- Breach notification process defined
- Regular security training for team
Incident Response
If an API Key is Compromised
1
Immediate Actions (0-15 minutes)
- Delete compromised key immediately
- Create new API key
- Deploy new key to production
- Alert security team
2
Investigation (15-60 minutes)
- Review audit logs for unauthorized access
- Identify what data was accessed
- Determine scope of breach
- Document timeline of events
3
Remediation (1-24 hours)
- Rotate all related credentials
- Update security procedures
- Implement additional monitoring
- Review and update access controls
4
Post-Incident (1-7 days)
- Conduct post-mortem analysis
- Update documentation
- Train team on lessons learned
- Implement preventive measures
- Notify affected parties if required