← BlogFix prompt3 min readUpdated 2026-08-03

Prompt: fix open Firebase security rules

Test mode expires, and what replaces it is often a rule that allows everyone forever.


Firebase test mode grants open read and write so you can get started. It is meant to be temporary. The common ending is a rule of allow read, write: if true — which is test mode made permanent.

Copy this into Cursor, Claude Code, Lovable or your builder
Audit and fix my Firestore and Storage security rules.

1. Show me the current rules and point out every rule that allows access
   without checking the caller — anything of the form
   allow read, write: if true, or a condition that is always satisfied.
2. Replace them with per-document ownership checks, for example:
     match /orders/{id} {
       allow read, update, delete: if request.auth != null
         && request.auth.uid == resource.data.userId;
       allow create: if request.auth != null
         && request.auth.uid == request.resource.data.userId;
     }
   Note that create must validate request.resource, not resource.
3. Apply the same treatment to Storage rules — buckets are missed far more
   often than collections.
4. Make sure no rule grants access based on a field the client supplies and
   can set freely.
5. Deny by default: anything not explicitly allowed should be refused.

List every collection and bucket, its rule before and after, and what an
unauthenticated caller can do with each afterwards.

What your AI should do with it

  • Ownership checks against request.auth.uid, not just a check that someone is logged in.
  • create handled separately with request.resource — a detail that is frequently wrong.
  • Storage rules covered, not only Firestore.

How to check it worked

Use the Rules Playground

  1. 1Firebase console → Firestore → Rules → Rules Playground.
  2. 2Set the request to unauthenticated and try to read a document in each collection.
  3. 3Every one should be denied.
  4. 4Then simulate user A reading user B's document — also denied.

This is one check out of 40+

Paste your site address and we run the whole list from the outside — leaked keys, open databases, unprotected pages — then hand you one prompt that fixes what we find. Free, about 30 seconds, no signup.

Check my site — free