critical severity · fix guide

How to Stop Serving .env and .git Publicly

A file that is usually kept private, like your .env (which often holds secrets) or a file from your .git folder, is served from your live site. What it contains decides how serious that is.

Why AI tools cause it

A misconfigured host or a bad deploy can expose these. AI setups sometimes deploy the whole project folder, including files that should be ignored.

The goal

Private files (.env, .git) are not downloadable from the live site, and every secret that was in an exposed .env has been replaced and the exposed value revoked.

The steps

  1. Contain it: stop the host from serving the spot the scan shows (fix the host config and .gitignore, and keep it out of the deploy output)
  2. Rotate every secret that was in the exposed file, because removing the file does not stop those values working: revoke at once if you suspect misuse; otherwise create replacements, update the app's secret settings, confirm the app works, and then revoke the exposed values promptly

Fix it with your AI coding tool

Pick your tool and paste the instruction. It is written to make the goal above true, and to never print any secret values back to you.

Paste this to Any AI tool:
In my app (the spot the scan shows): private files are being served publicly. Please make this true: Private files (.env, .git) are not downloadable from the live site, and every secret that was in an exposed .env has been replaced and the exposed value revoked. Steps: Contain it: stop the host from serving the spot the scan shows (fix the host config and .gitignore, and keep it out of the deploy output); Rotate every secret that was in the exposed file, because removing the file does not stop those values working: revoke at once if you suspect misuse; otherwise create replacements, update the app's secret settings, confirm the app works, and then revoke the exposed values promptly. Then tell me exactly what you changed, and do not print any secret values back to me or write one into a commit message, a pull request description or a log.

Then verify it worked

After the fix, xlogs requests the file again and reports whether it is still served.

Check your app for this issue

Free, read-only. See whether the issue is detected, then rescan after your fix: the recheck says whether it is still detected.