.env files
API keys
Passwords
Private keys
Access tokens
Database credentials
.env.example files with placeholder values
Environment variables in deployment platforms
GitHub Secrets for CI/CD
Secret management services (AWS Secrets Manager, etc.)
π‘οΈ Security Measures in Place
1. GitHub Actions Secret Scanning
Automated scanning on every push/PR
Daily scheduled scans
Blocks commits with detected secrets
Prevents committing .env files
Warns about potential secrets in code
All .env files are ignored
Common secret file patterns ignored
π¨ If You Accidentally Commit Secrets
IMMEDIATELY revoke the exposed key/token
Remove from git history using scripts/remove-env-from-history.sh
Force push: git push origin --force --all
Rotate all affected credentials
Notify team members to update their local repos
Always use env.example as a template
Never hardcode secrets in code
Use environment variables for all sensitive data
Review diffs before committing
Use secret scanning tools locally before pushing
π How to Check for Exposed Secrets
# Check if .env files are tracked
git ls-files | grep .env
# Check git history for .env
git log --all --full-history -- backend/.env
# Scan for common secret patterns
grep -rE " (api[_-]?key|secret[_-]?key|password|token)\s*=\s*['\" ][^'\" ]{10,}" --include=" *.py" --include=" *.js" --include=" *.ts" .