- Never commit
.envor any file containing credentials. - Use
.env.examplefor non-sensitive defaults only. - Set DB credentials through environment variables.
- Rotate credentials if they have ever appeared in git history.
- Use a dedicated runtime user with least required privileges.
- Keep administrative users separate from ingestion users.
- Restrict DB network access to trusted hosts/VPC/private network.
- Enable SSL/TLS for non-local database connections.
Before making the repository public:
- Confirm
git statushas no secret files staged. - Search for potential secret patterns:
- passwords
- API keys
- tokens
- Verify
.gitignoreincludes local secret files (.env*). - Regenerate credentials used during development.