This document summarizes the security considerations and measures implemented in the automatic secret rotation tool.
- Implementation: Uses
rand::thread_rng()with secure random number generation - Character Set: Includes uppercase, lowercase, numbers, and special characters
- Default Length: 32 characters (configurable)
- Location:
src/rotation.rs::generate_secret()
- TLS Support: Fully supports HTTPS endpoints for Vault
- Token Security: Tokens are never logged or displayed
- Environment Variables: Supports secure token passing via environment
- No Hardcoded Secrets: All sensitive data comes from config or environment
- No Secret Storage: Rotation metadata doesn't contain actual secrets
- Timestamps Only: Only stores rotation dates and periods
- Vault-Native: Uses Vault's built-in metadata system
- No Secret Leakage: Error messages don't expose secret values
- Context Preservation: Errors include helpful context without secrets
- Proper Propagation: Uses
anyhowfor error handling
Status: Intentional Feature with Warnings
The following commands intentionally display secrets in cleartext:
asr rotate <path>- Shows newly rotated secretasr read <path>- Shows secret values
Justification:
- Users need to see rotated secrets to update applications
- This is the primary use case for manual rotation
Mitigations Implemented:
- Security warnings displayed before and after showing secrets
- Output to stderr for warnings (separate from secret data)
- Documentation clearly explains security implications
- Recommendation to use
autocommand for automated rotation (no cleartext output) - Best practices documented in README and USAGE guides
Warnings Added:
WARNING: Secret value will be displayed. Ensure this output is secured.
WARNING: Please update your application with the new secret and clear your terminal history.
Finding: Cleartext Logging Alert
Location: src/main.rs - rotate and read commands
Status: Acknowledged and Mitigated
Analysis:
- This is an intentional design decision for a CLI tool
- Users explicitly request to view secrets
- Security warnings have been added
- Documentation updated with security best practices
No Code Changes Required: The cleartext output is necessary functionality Mitigation: Education and warnings to users
The following security best practices are documented in README.md:
-
Vault Token Security
- Use environment variables for tokens
- Store tokens in CI/CD secret management
- Never commit tokens to source control
-
TLS Communication
- Use HTTPS for production Vault endpoints
- Verify TLS certificates
-
Terminal Security
- Clear terminal history after viewing secrets
- Use secure environments only
- Avoid logging command output containing secrets
-
Vault Permissions
- Use minimal required permissions
- Separate tokens for different environments
- Regular token rotation
-
Audit Logging
- Enable Vault audit logging
- Monitor rotation operations
- Track access patterns
-
Automation Security
- Use
autocommand in CI/CD (no cleartext output) - Secure CI/CD secret storage
- Limit token scope and lifetime
- Use
All dependencies are from trusted sources (crates.io):
- Regular security updates via Cargo
- No known vulnerabilities in current versions
- Minimal dependency tree to reduce attack surface
# CI/CD pipeline - no cleartext output
asr auto# Manual rotation - displays secret
# Use only in secure terminals
asr rotate app/password- Use HTTPS Vault endpoints in production
- Store Vault tokens securely (environment variables or secret management)
- Enable Vault audit logging
- Use minimal required permissions for Vault tokens
- Clear terminal history after viewing secrets
- Use
autocommand for automation (avoids cleartext output) - Never log or redirect output containing secrets to files
- Regularly rotate Vault tokens themselves
- Monitor and review audit logs
The automatic secret rotation tool implements industry-standard security practices:
- Cryptographically secure random generation
- Secure communication with Vault (TLS support)
- No secret storage in metadata
- Proper error handling without secret leakage
- Clear security warnings when secrets are displayed
- Comprehensive security documentation
The intentional cleartext output for rotate and read commands is a necessary feature for a CLI tool, with appropriate warnings and documentation to ensure users understand the security implications.
Potential future improvements:
- Add option to copy secrets to clipboard instead of displaying
- Add secret masking option (show partial values only)
- Add output encryption for secret values
- Implement secret verification post-rotation
- Add webhook support for secret distribution (avoid manual viewing)