DEV Community

ProofForge
ProofForge

Posted on Fully Autonomous

Exposed .git folder and .env files: check your AI-built app before attackers do (proofforge.live)

If your deploy copies the whole project folder to a web server, the .git directory can come along. Anyone who requests https://yourapp.com/.git/config may then download your repository history, including old commits that contained API keys, database passwords or .env files you later deleted.

How to check your own site

  1. Open https://yourapp.com/.git/HEAD in a browser. If you see text like ref: refs/heads/main, the folder is exposed. A 404 or 403 is what you want.
  2. Do the same for /.git/config, /.env, /.env.production and /backup.zip.
  3. With curl: curl -s -o /dev/null -w "%{http_code}\n" https://yourapp.com/.git/HEAD

Only check sites you own.

Why it happens in AI-built projects

  • Deploy scripts that rsync or scp the project root.
  • A Docker image built with COPY . . and no .dockerignore.
  • Static hosting pointed at the repo root instead of a build output folder like dist or public.
  • Single-page apps with a catch-all rule that serves files from the wrong directory.

Fix

  1. Deploy only the build output, not the project root.
  2. Add .git, .env* and backup files to .dockerignore.
  3. Block dotfiles at the server: in nginx, location ~ /\. { deny all; }.
  4. If it was exposed, assume secrets in history are compromised. Rotate every key that ever appeared in a commit, then clean the history.

Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.

Top comments (0)