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.
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?
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.
Confirmed by firebase.google.com
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.
Confirmed by firebase.google.com
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.
Confirmed by firebase.google.com
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.
Confirmed by firebase.google.com
What can I do about it today?
- 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.
- 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.
- List who uses the dataWrite down every app, website or admin tool that reads or writes the database. Tightened rules must keep these working.
- 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.
- 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?
- 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.
- 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.
- 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.
- 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
- Firebase Functions Node Version Deprecated: What NowA Firebase functions Node version deprecated notice means Google is retiring the runtime your functions use.
- AWS emailed me that some of my Lambda functions use a deprecated runtimeYour functions keep running: AWS says you can invoke them indefinitely after a runtime is deprecated.
- I want my app off Firebase and onto a backend I controlUsers, data, files and server code each move separately, and the app must be updated and released through the stores.
- Email Saying Vulnerability Found on My WebsitePay nothing, open no attachments and give no access.
Read next
- req.cookies is undefined or empty in a Firebase Cloud Function behind HostingFix: req.cookies is undefined
- FCM Legacy API Push Fails: Move to HTTP v1 (401)Fix: Console notice that the legacy Firebase Cloud Messaging API is deprecated
- Puppeteer cannot find the browser after deploying to Firebase FunctionsFix: Could not find Chromium