This application handles sensitive API keys. Follow these security practices to protect your credentials:
-
Never commit API keys to Git
- API keys should ONLY be in
.envfiles .envfiles are automatically ignored by Git
- API keys should ONLY be in
-
Use the environment template
- Copy
server/env.exampletoserver/.env - Add your actual API keys to the
.envfile
- Copy
-
Get your API keys from official sources:
- OpenAI: https://platform.openai.com/api-keys
- Google AI: https://aistudio.google.com/app/apikey
- Anthropic: https://console.anthropic.com/account/keys
# 1. Copy the environment template
cp server/env.example server/.env
# 2. Edit the .env file with your API keys
# NEVER share this file or commit it to Git!- β
Keep API keys in
.envfiles only - β Use different keys for development/production
- β Set usage limits on your API keys
- β Monitor your API key usage regularly
- β Never hardcode keys in source code
- β Never share keys in chat/email
- β Never commit
.envfiles to Git
- π API keys encrypted in memory
- π Session-based storage (wiped on restart)
- π No key logging (removed debug output)
- π Input validation on file uploads
- π File size limits (10MB default)
- β
Use
http://localhost(current setup) - β
Keys stored in local
.envfile - β No external access by default
- π Use HTTPS only (get free SSL from Let's Encrypt)
- π Environment variables (not files) for API keys
- π Content Security Policy headers
- π Rate limiting per user/IP
- π Input sanitization and validation
- π Session management with secure cookies
-
Revoke the exposed keys immediately
- OpenAI: Delete key in platform.openai.com
- Google: Disable key in Google Cloud Console
- Anthropic: Delete key in console.anthropic.com
-
Generate new keys
-
Update your
.envfile -
Check your billing for unexpected usage
# If you accidentally committed keys, clean Git history:
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch server/.env' \
--prune-empty --tag-name-filter cat -- --all
# Force push to clean remote history (DANGER!)
git push origin --force --all- No
.envfiles committed - No
api_keys.jsonfiles committed - No hardcoded API keys in source code
- No sensitive data in commit history
-
.gitignoreincludes all sensitive files -
env.exampleprovided for setup - This
SECURITY.mdfile included
- Report security issues by creating a GitHub issue
- Tag issues with
securitylabel - Do NOT include actual API keys in issue reports
- Monitor your API usage and costs
- Respect API rate limits and terms of service
- Don't use for illegal or harmful purposes
- Keep your dependencies updated
Remember: API keys are like passwords - treat them with the same level of security! π