How to check if your .env is exposed
One URL check that tells you if your production host is serving your secrets file — and how to fix it.
Paste your live URL. In about 10 seconds we'll check whether /.env or /.git can be downloaded from your site.
Uses 1 of your 3 free scans today; a site scanned in the last 24 hours answers from that scan. Passive and read-only: we only look at what any browser can see. Only check sites you own or may test.
What the free scan checks
- Leaked keys in your live JavaScript (AI, payment and cloud keys), including a Supabase
service_rolekey - Files that should never be public, like
/.envand/.git - Supabase and Firebase secrets in the browser: an
sb_secret_key, a Supabase access token or a Firebase service-account file - HTTPS and security headers (CSP, HSTS, clickjacking protection)
It only reads what any visitor's browser can see. It doesn't log in, read your tables or check App Check.
What it is: your live site serves your .env file (or a variant like .env.production) to anyone who asks for it. Every API key, database password and token in it is then public.
Who's affected: apps deployed by copying a project folder to a server or bucket, or with a build step that puts .env into public/ or dist/. Most managed hosts block dotfiles by default; raw object storage and some VPS or Docker setups don't.
Safe self-check
Run this against your own site. It only reads the status code and content type.
curl -s -o /dev/null -w "%{http_code} %{content_type}\n" https://your-app.com/.env200 with text/plain (or a download) means it's public. 404, or 200 with text/html (your app's own page), usually means it isn't. Or use the free checker: Is my .env file public?
If https://your-domain/.env returns a file full of KEY=value lines, those secrets are public. Same for /.git/HEAD (which often means the whole git history is downloadable).
Check
- Open
https://YOUR_DOMAIN/.envin a private window. - Open
https://YOUR_DOMAIN/.git/HEAD. A response likeref: refs/heads/mainmeans.gitis exposed. - If either works: rotate every secret in that file before you do anything else.
Fix
- Ensure
.envis in.gitignoreand never copied intopublic/,dist/, orstatic/. - Configure the host/CDN to 404 dotfiles (Vercel/Netlify normally do; raw object storage and some VPS setups do not).
- Redeploy from a clean build.
Make sure .env and .git can never be served as static files. Add .env to .gitignore. Configure the host to return 404 for paths starting with /. List every secret that must be rotated if .env was ever public.
Related: Hide API keys · service_role
Scan your app free
Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down. The free scan finds the issues; the $29 Fix Pack gives you fix prompts written for your app and re-scans that prove each fix worked.
Questions
How do I know if my .env file is exposed?
Request your-app.com/.env from outside your network. If it returns KEY=value lines instead of a 404 or your app's own page, it is exposed. The check on this page does that for you.
What should I do first if my .env was public?
Rotate every secret in it before anything else, because someone may already have copied it. Then stop your host from serving the file and redeploy from a clean build.
Want the whole pre-launch process in one place? See what's inside App Security for Vibe Coders, our $9 PDF playbook, or go straight to checkout.