The .env leak
A working SMTP password and API key were publicly downloadable for days, because the protection lived in the old host's config rather than in the files.
What we were doing. Starting a homepage redesign. Nothing to do with security. I read the folder structure to understand the site and noticed .env was tracked in git with no .gitignore anywhere.
What was actually true. https://areactor.org/.env returned 200 and served its contents in plaintext: the SMTP password for help@areactor.org and a Gemini API key. Anyone who requested that path got working credentials.
On HostGator an .htaccess rule blocked all dotfiles. That rule is an Apache mechanism. Cloudflare ignores .htaccess entirely, so the protection did not survive the migration, while the file it was protecting did.
The file had been safe for as long as it existed on the old host. Nothing about it changed. What changed was the ground underneath it, silently, during a migration where the visible outcome was "the site still works".
What was done
- Both credentials rotated immediately, before anything else. A leaked secret stays leaked; rotation is what makes the leaked copy worthless.
git rm --cached .envto stop tracking it while keeping the local file.- A
.gitignoreadded covering.env,.env.*, and the usual credential-shaped extensions.
The old values remain in git history. That is acceptable precisely because they were rotated: history holds two dead strings.
What would catch it sooner
The general lesson is larger than one file. A protection that lives in your host's configuration does not travel with your files. Anything relying on .htaccess, server config, or directory permissions needs re-establishing from scratch on a new host, and its absence is silent.
The concrete check is a request, not a config review:
curl -o /dev/null -w "%{http_code}\n" https://areactor.org/.env
404 is the answer you want. Worth running against every sensitive path after any host change. This eventually became .assetsignore, which does the same job in a way that is part of the repo rather than part of the server.