LeakRay
Server Config · Dotfiles · Passive Audit

Exposed .env & .git File Checker

Verify that your web server, reverse proxy, or static host blocks public HTTP access to .env files, .git metadata, and sensitive paths before automated bots scrape them.

01 · Exact Passive Checks

What LeakRay inspects on your live URL

Read /bot passive safety guarantees →
Rule ID & CheckWhat It InspectsWhy It's Passive & Safe
exposed-env-file
Public /.env & Environment Files
Checks whether /.env returns real KEY=VALUE environment assignments (like DATABASE_URL, STRIPE_SECRET_KEY, or JWT_SECRET) while ignoring soft-404 HTML fallback pages.Single bounded GET request under 2 MB with strict SSRF protection; any detected values are redacted before storage.
exposed-git-dir
Exposed /.git/HEAD Repository Metadata
Verifies whether /.git/HEAD responds with a valid git ref (for example ref: refs/heads/main), which lets attackers reconstruct full source code and commit history.Checks only /.git/HEAD passively — never downloads git objects, packfiles, or repository history.
exposed-api-docs
Unauthenticated OpenAPI & Swagger Endpoints
Detects publicly served /openapi.json, /swagger.json, or Swagger UI endpoints that expose internal admin routes and request schemas.Read-only GET check on standard documentation paths without fuzzing or mutating API endpoints.
robots-sensitive-paths
Sensitive Paths Listed in robots.txt
Reviews robots.txt Disallow entries for accidentally advertised admin panels, backup folders, or internal debug endpoints.Reads only the public robots.txt file and never crawls disallowed paths.

02 · Vulnerable vs. Fixed

Common production leak pattern and the exact fix

Vulnerable
nginx
# Vulnerable: Nginx serving project root without blocking dotfiles
server {
  listen 443 ssl;
  root /var/www/myapp;
  location / {
    try_files $uri $uri/ /index.html;
  }
}
Fixed
nginx
# Fixed: Block dotfiles (/.env, /.git) and serve only the built dist/ folder
server {
  listen 443 ssl;
  root /var/www/myapp/dist;

  location ~ /\.(?!well-known) {
    deny all;
    return 404;
  }

  location / {
    try_files $uri $uri/ /index.html;
  }
}

03 · AI Fix Prompt

Paste into Cursor, Claude Code, Lovable, or Bolt

Lock down exposed dotfiles and server config paths in my deployment:
1. Ensure my web server, reverse proxy (Nginx, Caddy, Apache), or Docker image only serves the compiled build output directory and never the repository root.
2. Add an explicit deny/404 rule for dotfiles (`/.env*`, `/.git/*`) while keeping `/.well-known/*` accessible.
3. Verify `.env*` and `.git` are excluded in `.dockerignore` and deployment upload configs.
4. Rotate any database URLs, API keys, or JWT secrets that were inside an exposed `.env` file.

04 · Developer FAQ

Frequently asked questions

Why do bots constantly scan for /.env and /.git/HEAD?
Automated internet scanners probe newly deployed domains within minutes of DNS propagation looking for /.env and /.git/HEAD because a single hit can hand over database credentials, Stripe secret keys, and full source code.
Will LeakRay trigger false positives on single-page apps that return 200 OK for every route?
No. Many SPAs return index.html with HTTP 200 for unknown paths. LeakRay verifies actual .env KEY=VALUE structure and real git ref syntax (ref: refs/heads/...) before flagging an exposure.
If my .env file was exposed, is blocking it in Nginx enough?
No. Blocking the file stops future leaks, but you must assume any credential that was publicly readable has already been scraped. Rotate every secret in that .env file immediately after locking down the route.
Do Vercel, Netlify, or Cloudflare Pages expose .env files by default?
Managed static/edge hosts generally do not deploy local .env files unless you accidentally copy them into public/ or commit them into a custom container/VPS build. Running a quick live check verifies your production routing.

More Passive Scanners

Supabase · PostgREST · Passive Audit

Supabase RLS & Key Exposure Checker

Passively scan your live app for leaked Supabase service_role keys, exposed PostgREST schemas, and missing RLS signals. Zero signup, <15s.

Open scanner
Next.js · App Router & Pages Router · Passive Audit

Next.js Production Security Scanner

Audit live Next.js apps for __NEXT_DATA__ secret leaks, debug stack traces, exposed source maps, .env files, and missing security headers.

Open scanner
JS Bundles · Entropy + Context Validation · Passive Audit

Leaked API Key & Frontend Secret Scanner

Scan your live HTML and JavaScript bundles for leaked Stripe, OpenAI, Anthropic, Gemini, AWS, and GitHub keys—without false-positive noise.

Open scanner
Firebase · Firestore · Passive Audit

Firebase & Firestore Security Scanner

Passively audit live Firebase apps for leaked Admin SDK keys, exposed .env files, public source maps, and weak security headers without public apiKey noise.

Open scanner
Cursor · Lovable · Bolt · v0 · Passive Audit

Security Scanner for Vibe-Coded Apps

Free pre-launch security check for AI-built apps from Cursor, Claude Code, Lovable, Bolt, and v0. Catch leaked keys, open files, and missing headers.

Open scanner
JavaScript Bundles · .js.map · Passive Audit

Production Source Map Exposure Checker

Check if your live Next.js, Vite, or React app publicly exposes .js.map source maps. Passive URL scan with framework-specific fixes and AI prompts.

Open scanner
Headers · CORS · Cookies · Passive Audit

HTTP Security Headers & CORS Checker

Check HSTS, CSP, SRI, COOP, CORS credential reflection, and cookie flags — plus JS secret & file checks that header-only scanners miss. Zero signup.

Open scanner