LeakRay
JS Bundles · Entropy + Context Validation · Passive Audit

Leaked API Key & Frontend Secret Scanner

Detect real private credentials accidentally bundled into your live frontend—Stripe live keys, OpenAI/Anthropic/Gemini tokens, AWS access keys, and GitHub PATs—while ignoring public publishable keys.

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
secret-private-keys
Frontend Bundle Secret & Private Key Detection
Scans initial HTML and up to 10 first-party JavaScript bundles using provider signatures, Shannon entropy thresholds, and surrounding context validation to catch Stripe (`sk_live_`), OpenAI (`sk-proj-`), Anthropic (`sk-ant-`), Google Gemini (`AIza...`), GitHub PATs, AWS keys (`AKIA...`), and PEM private keys.Never tests or replays discovered credentials against third-party APIs, and immediately redacts secret values before saving reports.
exposed-env-file
Publicly Accessible .env Files
Checks whether misconfigured static hosting or reverse proxies serve `.env` files containing server-side API keys and database connection strings.Single passive GET request bounded by size and timeout limits; matched values are redacted.
exposed-git-dir
Exposed .git Repository Metadata
Verifies that `/.git/HEAD` and repository metadata are not publicly reachable, preventing attackers from reconstructing source code and historical commits containing rotated secrets.Read-only check on `/.git/HEAD` only—never downloads objects or scrapes repository history.
exposed-sourcemaps
Exposed Source Maps & Unminified Code
Detects publicly accessible `.js.map` files that can reveal commented credentials, internal API endpoints, and server logic.Only checks `sourceMappingURL` pointers referenced by your already-public JS assets.

02 · Vulnerable vs. Fixed

Common production leak pattern and the exact fix

Vulnerable
ts
// Vulnerable: Secret key prefixed with VITE_ / NEXT_PUBLIC_ and called from browser
export async function generateSummary(prompt: string) {
  const res = await fetch("https://api.openai.com/v1/responses", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      // CRITICAL: Compiled verbatim into your public JS bundle
      Authorization: `Bearer ${process.env.NEXT_PUBLIC_OPENAI_API_KEY}`,
    },
    body: JSON.stringify({ model: "gpt-4.1-mini", input: prompt }),
  });
  return res.json();
}
Fixed
ts
// Fixed: Browser calls your own server endpoint; secret stays server-only
// Client component:
export async function generateSummary(prompt: string) {
  const res = await fetch("/api/summarize", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ prompt }),
  });
  return res.json();
}

// Server route (/api/summarize/route.ts):
export async function POST(request: Request) {
  const { prompt } = (await request.json()) as { prompt: string };
  const res = await fetch("https://api.openai.com/v1/responses", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, // Server-only env
    },
    body: JSON.stringify({ model: "gpt-4.1-mini", input: prompt }),
  });
  return Response.json(await res.json());
}

03 · AI Fix Prompt

Paste into Cursor, Claude Code, Lovable, or Bolt

Find and remediate any leaked API keys in my frontend bundles:
1. Search the repository for client-exposed env vars (`NEXT_PUBLIC_*`, `VITE_*`, `REACT_APP_*`, `PUBLIC_*`) and hardcoded key prefixes (`sk_live_`, `rk_live_`, `sk-ant-`, `sk-proj-`, `AKIA`, `ghp_`, `github_pat_`, `AIza`).
2. Keep intentionally public identifiers (Stripe `pk_live_`, Supabase `anon` key, Firebase web `apiKey`) on the client, and move all private/secret keys into server-only API routes, Edge Functions, or Cloudflare Workers.
3. Add server-side rate limiting and authentication to the new proxy endpoint so attackers cannot abuse your upstream API quota.
4. List every compromised key that must be rotated immediately in its provider dashboard.

04 · Developer FAQ

Frequently asked questions

How does LeakRay avoid false positives on Firebase, Maps, or Stripe publishable keys?
LeakRay combines provider prefix matching with Shannon entropy checks, placeholder filtering, and surrounding context analysis. Public identifiers like Stripe pk_live_ keys, Supabase anon keys, and Firebase or Google Maps browser keys are never flagged as critical leaks.
What should I do first if LeakRay finds a live API key in my JavaScript bundle?
Rotate or revoke the key immediately in your provider dashboard (Stripe, OpenAI, Anthropic, AWS, GitHub) before deploying the code fix. Removing a key from your bundle does not invalidate a credential that crawlers or browser caches may have already captured.
Does LeakRay store the full leaked API key in the scan report?
No. Every detected secret is masked and redacted in memory before the finding is persisted or rendered, and all user scan report URLs (/r/[id]) are locked with X-Robots-Tag: noindex, nofollow, noarchive, nosnippet.
Why do AI coding tools like Cursor, Lovable, or Bolt sometimes leak API keys?
When prototyping quickly, generated code often puts an OpenAI, Gemini, or Stripe secret into a VITE_ or NEXT_PUBLIC_ variable so a client component can call the API directly. Running a passive bundle scan before launch catches those mistakes in seconds.

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
Server Config · Dotfiles · Passive Audit

Exposed .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 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