Skip to main content

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:
  1. Application-level Validation: Secrets are validated before being stored
  2. Database Encryption: Secrets are stored encrypted using PostgreSQL’s pgcrypto extension with AES-256
  3. Access Control: Secrets are scoped to developers and only accessible within their resources
  4. 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 vs email_token)

Secret Rotation Best Practices

Regular rotation of secrets is a security best practice:
  1. Create a new secret with a temporary name
  2. Update your services to use the new secret
  3. Once confirmed working, delete the old secret
  4. 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:
  1. Use consistent naming conventions with environment prefixes:
    • dev_stripe_key, staging_stripe_key, prod_stripe_key
  2. Use metadata to tag secrets by environment:
  3. 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: Example of setting up an LLM API key:

Audit and Monitoring

Best practices for security monitoring:
  1. Regularly audit secret access and usage
  2. Track changes to secrets via the updated_at timestamp
  3. Implement secret expiration for highly sensitive data
  4. Use metadata to track last review or rotation dates
Example audit script:

Troubleshooting

Common issues when working with secrets:
  1. Secret Not Found: Check that the secret name matches exactly, including case
  2. Permission Errors: Verify the developer ID has access to the secret
  3. Encryption Errors: Ensure the master key is correctly set in the environment
  4. Reference Errors: Ensure the secret reference syntax is correct in expressions and templates

Next Steps