Secrets Management
Advanced techniques for managing sensitive information in Julep
Secrets Management
This guide covers advanced topics for managing secrets in Julep, including security architecture, best practices, rotation policies, and integration patterns.
Security Architecture
Secrets in Julep are stored with a layered security approach:
- Application-level Validation: Secrets are validated before being stored
- Database Encryption: Secrets are stored encrypted using PostgreSQL’s pgcrypto extension with AES-256
- Access Control: Secrets are scoped to developers and only accessible within their resources
- Master Key Security: A separate master encryption key secures all stored secrets
The encryption process works as follows:
- When a secret is created, its value is encrypted using the master key
- The encrypted value is stored in the database’s
value_encrypted
column - When a secret is accessed, the value is decrypted using the master key
- The master key is stored as an environment variable, separate from the database
Creating Effective Secret Names
Secrets should have descriptive names that follow these conventions:
- Use snake_case formatting
- Begin with a letter and contain only alphanumeric characters and underscores
- Use a prefix to indicate the service (e.g.,
aws_secret_key
,stripe_api_key
) - Be specific enough to understand the purpose (e.g.,
gmail_oauth_token
vsemail_token
)
Secret Rotation Best Practices
Regular rotation of secrets is a security best practice:
- Create a new secret with a temporary name
- Update your services to use the new secret
- Once confirmed working, delete the old secret
- Update the new secret’s name to the standard name
For automated rotation:
Using Secrets with Different Tool Types
API Tools
For HTTP-based tools, reference secrets in the headers or authentication:
Database Connections
For database tools, use secrets for connection credentials:
AI Service Integration
For AI services that require API keys:
Managing Secrets for Multi-Environment Deployments
For applications deployed across development, staging, and production environments:
-
Use consistent naming conventions with environment prefixes:
dev_stripe_key
,staging_stripe_key
,prod_stripe_key
-
Use metadata to tag secrets by environment:
-
Filter secrets by environment when listing:
Secret Templating
For complex configurations that require multiple secrets:
Securing LLM API Keys with Secrets
Julep automatically looks for LLM API keys in your secrets store based on the provider name. Use these naming conventions for automatic lookup:
Provider | Secret Name |
---|---|
OpenAI | OPENAI_API_KEY |
Anthropic | ANTHROPIC_API_KEY |
GOOGLE_API_KEY | |
Azure OpenAI | AZURE_OPENAI_API_KEY |
Cohere | COHERE_API_KEY |
Example of setting up an LLM API key:
Audit and Monitoring
Best practices for security monitoring:
- Regularly audit secret access and usage
- Track changes to secrets via the
updated_at
timestamp - Implement secret expiration for highly sensitive data
- Use metadata to track last review or rotation dates
Example audit script:
Troubleshooting
Common issues when working with secrets:
- Secret Not Found: Check that the secret name matches exactly, including case
- Permission Errors: Verify the developer ID has access to the secret
- Encryption Errors: Ensure the master key is correctly set in the environment
- Reference Errors: Ensure the secret reference syntax is correct in expressions and templates
Next Steps
- Using Secrets in Julep - Step-by-step guide for using secrets
- Integration Patterns - Learn how to use secrets with integrations
- API Reference - Complete API reference for secrets