This document outlines security practices for the TeacherLoggg application.
The following files must NEVER be committed to version control:
.envbackend/.envfrontend/.env- Any file containing API keys, tokens, or passwords
-
Local Development:
- Copy
.env.exampleto.env - Fill in your actual credentials in
.env .envis in.gitignoreand will not be committed
- Copy
-
Production Deployment:
- Use platform environment variables (Emergent, Vercel, Render, etc.)
- Use secret managers (AWS Secrets Manager, HashiCorp Vault, etc.)
- Use Docker secrets for containerized deployments
-
CI/CD:
- Use GitHub Secrets for Actions
- Use GitLab CI/CD variables
- Never expose secrets in logs
Location: Should be set as environment variable OPENAI_API_KEY
Protection Measures:
- β Never commit to git
- β Rotate keys regularly
- β Use separate keys for dev/staging/production
- β Monitor usage for anomalies
- β Set spending limits in OpenAI dashboard
- β Revoke compromised keys immediately
If compromised:
- Immediately revoke the key at https://platform.openai.com/api-keys
- Generate a new key
- Update all environments with new key
- Review usage logs for unauthorized access
- Check git history and remove exposed keys
Current Setting: CORS_ORIGINS=*
Security Recommendation:
- For production, restrict CORS to your actual domains:
CORS_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
- Only use
*for development/testing
Best Practices:
- Use strong authentication (username/password)
- Enable MongoDB authentication
- Use TLS/SSL for connections
- Restrict network access (firewall rules)
- Use MongoDB Atlas for managed security
- Regular backups
Production Connection String Example:
MONGO_URL=mongodb+srv://username:password@cluster.mongodb.net/dbname?retryWrites=true&w=majorityBefore deploying to production:
- All
.envfiles are in.gitignore - No secrets committed to git history
- Environment variables set in deployment platform
- CORS restricted to actual domains
- MongoDB authentication enabled
- OpenAI API key has spending limits
- HTTPS enabled for production
- Regular security updates applied
- Dependencies audited (
npm audit,pip-audit) - Error messages don't expose sensitive data
cd frontend
npm audit
npm audit fixcd backend
pip install pip-audit
pip-auditIf you discover a security vulnerability:
- DO NOT open a public GitHub issue
- Email: security@yourproject.com
- Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if available)
We will respond within 48 hours.
- Review and rotate API keys
- Update dependencies
- Review access logs
- Check for exposed secrets in git history
- Full security audit
- Penetration testing
- Review user permissions
- Update security documentation
We are committed to maintaining the security and privacy of our users' data. Security is an ongoing process, and we continuously work to improve our practices.
Last Updated: January 2025