This guide covers advanced topics for managing secrets in Julep, including security architecture, best practices, rotation policies, and integration patterns.
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:
Copy
from julep import Julepimport uuidclient = Julep(api_key="your_api_key")# Generate temporary nametemp_name = f"stripe_key_rotation_{uuid.uuid4().hex[:8]}"# Create new secret with temp nameclient.secrets.create( name=temp_name, value="sk_new_value...", description="New Stripe API key (rotation)", metadata={"rotation_date": "2025-05-10"})# Test the new key (implement your validation logic here)# ...# If valid, delete old secret and rename new oneclient.secrets.delete(name="stripe_api_key")client.secrets.update( name=temp_name, new_name="stripe_api_key", description="Stripe API key", metadata={"last_rotated": "2025-05-10"})
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:
Copy
from julep import Julepfrom datetime import datetime, timedeltaclient = Julep(api_key="your_api_key")# Find secrets not rotated in over 90 daysold_threshold = datetime.now() - timedelta(days=90)secrets = client.secrets.list()for secret in secrets.items: if secret.updated_at < old_threshold: print(f"WARNING: Secret {secret.name} has not been rotated in over 90 days")