Is request.auth != null enough in Firebase rules?
No. It only proves someone is signed in, not that the data is theirs. Covers a two-account test, test-mode rules, the Rules Playground and role fields.
No. request.auth != null only proves the caller is signed in, not that the data is theirs. If your app lets anyone sign up, any new account can read and write everything that rule covers. Firebase's docs call this pattern not recommended. Add an ownership or role check, then test it with two accounts.
What does request.auth != null actually check?
It checks that the request carries a signed-in user. It says nothing about which user, or whose document. Firebase's insecure-rules page names the pattern "Access for any authenticated user": rules that "check that a user is logged in, but don't further restrict access based on that authentication." Its example of a not-recommended rule is one where "Any logged-in user has read and write access to your entire database." [1] The docs add that if a rule includes auth != null, you should confirm you want any logged-in user to have access to that data. [2]
The rules carry the weight here. The docs say: "Firebase Security Rules are the only safeguard blocking access for malicious users." [3] Firebase API keys are meant to sit in your app code (see which API keys belong in a website), so the keys are not the control. The rules are. [4]
How do I test it with two accounts, no code?
- Make two test accounts in your app, A and B, with different emails.
- Signed in as A, create something private: a note, an order, a profile. Copy its link or ID if the app shows one.
- Sign out, sign in as B. Try to open A's item by its link, edit it, and delete it. Look at any list screen: does B see A's items?
- Try to change something B should not control, such as its own plan, role or "is admin" setting, from any screen or form that allows edits.
- Repeat while signed out.
If anything succeeds that should not, the rule checks "signed in" and not "owner". A pass only covers what you tried.
What are test-mode rules, and why do they matter?
When you create a Firestore database or Cloud Storage bucket, the console offers "Test mode". Firebase's page says it grants access to all users and leaves the data open to anyone. It also warns "NEVER use this ruleset in production; it allows anyone to overwrite your entire database." [1] The quickstart says test mode "allows anyone to read and overwrite your data." [5]
Test-mode rules are often written with a date, for example allow read, write: if request.time < timestamp.date(2026, 12, 1);. That rule is open to everyone until that date. We did not find the exact default expiry in Firebase's current docs, so check the date in your own rules. If it is in the future, the database is open until then. If it is in the past, the app may already be failing.
Look in your rules file for:
if true- a
request.time <condition with a date and no check on who is asking request.auth != nullwith nothing after it
How do I try my rules in the Rules Playground?
In the Firebase console, open Firestore, then the Rules tab, and click Rules Playground. Firebase's instructions: select your simulation options, then click Run. [6] Run it twice for the same document. First as a signed-in user whose ID is the owner's, then as a signed-in user whose ID is different. The second run should be denied. Then run it unauthenticated. For repeatable checks, Firebase recommends the Local Emulator Suite to run and automate unit tests locally. [6]
Why should users never write their own role or plan field?
Say a profile document holds role: "member" or plan: "free", and the rule lets the owner update the whole document. Then a user can set their own role to admin or their own plan to paid. That is a paid-plan bypass.
Firebase's docs give two tools. One is an allowlist of fields a user may change; the docs call this generally stricter, because new fields are disallowed until you add them. The other is custom claims for roles, which "should only be set from a privileged server environment by the Firebase Admin SDK". [7][8] Rules also cannot hide individual fields from readers, so move sensitive fields into a separate document with a stricter rule. [7]
What has gone wrong in real apps?
- Quittr, reported by 404 Media and relayed by Techlicious on 2026-03-10. A flaw "allowed anyone who could authenticate as a user to potentially access the backend database". The records belonged to more than 600,000 users, about 100,000 of whom identified as minors. A researcher reported it in September 2025, and months later the database was still reachable. That is the "signed in is enough" shape. The Techlicious article does not name Firebase. Other reports do, but we could not open them, so treat the Firebase detail as unconfirmed. Whether the app was built with AI tools is not established. [9]
- Tea, July 2025. A storage bucket held about 72,000 images. BleepingComputer reported that an anonymous 4chan user said Tea used an unsecured Firebase storage bucket. Tea has not confirmed that, and called it a "legacy data storage system". Nothing we checked says Tea was AI-built. [10]
For developers: ownership rules
Here is a starting point for a notes collection where each document has an ownerId. It checks ownership on read, binds new documents to the caller, blocks changing the owner, and lets an update touch only listed fields:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /notes/{noteId} {
allow read: if request.auth != null
&& resource.data.ownerId == request.auth.uid;
allow create: if request.auth != null
&& request.resource.data.ownerId == request.auth.uid
&& request.resource.data.keys().hasOnly(['ownerId', 'title', 'body']);
allow update: if request.auth != null
&& resource.data.ownerId == request.auth.uid
&& request.resource.data.ownerId == resource.data.ownerId
&& request.resource.data.diff(resource.data)
.affectedKeys().hasOnly(['title', 'body']);
allow delete: if request.auth != null
&& resource.data.ownerId == request.auth.uid;
}
match /users/{userId} {
allow read: if request.auth != null && request.auth.uid == userId;
// profile fields only; role and plan are not in this list
allow update: if request.auth != null
&& request.auth.uid == userId
&& request.resource.data.diff(resource.data)
.affectedKeys().hasOnly(['displayName', 'photoURL']);
}
}
}Notes on the pattern:
resource.datais the stored document.request.resource.datais the document as it will be after the write. [2]keys().hasOnly([...])lists the fields allowed on create. On update, compare withdiff(resource.data).affectedKeys(). [7]- Grant roles from a server with the Admin SDK as custom claims, and read them in rules from
request.auth.token. Never from a field the user can write. [8] - Rules for Cloud Storage need their own owner-or-path checks. They are separate from Firestore rules.
- Run the unit tests in the Local Emulator Suite, so a later edit that reopens a collection fails a test. [6]
ShipSafe reads a GitHub repo, including Firebase rules files, and reports weak rules in plain English with the file and the line. Details and plans are on the pricing page, and the scanner is at ship-safe.co.
Sources
- Firebase docs, "Fix insecure rules": https://firebase.google.com/docs/rules/insecure-rules (checked 2026-11-20)
- Firebase docs, Firestore Security Rules conditions: https://firebase.google.com/docs/firestore/security/rules-conditions and Firestore insecure rules: https://firebase.google.com/docs/firestore/security/insecure-rules (checked 2026-11-20)
- Firebase docs, Security Rules basics: https://firebase.google.com/docs/rules/basics (checked 2026-11-20)
- Firebase docs, API keys for Firebase: https://firebase.google.com/docs/projects/api-keys (checked 2026-11-20)
- Firebase docs, Firestore quickstart: https://firebase.google.com/docs/firestore/quickstart (checked 2026-11-20)
- Firebase docs, Get started with Firestore Security Rules (Rules Playground, Local Emulator Suite): https://firebase.google.com/docs/firestore/security/get-started (checked 2026-11-20)
- Firebase docs, Security Rules and fields: https://firebase.google.com/docs/firestore/security/rules-fields (checked 2026-11-20)
- Firebase docs, Custom claims: https://firebase.google.com/docs/auth/admin/custom-claims (checked 2026-11-20)
- Techlicious, Quittr exposure, relaying a 404 Media investigation: https://www.techlicious.com/blog/quittr-porn-addiction-app-leaked-what-users-say-they-watch/ (published 2026-03-10; checked 2026-11-20; the original 404 Media text was not opened)
- BleepingComputer, "Tea app leak worsens with second database exposing user chats": https://www.bleepingcomputer.com/news/security/tea-app-leak-worsens-with-second-database-exposing-user-chats/ (published 2025-07-28; checked 2026-11-20)
Questions and answers
- Is request.auth != null enough for Firestore rules?
- Not by itself. It lets any signed-in user read and write whatever the rule covers, and Firebase's docs list it as not recommended for production. If anyone can create an account in your app, anyone can pass that check. Add a condition that ties the request to the data, such as request.auth.uid matching an ownerId field, and test with a second account.
- How do I test my Firebase rules without writing code?
- Use the Rules Playground in the Firebase console: open Firestore, then Rules, then Rules Playground, pick your simulation options and click Run. Simulate a signed-in owner, a signed-in different user, and an unauthenticated visitor against the same document. Also try the two-account test in the real app. It tests the rules as written, not how your app uses them.
- What happens when Firebase test mode rules expire?
- We could not confirm the exact default expiry in Firebase's current docs, so check the date in your own rules. A rule like request.time less than a date allows everyone until that date, then denies everyone, which can break the app. Do not push the date forward as a fix. Replace it with owner checks. Firebase says never to use test mode in production.
- How do I stop users from changing their own role or plan in Firebase?
- Do not let the owner's update rule cover those fields. Use an allowlist: affectedKeys().hasOnly([...]) with only the fields a user may change. Keep roles in custom claims set from a server with the Admin SDK, and read them from request.auth.token in rules. A server-side function should handle plan changes after a payment webhook.
- Are my Firebase API keys in my website a problem?
- No, Firebase's docs say they only identify your project and app, and are fine in code. The risk is in the rules behind them. Anyone can copy your config from the page and call your database as a signed-in or anonymous user, so what the rules allow is what the world can do. Other Google keys, like a Gemini key, are different.
You just read what AI builders ship. Now check yours.
Paste your GitHub URL. 2 minutes. You get the findings in plain English, and the report says what it could not check. Free, no card.
Scan My App Free