Your first check is free. No card needed.Run a free security check

Is your .env file, source map or .git folder public? How to check your own site

Request /.env, /.git/HEAD, /.git/config and the .map file next to your main script on your own domain, then read the response body, not only the status code, because many single-page apps answer every address with their home page and a 200. A safe answer is a 404, a 403 or your app's normal page. If a file with secrets comes back, treat every secret in it as leaked: remove the file, rotate the secrets, check your providers' logs and purge your CDN cache.

Imagine typing your own domain followed by /.env into the address bar and getting back plain text: DATABASE_URL=, STRIPE_SECRET_KEY=, OPENAI_API_KEY=. Nothing was broken into. The file was simply sitting in the folder your web server serves, because the project was copied to the server in one piece, or because someone dropped it into public/ so the front end could "read" it.

This is less rare than it sounds. In August 2026, Intruder checked 3.5 million live hosts and found 28,000 exposed .git repositories. Among the secrets in them were 123 OpenAI API keys, 107 live Stripe secret keys and more than 400 AWS access keys (Intruder research). Intruder reports that many owners have since taken the repositories down and rotated the keys.

How do these files end up public?

In apps built with Vite, Next.js or a plain static host, these files usually get out by one of four routes.

The public folder is served as is. Vite copies files in public/ "to the root of the dist directory as-is" (Vite: static asset handling). In Next.js, a file at public/avatars/me.png is served at /avatars/me.png (Next.js: public folder). Anything you put there, a .env, a db.sql export, a zip of the project, is published with the site.

Prefixed variables are built into the scripts on purpose. Vite says variables prefixed with VITE_ "will be exposed in client-side source code" and "should not contain sensitive information such as API keys" (Vite: env variables). Next.js inlines NEXT_PUBLIC_ values into "any JavaScript sent to the browser" at build time (Next.js: environment variables). No .env file is exposed here, yet the result is the same. The guide to an API key exposed in the frontend covers that case.

Source maps are switched on. Both tools default to off in production. Vite's build.sourcemap is false unless you change it; true writes a separate .map file and 'hidden' writes it without the comment that points browsers to it (Vite: build options). Next.js disables production browser source maps "to prevent you leaking your source on the client"; turn on productionBrowserSourceMaps and the maps sit next to the JavaScript files and Next.js serves them (Next.js: productionBrowserSourceMaps). Other tools have other defaults: InfoQ notes that the Bun runtime generates source maps unless they are disabled (InfoQ).

The whole project folder is deployed. Running git clone into the web root, or copying the project to a server with rsync or FTP, brings the hidden .git folder and the .env file along. So do the leftovers people forget: OWASP's testing guide describes editors that save copies like file~, renamed files such as login.asp.old that the server then sends as plain text, and backup archives holding every file in the web root (OWASP WSTG: old, backup and unreferenced files).

How do I check my own site?

Five requests, from a terminal, against your own domain:

curl -s https://yourapp.com/.env | head -5
curl -s https://yourapp.com/.git/HEAD | head -5
curl -s https://yourapp.com/.git/config | head -5
curl -s https://yourapp.com/db.sql | head -5
curl -s -o /dev/null -w "%{http_code}\n" https://yourapp.com/.env

Then the source map. Open your home page, view the source and find the main script, something like /assets/index-4f2a9c.js. Request the same address with .map added. Also look at the last line of the script: a //# sourceMappingURL= comment tells browsers where the map is (MDN: source map). With 'hidden' that comment is missing, but the file can still be on the server, so request it directly either way.

Why a 200 does not mean you have a problem

Most single-page apps are set up to return index.html for any address, so the router can handle it. Netlify's documented rule for this, /* /index.html 200, serves the home page "instead of giving a 404 no matter what URL the browser requests" (Netlify: rewrites). So /.env can answer 200 and be harmless.

The opposite also holds. The same Netlify page says a rewrite does not shadow a file that actually exists. If a real .env is in your build output, it wins over the rewrite and is served. That is why you read the body.

What does a safe answer look like?

Path on your domainSafe answerProblem
/.env, /.env.local, /.env.production, /.env.bak404, 403, or your app's HTML pageLines like KEY=value
/.git/HEAD404, 403, or your app's HTML pageref: refs/heads/main
/.git/config404, 403, or your app's HTML pageA [core] section and a remote address, sometimes with a token in it
/assets/index-xxxx.js.map404 or your app's page, unless you chose to publish mapsJSON starting with {"version":3
/db.sql, /backup.zip, /site.tar.gz404 or your app's pageSQL statements or a file download

A source map is JSON whose version field is always 3, and it may carry an optional sourcesContent list with the original source inside (ECMA-426 source map format).

Are source maps a security risk?

Less than the other three, in our view, but they should be a choice. A source map lets the original code be rebuilt from what the browser receives (MDN). That means readable file names, your comments, and sometimes the names of internal endpoints, admin routes or feature flags that the minified code made harder to spot.

What a source map does not do is reveal anything the browser did not already have. A secret in your front-end code is exposed with or without a map; the map only makes it easier to read. The real problem is the secret, and the fix is the server, not the build setting.

The Claude Code package shows how much one file can carry. On March 31, 2026, version 2.1.88 of @anthropic-ai/claude-code was published to npm with a .map file that pointed to its complete TypeScript source. Anthropic called it "a release packaging issue caused by human error, not a security breach" and said no customer data or credentials were involved (InfoQ). That was an npm package rather than a website, but the mechanism is the same one your build uses.

If you want readable stack traces, you do not have to publish maps. Sentry's Vite guide generates them with sourcemap: "hidden", uploads them during the build, and deletes them afterwards with sourcemaps.filesToDeleteAfterUpload; it also suggests denying access to .js.map files at the server as an alternative (Sentry: Vite source maps).

Why is an exposed .git folder worse than it looks?

Because it holds the whole history as well as today's files. A key you deleted from the code six months ago is still in the commits. Truffle Security checked the Alexa top one million websites in 2023, found about 4,500 with an exposed .git folder, and rebuilt the repositories with an open-source tool; they note that .git/config files often contain the password to the repository (Truffle Security). Turning off directory listing does not help, because the files inside .git have predictable names.

I found one on my site. What now?

In this order:

  1. Remove it from the server and from whatever put it there: the public/ folder, the deploy script, the Docker image.
  2. Rotate every secret it contained. Assume each one was copied. Truffle Security calls rotating or invalidating exposed secrets the only reliable fix. Our fix prompt for moving secret keys to the server helps with the code side.
  3. Check your providers' logs for the time the file was public: database connections, payment API requests, AI usage.
  4. Purge your CDN cache, or the old copy can keep being served after you delete the file.
  5. Block dotfiles at the server. OWASP's advice is to configure the web server to deny access to such directories. On nginx, keep /.well-known/ open, since certificate checks use it:
location ~ /\.(?!well-known/) {
    deny all;
}
  1. Deploy the build output only. Ship dist/ or the framework's build folder, never the project folder, and recheck the five paths after the next release.

Try it on yours now

Run the five curl lines above against your production domain and your staging domain, and read what comes back. It takes two minutes. If the body of /.env is your app's HTML page and /.git/HEAD does not say ref:, you are fine on those two. Then add the checks to your pre-launch checklist so they run on every release, not once.

Where does Saqr fit?

If you would rather not do this by hand, a Saqr Quick task checks your live site for files that should not be public, including .env, .git, backups and source maps, and searches the scripts the browser downloads for secret keys. It reads each response body rather than trusting the status code, shows the request and response for every finding, and gives you a fix prompt for your AI coding tool. Your first check is free, no card needed.

Saqr (usesaqr.com) is AI security for web apps. Its AI agents attack your live app from the outside, the way a real attacker would, and show you exactly what to fix. From $19 a month, cancel any time. Tests only apps you have shown are yours.

Questions

Does robots.txt keep these files hidden?

No. Google says robots.txt is not a mechanism for keeping a page out of Google and that crawlers decide for themselves whether to obey it. Listing a sensitive path there only points people at it.

Is it fine to commit .env to a private repository?

Avoid it. Next.js says you almost never want to commit these files, and its default template adds them to .gitignore. A private repository is one leaked token, one mistaken visibility change or one deployed .git folder away from public.

Is a .env.example file a problem?

Not if it holds variable names and placeholder values only. Check it before each commit, because real values have a way of being pasted into it.

Can I tell whether someone already downloaded my .env?

Only from your server or CDN access logs, if you keep them and they cover the whole period. Without logs, assume it was downloaded and rotate everything in it.

My host builds from Git. Do I still need to check?

Yes, though the .git question mostly goes away when only the build output is served. Files in public/, source maps you enabled and variables with a public prefix still ship with every deploy.