Exposed .git Directory & Config Checker
Verify that your web server, Docker container, or static host never exposes /.git/HEAD or /.git/config publicly—preventing attackers from reconstructing your full source code and historical secrets.
01 · Exact Passive Checks
What LeakRay inspects on your live URL
| Rule ID & Check | What It Inspects | Why It's Passive & Safe |
|---|---|---|
exposed-git-dirPublic /.git/HEAD Repository Exposure | Checks whether /.git/HEAD responds with HTTP 200 and a real Git ref (ref: refs/...) while filtering out HTML soft-404 catch-all pages returned by SPAs. | Single read-only GET request on /.git/HEAD only—never fetches /.git/config, objects, packfiles, or commit history. |
exposed-env-fileExposed /.env Alongside Repository Root | Detects publicly served /.env files that often leak alongside .git directories when an entire repo root is deployed as the webroot. | Single bounded GET request under 2 MB; matched values are automatically redacted before storage. |
exposed-backup-filesExposed .DS_Store & SQL Backup Dumps | Checks for leftover /.DS_Store directory metadata and public /backup.sql or /dump.sql artifacts deployed by rsync, FTP, or sloppy Docker builds. | Passive GET inspection on a tiny fixed list of known artifacts with strict size and timeout caps. |
secret-private-keysLeaked Private Keys in Live Frontend Assets | Scans HTML and first-party JavaScript bundles for live API keys, tokens, and PEM blocks that may also appear in exposed repo files. | Never tests or replays discovered credentials and masks every matched secret before saving reports. |
02 · Vulnerable vs. Fixed
Common production leak pattern and the exact fix
# Vulnerable: Dockerfile & Nginx shipping .git inside webroot
# Dockerfile (missing .dockerignore)
COPY . /var/www/app
# nginx.conf
server {
listen 443 ssl;
root /var/www/app; # Serves /.git/HEAD and /.git/config publicly!
}# Fixed: Exclude .git in .dockerignore and deny dotfiles at the proxy
# .dockerignore
.git
.env
.env.*
# nginx.conf
server {
listen 443 ssl;
root /var/www/app/dist;
location ~ /\.(?!well-known) {
deny all;
return 404;
}
}03 · AI Fix Prompt
Paste into Cursor, Claude Code, Lovable, or Bolt
Eliminate any public .git directory exposure in my repository and deployment pipeline:
1. Add `.git`, `.env`, `.env.*`, and `.DS_Store` to `.dockerignore` and any rsync/S3/static deploy ignore rules.
2. Update my Nginx, Caddy, Apache, or Cloudflare Worker routing so all dotfiles except `/.well-known/*` return HTTP 404.
3. Verify the web server root points only to the compiled public build directory (`dist/`, `.next/`, `out/`) rather than the repository root.
4. If `/.git/HEAD` was publicly reachable in production, list every secret ever committed to git history so I can rotate them immediately.04 · Developer FAQ
Frequently asked questions
- Why is an exposed /.git/HEAD or /.git/config directory rated Critical?
- When /.git metadata is publicly readable, automated tools can fetch .git/HEAD, .git/config, .git/index, and compressed git objects to rebuild your entire server source code, private remote URLs, and historical commits containing rotated or forgotten credentials.
- Will LeakRay falsely flag my React or Next.js SPA when /.git/HEAD returns index.html?
- No. Many single-page apps return HTTP 200 with HTML for every unknown route. LeakRay checks the Content-Type, rejects HTML responses, and verifies that the body starts with a valid Git ref (ref: refs/...) before raising a finding.
- How does a .git folder accidentally end up in production?
- The most common causes are deploying via git pull directly inside a webroot, running COPY . . in a Dockerfile without .git in .dockerignore, or syncing a project folder to an S3/R2 bucket or VPS with rsync without --exclude=.git.
- If I block /.git in Nginx now, do I still need to rotate my secrets?
- Yes. Internet-wide scanners probe newly registered domains for /.git/HEAD within minutes. If your .git directory was exposed publicly, treat any credential that ever existed in the repository or .git/config as compromised and rotate it.
More Passive Scanners
Explore related LeakRay checks
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 AuditNext.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 AuditLeaked 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 Server Config · Dotfiles · Passive AuditExposed .env & .git File Checker
Check if your live website publicly exposes /.env, /.git/HEAD, or backup config files. Passive read-only URL scan with instant fixes. Zero signup.
Open scanner Firebase · Firestore · Passive AuditFirebase & 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 AuditSecurity 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 AuditProduction 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 AuditHTTP 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 CORS · Origin Reflection · Passive AuditCORS Misconfiguration & Reflection Checker
Test your live app for dangerous CORS origin reflection paired with Access-Control-Allow-Credentials: true. Passive read-only check with instant code fixes.
Open scanner GraphQL · __schema · Passive AuditGraphQL Introspection Exposure Checker
Verify whether /graphql or /api/graphql exposes your full __schema to unauthenticated callers in production. Read-only passive scan with Apollo & Yoga fixes.
Open scanner Set-Cookie · HttpOnly · Secure · SameSiteCookie Security Flags Checker
Audit Set-Cookie headers on your live app for missing HttpOnly, Secure, and SameSite flags on session and auth cookies. Zero signup, passive URL scan.
Open scanner Lovable · Supabase · Vite · Passive AuditLovable App Security & Supabase Scanner
Passive pre-launch security check for Lovable apps: catch leaked Supabase service_role keys, missing RLS signals, public source maps, and missing headers.
Open scanner Bolt.new · Vite · Client Bundles · Passive AuditBolt.new Security & Vite Bundle Scanner
Scan live Bolt.new and Vite apps for VITE_* client bundle leaks, exposed .env files, public .js.map source maps, and BaaS key misconfigurations in <15s.
Open scanner Cursor · Vercel v0 · Next.js · Passive AuditCursor & v0 Next.js Security Scanner
Audit live Next.js apps built with Cursor and Vercel v0 for __NEXT_DATA__ leaks, NEXT_PUBLIC_* secrets, debug routes, source maps, and missing headers.
Open scanner