Exposed .env or .git on a deployed site
Quick answer: If your hosting or build setup copies everything in your project folder to the live site, anyone may be able to download /.env (your API keys, database URL and other secrets) or /.git/config and the rest of the .git folder (your code and its history). Request both paths on your own domain: each should return 404. If either loads, remove it from the deployed files and treat every secret in it as leaked.
Last updated November 16, 2026
Steps
- Request /.env and /.git/config on your own domain (and any staging or preview domains you own).
- Both should return 404 (not found) or 403, never the file’s contents.
- If either loads, remove it from the deploy output: deploy only your build folder, and keep .env and .git out of it.
- Rotate every secret that was in the exposed file (API keys, database passwords, webhook secrets), not just the ones you think matter.
- If .git was exposed, assume your source code and any secrets ever committed to its history are public, and rotate those too.
- Re-check both paths after each hosting or build-setting change.
Why it matters
This is a common failure pattern in apps built quickly with AI coding tools. The steps above check your own app only. Never test apps you don't own.
Related patterns
- Production source maps that publish your app's original source code
- File paths built from user input (path traversal)
- Passwords, tokens and personal data written to your logs
- Hard-coded credentials left in vibe-coded apps
- Debug or preview mode left on in production
- Dangling DNS records that let someone take over your subdomain
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.