3.3 KiB
3.3 KiB
⚠️ CRITICAL SECURITY ISSUE - EXPOSED CREDENTIALS
What Was Found
Your API keys and database credentials were committed to git history:
- OpenRouter API Key:
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 - MongoDB Credentials:
- Username:
subasiarhan3_db_user - Password:
ETKnWiMmraGFX5P - Database:
lumina.vcg0rkz.mongodb.net
- Username:
What Has Been Fixed
✅ Updated .gitignore files to exclude .env files:
- Created root
.gitignore - Updated
ui/.gitignore - Updated
api/.gitignore
✅ Removed .env files from git tracking (files still exist locally)
⚠️ IMMEDIATE ACTION REQUIRED
1. Rotate All Exposed Credentials
OpenRouter API Key:
- Go to https://openrouter.ai/keys
- Revoke/delete the exposed key:
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 - Create a new API key
- Update your local
.envfiles with the new key
MongoDB Credentials:
- Go to MongoDB Atlas dashboard
- Change the password for user
subasiarhan3_db_user - Update your local
.envfiles with the new password
2. Remove Credentials from Git History
If this repository is public or shared, you need to remove the credentials from git history:
Option A: Using git filter-repo (Recommended)
# Install git-filter-repo if needed
pip install git-filter-repo
# Remove the API key from history
git filter-repo --invert-paths --path api/.env --path ui/.env
# Force push (WARNING: This rewrites history)
git push origin --force --all
Option B: Using BFG Repo-Cleaner
# Download BFG from https://rtyley.github.io/bfg-repo-cleaner/
# Create a file with secrets to remove
echo "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" > secrets.txt
echo "ETKnWiMmraGFX5P" >> secrets.txt
# Run BFG
java -jar bfg.jar --replace-text secrets.txt
# Clean up
git reflog expire --expire=now --all
git gc --prune=now --aggressive
Option C: If repository is new/not shared
# Nuclear option: Start fresh (only if no one else has cloned)
rm -rf .git
git init
git add .
git commit -m "Initial commit (credentials removed)"
3. Verify .env Files Are Ignored
# Check that .env files are ignored
git status | grep .env
# Should show nothing (or only .env.example files)
# Verify .env files exist locally but are ignored
ls -la ui/.env api/.env
# Files should exist locally
4. Update .env Files with New Credentials
After rotating credentials, update:
ui/.env- Add newREACT_APP_OPENROUTER_API_KEYapi/.env- Add newOPENROUTER_API_KEYand MongoDB credentials
5. Check for Other Exposed Secrets
# Search for other potential secrets in git history
git log --all --full-history -p | grep -i "password\|secret\|key\|token" | grep -v "example\|placeholder\|your-"
Prevention
✅ .env files are now in .gitignore
✅ Always use .env.example files for templates
✅ Never commit actual credentials
✅ Use environment variables or secret management services in production
Next Steps
- IMMEDIATELY rotate the OpenRouter API key
- IMMEDIATELY change MongoDB password
- Remove credentials from git history if repository is shared
- Update local
.envfiles with new credentials - Verify
.envfiles are not tracked:git status