Secret Management
Radium provides a comprehensive secret management system that prevents credential exposure in agent interactions, logs, and responses. This system uses encrypted storage and dynamic credential substitution to ensure credentials are never exposed to LLMs or in logs.
Overviewβ
The secret management system provides:
- Encrypted Storage: All secrets are stored in an encrypted vault using AES-256-GCM encryption
- Dynamic Substitution: Real credentials are replaced with placeholders before sending to LLMs
- Automatic Injection: Placeholders are replaced with real values just before tool execution
- Workspace Scanning: Detects hardcoded credentials in your workspace
- Audit Logging: Records all secret access operations for compliance
How It Worksβ
The secret management system operates in three stages:
- Storage: Secrets are encrypted and stored in
~/.radium/auth/secrets.vault - Redaction: Before sending context to LLMs, real credential values are replaced with
{{SECRET:name}}placeholders - Injection: Just before tool execution, placeholders are replaced with real values
This ensures that:
- LLMs never see actual credential values
- Logs never contain plaintext credentials
- Tools receive real credentials when needed
- Credentials are never exposed in agent responses
Quick Startβ
1. Create Your First Secretβ
radium secret add api_key
You'll be prompted to:
- Set a master password (if this is your first secret)
- Enter the secret value
- Confirm the secret value
2. List Your Secretsβ
radium secret list
This shows only secret names - values are never displayed.
3. Use Secrets in Your Workβ
Secrets are automatically redacted from context and injected into tools. You can reference them in your code or commands using placeholders:
{{SECRET:api_key}}- Standard placeholder format$SECRET_api_key- Environment variable format
4. Scan for Hardcoded Credentialsβ
radium secret scan
This scans your workspace for hardcoded credentials and reports any findings.
Migration from Plaintext Credentialsβ
If you have existing credentials in ~/.radium/auth/credentials.json, you can migrate them to the encrypted vault:
radium secret migrate
This will:
- Create a timestamped backup of your credentials file
- Migrate all provider credentials to the encrypted vault
- Mark the original file as deprecated
- Provide a rollback path if needed
Security Featuresβ
Encryptionβ
- Algorithm: AES-256-GCM (authenticated encryption)
- Key Derivation: PBKDF2 with 100,000 iterations
- Master Password: Minimum 12 characters with complexity requirements
File Permissionsβ
- Vault file: 0600 (owner read/write only)
- Audit log: 0600 (owner read/write only)
- Auth directory: 0700 (owner access only)
Audit Loggingβ
All secret operations are logged to ~/.radium/auth/audit.log:
- Store operations
- Retrieve operations
- List operations
- Rotation operations
- Removal operations
Log entries include:
- Timestamp
- Operation type
- Secret name (never the value)
- Success/failure status
- Error messages (if failed)
Best Practicesβ
- Use Strong Master Passwords: At least 12 characters with letters, numbers, and special characters
- Rotate Secrets Regularly: Use
radium secret rotate <name>to update secrets - Scan Your Workspace: Regularly run
radium secret scanto find hardcoded credentials - Review Audit Logs: Periodically review
~/.radium/auth/audit.logfor suspicious activity - Never Commit Secrets: Use
.gitignoreto exclude credential files and vault files
Configurationβ
Secret management can be configured in your Radium config file:
[security.secrets]
enable_secret_redaction = true
enable_secret_injection = true
enable_audit_logging = true
warn_on_hardcoded_secrets = true
secret_vault_path = "~/.radium/auth/secrets.vault"
audit_log_path = "~/.radium/auth/audit.log"
master_password_min_length = 12
Troubleshootingβ
Master Password Forgottenβ
If you forget your master password, you cannot recover secrets. You'll need to:
- Restore from backup (if you have one)
- Re-enter all secrets manually
Vault Corruptionβ
If the vault file becomes corrupted:
- Check for backup files in
~/.radium/auth/ - Restore from the most recent backup
- If no backup exists, you'll need to recreate secrets
Migration Issuesβ
If migration fails:
- Check the backup file created during migration
- Verify the original
credentials.jsonfile is intact - Review error messages for specific issues
- Use the backup to rollback if needed
API Referenceβ
For programmatic access, see the Rust API documentation:
SecretManager: Core secret storage and retrievalSecretFilter: Pre-LLM credential redactionSecretInjector: Pre-tool credential injectionSecretScanner: Workspace credential detectionAuditLogger: Operation logging