RAG-CLI uses several external APIs that require authentication keys:
- ANTHROPIC_API_KEY: Claude API for response generation
- TAVILY_API_KEY: Tavily search API for web search
- STACKOVERFLOW_KEY: Stack Overflow API (optional)
- Create .env file (never commit this file):
# Copy template
cp config/templates/.env.template .env
# Edit with your keys
ANTHROPIC_API_KEY=sk-ant-...
TAVILY_API_KEY=tvly-...- Verify .gitignore includes:
.env
*.key
*_key
credentials.json
- Store keys ONLY in
.envfile or environment variables - Never hardcode keys in source code
- Never commit keys to version control
- Use different keys for development and production
To rotate API keys:
- Generate new key from API provider
- Update
.envfile with new key - Restart all RAG-CLI services
- Verify new key works
- Revoke old key from API provider
Check for exposed keys:
# Scan git history for accidentally committed keys
git log -p | grep -E "(api[_-]?key|token|secret)" -i
# Validate current setup
python scripts/validate_config.pyRAG-CLI automatically redacts sensitive information from logs:
- API keys (20+ characters)
- Tokens
- Secrets
- Passwords (8+ characters)
- Bearer tokens
Example:
# Original log message:
"Connecting to API with key=sk-ant-1234567890abcdef..."
# Redacted log:
"Connecting to API with key=***REDACTED***"
Error: Tavily API request failed: 401 Client Error: Unauthorized
Solution:
- Verify
TAVILY_API_KEYis set in.env - Check key is valid at https://tavily.com
- Ensure no leading/trailing spaces in
.env - Restart RAG-CLI to reload environment
Warning: ANTHROPIC_API_KEY not set, using mock mode
Solution:
- Get API key from https://console.anthropic.com
- Add to
.env:ANTHROPIC_API_KEY=sk-ant-... - Restart application
Before deployment:
- All API keys stored in
.envor environment variables -
.envfile in.gitignore - No keys in source code (check with grep)
- Different keys for dev/staging/production
- Log redaction tested and working
- API key quotas monitored
- Key rotation procedure documented
If you discover a security vulnerability:
- Do NOT open a public GitHub issue
- Email security contact (see package metadata)
- Include:
- Description of vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
We follow responsible disclosure practices:
- Acknowledge report within 48 hours
- Provide estimated fix timeline within 1 week
- Notify reporter when patched
- Credit reporter (unless anonymity requested)
Security patches are released as:
- Critical: Within 24 hours
- High: Within 1 week
- Medium: Within 1 month
- Low: Next regular release
Subscribe to security advisories:
- Watch GitHub repository
- Enable security alerts
- Monitor CHANGELOG.md for security fixes
RAG-CLI is designed to support:
- GDPR compliance (no personal data stored)
- Local-first architecture (data stays on your machine)
- Audit logging for compliance tracking