Skip to content
VibeSafeDaily

Guide

Firebase security rules allow read, write if true: check your own project

Published November 22, 2026 · Guides

What Firebase's open rules and the CLI's 30-day Firestore template allow, what one public-web scan counted, and a check you run only on a project you own.

This guide is for people who built an app with Cursor, Bolt, Lovable, Replit, v0, or FlutterFlow and store data in Cloud Firestore, Realtime Database, or Cloud Storage for Firebase. It explains the rules Firebase documents as open, the starter rule in the Firebase CLI, and a check you can run on a project you own. It does not name any app from the public-web scan below.

Run the checks only on a project you own or are allowed to administer. Do not point them at someone else's project, URL, or key.

What an open rule allows

The insecure-rules guide, last updated November 18, 2026, says that when you create a database or a Cloud Storage bucket in the Firebase console, you choose Locked mode or Test mode. Locked mode denies access to all users. Test mode grants access to all users. The basic rules page says the Locked mode default for Cloud Firestore and Realtime Database denies access to all users, and that in Cloud Storage only authenticated users can access the buckets. The Locked mode sample on that page is allow read, write: if false for Storage as well. The insecure-rules page says you might think you are the only person using the app, but a deployed app is on the internet, and anyone who guesses the project ID can steal, modify, or delete the data if you are not authenticating users and configuring rules.

The open-access example for Cloud Firestore is allow read, write: if true on match /{document=**}. The comment in that example says never use this ruleset in production, because it allows anyone to overwrite the entire database. read and write are convenience methods. The rules language page says they enable broad read and write access. The same page says an allow with no condition, such as allow read, always allows that method. That is the Cloud Storage example on the insecure-rules page: allow read, write; with no if. The Realtime Database example is ".read": true and ".write": true.

Firebase's open-access example for Cloud Firestore. The comment on that page says never use it in production.
match /{document=**} {
  allow read, write: if true;
}

A second pattern only checks that someone is signed in. The insecure-rules page says if a rule includes auth != null, confirm that you want any logged-in user to have access. The not-recommended Firestore example is allow read, write: if request.auth.uid != null. The Firestore version of that page uses request.auth != null. Either one is true for every signed-in account, including an account created to read the data. The any-signed-in-user card is the short version. The open-rules card is the if true case.

Rules combine with OR, not AND. The Security Rules overview says that if multiple rules match a path and any matched condition grants access, access is granted. A stricter rule under match /{document=**} does not cancel if true. Realtime Database rules cascade in the same direction: a child cannot revoke a read the parent already allowed. The cascade card quotes that example.

What happens when test mode expires

The Firebase console calls the open choice Test mode. This guide did not find a Firebase docs page that prints the exact ruleset the console writes for that choice. The starter file the Firebase CLI writes is public, in the firebase-tools repository: templates/init/firestore/firestore.rules. The comment in that file says the rule allows anyone with your database reference to view, edit, and delete all data, that it is useful for getting started, and that it is configured to expire after 30 days because it leaves the app open to attackers. At that time, all client requests to the database will be denied until you update the rules. The rule itself is allow read, write: if request.time < timestamp.date(...).

The shape of the CLI starter. The file fills in a date 30 days out. After that date the comparison is false, and the comment says client requests are denied.
allow read, write: if request.time < timestamp.date(YYYY, M, D);

An expired date is a locked rule, not an open one. Replacing it with if true removes the expiry. Moving the date forward keeps the comment's "anyone with your database reference" access until the new date. The FlutterFlow Firestore rules page, last updated October 26, 2026, says that before publishing you should remove default rules such as allow read, write: if request.time < timestamp.date(2024, 5, 31); and exit Test mode. The dates in that example are in the past. The instruction is to remove the rule, not evidence that FlutterFlow still stamps a future date.

The Storage starter in the same repository is the other way around. templates/init/storage/storage.rules is allow read, write: if false. There is no Realtime Database file under templates/init. A closed Storage template does not mean a later edit left Storage open. Read the deployed rules.

What one public-web scan counted

The write-up is 900 Sites, 125 million accounts, 1 vulnerability by mrbruh, xyzeva, and logykk on env.fail. The page does not show a publication date. They looked for Firebase configuration variables in websites or the JavaScript those sites loaded, across what they describe as 5 1/2 million domains. A later pass, which they call Catalyst, checked read access to common collection names and to collections named in that JavaScript. When a collection was readable, they took a sample of 100 records, checked the type of information, and extrapolated by the size of the collection.

The numbers list on that page is:

  • All (records): 124,605,664
  • Names: 84,221,169
  • Emails: 106,266,766
  • Phone Numbers: 33,559,863
  • Passwords: 20,185,831
  • Billing Info (Bank details, invoices, etc): 27,487,924

The next sentence on the page is: "These numbers should be taken with a grain of salt. They are likely larger than shown here." The title says 900 sites and 125 million accounts. The introduction says hundreds of sites and about 125 million user records, including plaintext passwords and billing information. The page does not explain the gap between 900 and "hundreds," or between accounts and records. An earlier manual pass, before that automation, is a different count: 136 sites and 6.2 million records. The category figures are extrapolations from 100-record samples, not a full export.

What those counts do not mean

The scan is not a measurement of Cursor, Bolt, Lovable, Replit, v0, or FlutterFlow. It does not say the sites were built with a coding tool. It checked read access. It does not show that every readable database also allowed writes. The passwords line is labeled "Passwords." The introduction says the exposed records included plaintext passwords. The numbers list does not say how many of the 20,185,831 were plaintext, so this guide does not turn that label into a plaintext count.

This guide also does not have a count of how often those coding tools emit if true. No such study was found in Firebase's docs or in a researcher write-up that stated its method. The sections below stay with what those docs do say.

Why a generated project still has the open rule

Test mode and the CLI starter are the documented ways a new Firestore database starts open. FlutterFlow's connect-to-Firebase page, also updated October 26, 2026, says that to get started quickly you can select Start in test mode, and that you should update the rules before deploying. On the Firestore rules page, a new collection in the FlutterFlow content manager starts as Create: Everyone, Read: Everyone, Write: No One, Delete: No One. Everyone, on that page, means authenticated and unauthenticated users. The page says that default is suitable while you are getting started, that a new notes collection allows everyone to read all notes, and that you should limit collections with private information before the app goes live. It also says FlutterFlow shows a warning when a collection is marked Has Private Data. Rules take effect when you deploy them.

That is a public-read and public-create default, not a public update or delete. It is also one product's documentation. It is not a finding about Cursor, Bolt, Lovable, Replit, or v0. A project from any of those tools can still contain the Firebase sample, because if true is the shortest rule that makes every client call succeed, and it is the sample Firebase prints in order to say never use it. A project that still has the CLI date rule, Test mode, or request.auth != null as the only check is the case this guide is for. There is no published rate for how often that happens.

The key in the client is not the lock

The API keys page says Firebase API keys are public by design. They identify the project. They do not control which end user can read Realtime Database, Cloud Firestore, or Cloud Storage. Security Rules do that. App Check controls which apps can reach covered APIs. The same page says not to rely only on restricting or obscuring the key. A web app's config puts that key in apiKey. Finding the key in the page does not, by itself, mean the database is public. Finding if true in the deployed rules does.

The same page separates the Gemini Developer API key from the Firebase key. The Gemini key is not one to leave in the client. That is a different problem from database rules. OpenAI, Anthropic, Stripe secret keys, and the Supabase secret key are the same kind of problem. The API key guide is that check.

Server access is a different door. The Firestore insecure-rules page says the server client libraries bypass Cloud Firestore Security Rules and use Google Application Default Credentials instead. The Admin SDK and Cloud Functions can still read a database whose rules are if false. A script that succeeds with a service account does not tell you what a visitor can do.

Check your own project

Use a project you administer. The order below is the rules text, then the Rules Playground, then the emulator, then one read-only request. Stop if a response contains documents or file bytes. Do not page further, and do not write.

1. Read the deployed rules

The insecure-rules page says the Firebase console always shows the most recently deployed rules. Select your project, open Realtime Database, Cloud Firestore, or Storage, and click Rules. If you also deploy from a file named in firebase.json, compare that file with the console. The page says to edit rules with one method consistently, so a local deploy does not overwrite a console edit, or the reverse.

On a private collection, any of these is the failure:

  • allow read, write: if true, or the same if true on read or write alone, unless that read is meant to be public.
  • allow read, write; with no condition. The rules language page says that always allows the method.
  • allow read, write: if request.time < timestamp.date(...) while that date is still ahead. After the date, the CLI comment says client requests are denied. The rule is still the starter, not an owner check.
  • request.auth != null or request.auth.uid != null as the only condition.
  • Realtime Database ".read": true or ".write": true, or a parent whose only check is auth.uid !== null.
The signed-in-only shape from the Firestore insecure-rules page. It blocks a signed-out visitor and allows every account.
allow read, write: if request.auth != null;

2. Run the Rules Playground

The Firestore insecure-rules page says to open the Rules Playground from the Rules tab. Choose a read or a write, a path, an authentication type, and any document fields the rule reads. The authentication types it names are unauthenticated, authenticated anonymous, and a specific user ID. Click Run and read the banner above the rules. The playground reports whether that simulated request was allowed or denied. It does not download the database.

For a private document, run it three times. Signed out, the read and the write should be denied. As a second user id, a read of the first user's document should be denied. As the owner, the read should be allowed. An anonymous user is one of the authenticated types on that page, so a rule that only checks request.auth != null is the case to try with that type. Do this for each product whose Rules tab offers the playground. The open-rules card calls the same control the Rules Simulator.

3. Use the emulator for a rules file, and know its default

The insecure-rules page says to use the emulator to run unit tests before you deploy. The unit-tests page says the emulator loads the rules named by firestore.rules or storage.rules in firebase.json. If that file does not exist, and the test does not call loadFirestoreRules or loadStorageRules, the emulator treats all projects as having open rules. An allow in that situation is the emulator default, not a copy of production. The same page says the version 9 @firebase/rules-unit-testing library never touches production resources. For the Realtime Database emulator, the page says each new database starts with closed rules, so a non-admin user cannot read or write until you load rules. Those two defaults are not the same product.

4. One read-only request, against your own project

The playground is the check that does not return data. A single GET is the check that the live rules allow or refuse a signed-out read. Use your own database. Do not add a write method.

For Realtime Database, the REST auth page says any data that is publicly readable or writable under your rules is also readable and writable through the REST API with no authentication. A Google OAuth2 access token from a service account is how that page says a server bypasses the rules. Do not send one. Copy the database URL from your own console. The unit-tests page shows a production URL as a subdomain of firebaseio.com. If the console shows a different host, use that host. Append /.json?shallow=true. The retrieve-data page says shallow=true is for reading without downloading everything, and that when the location holds a JSON object the values are truncated to true. A primitive at that location is returned as itself. A successful request is HTTP 200.

GET only. No auth parameter and no access_token. Replace the host with the URL from your own console. Delete the output file when you are done.
curl -s -o /tmp/rtdb-shallow.json -w "%{http_code}\n" \
  "https://YOUR_DATABASE.firebaseio.com/.json?shallow=true"

HTTP 200 and a JSON object means those keys were readable with no authentication. A rejection means that unauthenticated read was not allowed. This page does not have a Firebase sentence that names the rejection status code, so do not treat some other code as proof. If you see values rather than true, stop. Do not remove shallow=true, and do not request a child path to see what is inside.

For Cloud Firestore, the REST API page says unauthenticated requests, and requests with a Firebase ID token, are authorized by Security Rules. A Google Identity OAuth 2.0 token from a service account ignores the rules and uses IAM. The API Explorer on that page generates that OAuth token. Do not use it for this check, and do not send Authorization. The documents.list reference is a GET, and pageSize is the maximum number of documents in the response. Firestore may return fewer. That reference also says the method requires an OAuth scope. The Firebase page says an unauthenticated request is decided by rules. If the call comes back UNAUTHENTICATED, the error table on the Firebase page says the request did not include valid credentials. That is not a rules answer. Do not repair it with a service account. Use the playground.

No Authorization header. Your project id and one collection your own app already uses. pageSize=1. Do not follow pageToken.
curl -s -o /tmp/firestore-check.json -w "%{http_code}\n" \
  "https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/YOUR_COLLECTION?pageSize=1"

The Firebase error table says PERMISSION_DENIED means the user is not authorized. That is the result you want for a private collection. HTTP 200 means the rules allowed the read. The body can be empty when the collection has no documents, so an empty 200 does not prove the rule is tight. If the body contains documents, stop, delete the file, and do not request another page. Trust the rules text and the playground over an empty body.

This guide does not add a Storage download. An allow read with no condition is already the answer in the rules file, and the playground covers a simulated read. Do not fetch objects to confirm it.

5. Replace the rules that failed

The insecure-rules page's content-owner example compares request.auth.uid with author_uid on the document. Create checks the incoming document, request.resource. Read and delete check the stored document, resource. Update checks both, so the owner cannot be changed in the same write. Replace some_collection and author_uid with the names in your project. A signed-out request has no uid, so the comparison fails closed.

Firebase's content-owner example. It does not include a recursive wildcard. Delete match /{document=**} if that wildcard still allows access.
match /some_collection/{document} {
  allow read, delete: if request.auth.uid == resource.data.author_uid;
  allow create: if request.auth.uid == request.resource.data.author_uid;
  allow update: if request.auth.uid == request.resource.data.author_uid
                && request.auth.uid == resource.data.author_uid;
}

The conditions guide shows field checks on the incoming document. Its update example requires population > 0 and an unchanged name. Those are the sample fields, not a schema to copy. Put the same kind of check on the fields your app writes, next to the owner check. The guide also says rules are not filters: a query for every document in the collection is rejected when the rule depends on a field, unless the query itself constrains that field. After you tighten a rule, a client that used to read the whole collection can start failing for that reason.

Firebase's data-validation example. Replace cities, population, and name. This block does not check the owner.
match /cities/{city} {
  allow update: if request.resource.data.population > 0
                && request.resource.data.name == resource.data.name;
}

For Realtime Database, the basic rules page puts each user's data under a path keyed by $uid and requires auth.uid === $uid. Keep private data off a parent that already sets ".read": true.

Firebase's content-owner example for Realtime Database. Replace some_path. A nested .read of false under an open parent does not apply.
{
  "rules": {
    "some_path": {
      "$uid": {
        ".read": "auth !== null && auth.uid === $uid",
        ".write": "auth !== null && auth.uid === $uid"
      }
    }
  }
}

For Storage, the insecure-rules page allows read and write when request.auth.uid == userId and the path is user/{userId}/{fileName}. The Storage conditions page shows a separate write check: size under 5 MB and a content type matching image/.*. That size check does not look at request.auth. The same page's public example uses allow read; with no condition, which always allows the read. Use that only for files you mean to publish. The page says an unauthenticated request has request.auth of null.

Firebase's user-private Storage example. allow read with no condition is a different sample, and it publishes the file.
match /user/{userId}/{fileName} {
  allow read, write: if request.auth.uid == userId;
}
Firebase's Storage validation example. It limits size and type. It does not limit who can upload.
match /images/{imageId} {
  allow write: if request.resource.size < 5 * 1024 * 1024
               && request.resource.contentType.matches('image/.*');
}

A domain check on request.auth.email is a separate hole. The Firestore insecure-rules page says to add request.auth.email_verified. The unverified-email card is that case. Deploy, then repeat the playground runs. A public catalog can keep allow read: if true and still restrict writes to the owner. That mixed pattern is also on the insecure-rules page. Do not extend it to writes.

App Check is a second layer

The App Check page, last updated November 18, 2026, says App Check attests that a request comes from your app, from an untampered device, or both. With enforcement on, requests without a valid token are rejected. The page says App Check prevents some, but not all, abuse, and does not guarantee that all abuse is gone. It also says App Check and Firebase Authentication are complementary: Authentication says which user, App Check says which app.

The API keys page assigns the same split to rules and App Check. Rules decide which end user can reach the data. App Check decides which app can call a covered API. Firebase's July 30, 2026 post on three layers says rules and Authentication can verify who the user is, and cannot verify what is making the request. With the Firebase config, a client can call the API directly. That post presents App Check as the check for that, not as a substitute for the rules. An if true ruleset still allows a client that presents a valid App Check token, and it still allows a client calling a product where App Check is not enforced.

Turning enforcement on can also block a build that never initializes App Check. That is a separate failure from an open ruleset. The Firebase AI Logic card is the case where Gemini calls start failing. This guide does not copy those dates onto Firestore, Realtime Database, or Storage.

Paste this into the coding tool

The prompt is for the tool that has your own project open. It tells that tool to stay on this project's rules.

In this project's Firebase Security Rules only. Do not open any other Firebase project, and do not read or write another project's data.

1. Find the deployed rules, not an old local copy. In the Firebase console, open Realtime Database, Cloud Firestore, and Storage, and open Rules on each. The console shows the most recently deployed rules. If this repo also has firestore.rules, storage.rules, or a Realtime Database rules file named in firebase.json, compare them. Editing one place and deploying it overwrites the other.

2. List every match or path that is still one of these:
   - allow read, write: if true
   - allow read: if true, or allow write: if true, on data that is not meant to be public
   - allow read, write with no if condition
   - allow read, write: if request.time < timestamp.date(...)
   - allow read, write: if request.auth != null, or request.auth.uid != null, when that is the only condition on private documents
   - Realtime Database ".read": true or ".write": true, or a parent rule whose only check is auth.uid !== null or auth !== null
   Do not delete a public read the product intends, such as a public catalog. Say which collections you are treating as public and why.

3. Replace private Cloud Firestore access with owner checks. Use the owner field this project already stores. The shape from Firebase's insecure-rules page, with author_uid standing in for that field:

   allow read, delete: if request.auth.uid == resource.data.author_uid;
   allow create: if request.auth.uid == request.resource.data.author_uid;
   allow update: if request.auth.uid == request.resource.data.author_uid
                 && request.auth.uid == resource.data.author_uid;

   Remove any match /{document=**} that still allows read or write. Rules are OR. A stricter rule does not cancel a broader one.

4. On create and update, add checks for the fields this project writes. Firebase's conditions guide shows the pattern with a population field that must be greater than 0 and a name that must not change. Use this project's fields. Do not invent fields. A query that reads a whole collection must include the same constraint the rule checks. Rules are not filters.

5. For Realtime Database, put private data at a path keyed by the user's uid, with ".read" and ".write" of auth !== null && auth.uid === $uid. Do not nest ".read": false under a parent that already allows read. Child rules cannot take that access away.

6. For Cloud Storage, allow read and write only when request.auth.uid equals the user id in the path. Do not leave "allow read" with no condition on private files. If uploads should be images under a size limit, add the request.resource.size and request.resource.contentType checks from the Storage conditions guide. A size check alone does not check who is uploading.

7. Do not treat Firebase App Check as a replacement for these rules. App Check attests the app. Security Rules decide which user can reach which data. Do not remove a rule because App Check is on.

8. Deploy the rules to this project only. In the Rules Playground, as a signed-out user, a read and a write of a private document must be denied. As a second user id, a read of the first user's document must be denied. As the owner, the read must be allowed.

Do not print document contents, file contents, API keys, or tokens. Do not send a service-account token or a Google OAuth token to test the rules. Those requests bypass Cloud Firestore Security Rules.

What a passing check does not mean

A denied playground run means that simulated request was denied. It does not prove every collection, every Storage path, or every Realtime Database node is covered. A 200 from the Firestore GET means that one collection allowed the read. A rejection on a different collection does not speak for this one. The Admin SDK bypasses the rules, so a server read is not the test.

The env.fail counts are not a breach of Firebase, and they are not a breach of Cursor, Bolt, Lovable, Replit, v0, or FlutterFlow as products. They are records the researchers say were readable from sites whose Firebase configuration was in the page or the script. An expired test-mode date does the opposite of those open rules: the CLI comment says client requests are denied. The repair is an owner check, not a wider date and not if true.

Common questions

What does allow read, write: if true mean?

Firebase's insecure-rules guide uses that rule as the open-access example, on match /{document=**}. The comment in the example says never use it in production, because anyone can overwrite the database. Test mode is the console choice that grants access to all users. The rules language page says read and write are convenience methods for broad access, and an allow with no condition always allows that method. Rules are OR, so a stricter rule does not cancel this one.

Firestore test mode expired and the app can no longer read. What happened?

The Firebase CLI's Firestore init template allows read and write while request.time is before a timestamp.date value, and the comment in that file says the rule expires after 30 days. After that date, the same comment says all client requests are denied until you update the rules. An expired date is closed, not open. The Firebase docs page for the console's Test mode choice does not print that ruleset. FlutterFlow's rules page says to remove a default rule of that shape and exit Test mode before publishing. Replacing the date check with if true is the open rule Firebase says never to use in production.

Is my Firebase database public if the API key is in the app?

Firebase's API keys page says the key identifies the project and is safe to put in client code. Security Rules decide which end user can read Realtime Database, Cloud Firestore, and Cloud Storage. App Check decides which app can call a covered API. The key in the page does not, by itself, mean the data is public. allow read, write: if true in the deployed rules does. A service-account request bypasses Cloud Firestore Security Rules, so it is not this test.

Signed-out visitors are blocked, but any new account can read every document. Which rule is that?

Firebase documents allow read, write: if request.auth != null, and the variant request.auth.uid != null. The insecure-rules page says if a rule includes auth != null, confirm you want any logged-in user to have that access. Signing in is not the same as owning the document. The Rules Playground lists an authenticated anonymous user as an authentication type, separate from unauthenticated.

Does Firebase App Check replace security rules?

Firebase describes App Check and Security Rules as different checks. The App Check page says it attests the app or device, prevents some but not all abuse, and complements Firebase Authentication. The API keys page gives Security Rules and App Check different jobs: which user, and which app. The July 30, 2026 Firebase blog describes the same split. A ruleset of if true still allows a client that has a valid App Check token, and a product where App Check is not enforced.

I added a stricter rule and the open rule is still there. Why does the read succeed?

The Security Rules overview says rules are OR. If any matching condition grants access, access is granted, and a broader rule cannot be tightened by a more specific one. Delete the match /{document=**} that still has if true, or the Realtime Database parent that already allows read. A child .read of false does not revoke the parent. The Firebase CLI comment says a timestamp.date comparison that is already in the past denies client requests. That expired rule is not what is granting the read.

The daily card

One break a day: the symptom, the cause, a prompt for your own project, and a short check. The address is not on the list until you confirm it.

One card a day, after you confirm. We email a confirmation link. You are not subscribed until you click it.

By signing up you agree to receive the daily card by email. You can unsubscribe any time. Privacy · Terms

Sources

Related cards