Firebase & Firestore Security Scanner
Verify your live Firebase web app never leaks Admin SDK service-account private keys, exposed config files, or unsafe headers—while keeping intentionally public Firebase web apiKeys noise-free.
01 · Exact Passive Checks
What LeakRay inspects on your live URL
| Rule ID & Check | What It Inspects | Why It's Passive & Safe |
|---|---|---|
secret-private-keysFirebase Admin SDK & Service Account Key Leaks | Scans HTML and up to 10 first-party JavaScript bundles for private PEM blocks, service account credentials, and privileged third-party API keys while filtering out intentionally public Firebase web apiKeys. | Read-only passive inspection; any detected private key is redacted before storage and never replayed against Google Cloud APIs. |
exposed-env-fileExposed .env & Firebase Service Config Files | Checks whether misconfigured hosting or reverse proxies expose /.env files containing FIREBASE_PRIVATE_KEY, GOOGLE_APPLICATION_CREDENTIALS, or database secrets. | Single bounded GET request under 2 MB with strict SSRF protection and soft-404 filtering. |
exposed-sourcemapsPublic Production Source Maps | Detects publicly accessible .js.map files referenced by client bundles that can expose Firestore collection names, security assumptions, and internal API routes. | Only inspects sourceMappingURL references declared by already-public scripts. |
security-headers-coreCSP, HSTS & CORS Hardening for Firebase Hosting | Audits Content-Security-Policy, Strict-Transport-Security, clickjacking headers, and credentialed CORS reflection on live Firebase Hosting or Next.js/Vite origins. | Reads standard HTTP response headers passively without modifying remote state or testing auth flows. |
02 · Vulnerable vs. Fixed
Common production leak pattern and the exact fix
// Vulnerable: Firestore test-mode rules left open in production
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
// CRITICAL: Anyone with your public projectId can read/write all data
allow read, write: if true;
}
}
}// Fixed: Default-deny Firestore rules scoped to authenticated owner UID
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, update: if request.auth != null
&& request.auth.uid == userId;
allow create: if request.auth != null
&& request.auth.uid == userId;
allow delete: if false;
}
match /{document=**} {
allow read, write: if false;
}
}
}03 · AI Fix Prompt
Paste into Cursor, Claude Code, Lovable, or Bolt
Audit my Firebase and Firestore security configuration for production leaks:
1. Inspect `firestore.rules`, `database.rules.json`, and `storage.rules` to eliminate any wildcard `allow read, write: if true` or expired timestamp test-mode rules, enforcing default-deny and `request.auth != null && request.auth.uid == userId` checks.
2. Verify no Firebase Admin SDK service account JSON, `FIREBASE_PRIVATE_KEY`, or PEM private key block appears in client-exposed env vars (`NEXT_PUBLIC_*`, `VITE_*`) or public files.
3. Keep the standard Firebase web `firebaseConfig` (`apiKey`, `projectId`) on the client, and apply Google Cloud API key HTTP referrer restrictions + Firebase App Check.
4. Add baseline security headers in `firebase.json` (`hosting.headers`) for HSTS, CSP, X-Content-Type-Options, and Referrer-Policy.04 · Developer FAQ
Frequently asked questions
- Is it safe to expose my Firebase web apiKey in frontend JavaScript?
- Yes. Firebase web apiKeys identify your project to Google's client SDKs and are meant to be public in browser bundles. Security comes from strict Firestore, Realtime Database, and Storage Security Rules plus Firebase App Check—not hiding the web apiKey.
- What Firebase credentials are actually dangerous if leaked?
- Leaking a Firebase Admin SDK service account JSON or PEM private key grants unrestricted admin access that bypasses all Security Rules. LeakRay flags private keys as critical while keeping public client identifiers noise-free.
- Why do Firestore test-mode rules cause data breaches in AI-built apps?
- Firebase's quickstart test mode allows unrestricted read/write access (if true or if request.time < timestamp). Rapid prototypes built in Cursor, Lovable, or Bolt often ship to production without replacing test rules with per-user auth.uid policies.
- Does LeakRay mutate or dump my Firestore collections during a scan?
- No. LeakRay is strictly passive and read-only (GET/HEAD only), never writes documents or enumerates private user data, and locks every user report (/r/[id]) with X-Robots-Tag: noindex, nofollow, noarchive, nosnippet.
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 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