Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4862 pages

Help for owners

Firebase emailed me that my database rules are insecure

Short answer

The email saying your Cloud Firestore database has insecure rules means the rules that decide who may read and write your data are too open. Firebase's own page warns that with open rules, anyone who guesses your project ID can steal, modify or delete the data. The fix is rewriting the rules, then testing them before they go live.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • Firebase warned me by email that my Firestore data is not properly protected.
  • The Firebase console shows a red warning on the Rules tab.
  • My developer set up the database quickly for the launch and said rules would come later.
  • I am not sure whether customer names, orders or messages can be read by strangers.
  • Someone outside the company mentioned they could see data they should not.

Why does this happen?

  1. The rules allow everyone

    Firebase lists rules that give read and write access to all users as not recommended for production. Its example of an open rule comes with the warning that it lets anyone overwrite your entire database.

  2. Any signed-in user can see everything

    A common half step is rules that only check whether someone is logged in. Firebase points out that this gives any logged-in user read and write access to the whole database, so one customer can read another's records.

  3. Email addresses are trusted without checks

    Rules that grant access based on an email address are weak when emails are not verified. Firebase notes that any user can sign in with an arbitrary email address, and recommends narrowing access to verified emails only.

  4. The rules do not follow the shape of your data

    Firebase advises building rules that match how your data is organized, such as letting people read only the documents they own. Apps that grew quickly often keep one broad rule over everything.

What can I do about it today?

  1. Do not delete data or the projectDeleting removes evidence and customer records without fixing the cause. Leave the data in place while the rules are corrected.
  2. Take a screenshot of the current rulesIn the Firebase console, open Firestore Database and the Rules tab, and save a copy of what is there. It shows how open things were and from when.
  3. List who uses the dataWrite down every app, website or admin tool that reads or writes the database. Tightened rules must keep these working.
  4. Ask what server code touches the databaseFirebase says server client libraries bypass all Security Rules. Your developer should list any back end jobs, because they need their own access controls in Google Cloud.
  5. Get legal advice if data may have leakedIf personal data could have been read by outsiders, speak to someone qualified about your duties to customers and regulators. That decision should not wait for the technical fix.

When should I bring someone in?

  • Customer personal data, payments or private messages sit in the database.
  • Your developer is no longer around and nobody understands the current rules.
  • Tightening the rules breaks the app and you need both safety and a working product.

How do I handle it?

  1. Map who should read and write whatI list each collection, who owns each document and which screens need it, and turn that into plain access rules before writing any code.
  2. Write and test the rules away from productionNew rules are tested in the Cloud Firestore emulator with automated cases, and spot checked in the Rules Playground in the Firebase console.
  3. Release with a watch on errorsAfter deploying the rules I watch the app for permission errors, which show where a screen still relied on the old open access.
  4. Review server access separatelyBecause server libraries skip the rules, I check the service accounts and IAM roles the back end uses and remove what it does not need.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Is the Firebase insecure rules email a scam?

Check it in the console instead of clicking links: open your project, then Firestore Database and the Rules tab. If the rules let all users read and write, the warning is real.

Can anyone really read my Firestore data with open rules?

Firebase's documentation says that with insecure rules anyone who guesses your project ID can steal, modify or delete the data.

Will fixing Firestore security rules break my app?

It can, when screens depend on the open access. That is why the new rules are tested in the emulator first and the app is watched for permission errors after release.

Is requiring login enough to secure Firestore?

No. Firebase lists rules that let any logged-in user read and write everything as insecure. Rules should limit each user to their own data.

Sources

For your developer: the technical fixes

Related help

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.