Guides
Sign in

Guide · Leaked keys and files

Firebase test mode expired: fix it without opening your database

Your app worked for a month, then every read and write started failing with “Missing or insufficient permissions”. That’s test mode ending: its rules let anyone in, but only until a date, and after that date they let nobody in. The quick fixes people find, pushing the date out or switching to if true, open your database to everyone again. The real fix is rules that let each user reach their own data, and nobody else’s.

What happened

Test mode is the quick start Firebase offers when you create a database. It “allows anyone to read and overwrite your data” (Firebase docs), so it comes with an end date. In the starter rules Firebase’s own command-line tool writes, the date is 30 days out, and the comment above it explains why: it “is configured to expire after 30 days because it leaves your app open to attackers. At that time, all client requests to your database will be denied” (Firebase CLI).

A test-mode rule, as it looks in your rules

allow read, write: if request.time < timestamp.date(2026, 12, 6);

Once that date passes, every request from your app is refused. In your browser’s console it shows up as Missing or insufficient permissions or PERMISSION_DENIED, the errors Firebase’s own tests expect when rules say no (Firebase JS SDK). Lists come back empty, sign-ups fail, and nothing saves.

Two fixes that open your data again

  • Moving the date. Changing timestamp.date to next year brings your app back, and leaves your whole database open to anyone who finds your project until then. Your Firebase config is public by design, so finding it isn’t hard.
  • allow read, write: if true; Firebase’s warning about this one: “NEVER use this rule set in production; it allows anyone to overwrite your entire database” (Firebase docs).

Both are what an AI tool often suggests first, because they make the error go away. Ask for rules that check who’s asking instead.

Fix it properly

Prompt for Lovable, Bolt, Cursor or Claude Code

My app uses Firebase. Check my Firestore and Storage security rules. Make sure nothing allows read or write for everyone (if true) and that users can only reach their own documents. Show me the corrected rules. Then write a test with two accounts: signed in as the first, try to read, change and delete the second one’s documents and files, and expect each to be refused.

“Their own documents” usually means a rule like this one, from Firebase’s docs: a signed-in user can read and write documents under their own user ID, and nobody else’s (Firebase docs).

Firestore rule, from Firebase’s docs

match /some_collection/{userId}/{document} {
  allow read, write: if request.auth != null && request.auth.uid == userId
}

Your collections will have their own names. Data meant for everyone, like a public product list, needs a read rule of its own, with no write. Your uploaded files have separate rules under Storage, so check those too: fixing your database leaves them as they were.

Test before you publish

  1. Paste the new rules into the Rules editor and try them in the Rules Playground, which lets you “simulate authenticated and unauthenticated reads, writes, and deletes” (Firebase docs). A stranger’s read of another user’s data should fail.
  2. Publish, then use your app while signed in. Rule changes “can take up to a minute to affect new queries and listeners” (Firebase docs).
  3. If your project has a firestore.rules file, put the same rules there: deploying from the command line means “the rules defined in your project directory overwrite any existing rules in the Firebase console” (Firebase docs), and an old test-mode file would bring the date back.

What this can’t tell you

We look for signs of Firebase in your page and scripts, like a firebaseapp.com address. We never read your rules or try your database, so we can’t see whether test mode has ended or what replaced it. That’s why your report shows Firebase rules as Check yourself, never Clear. For the wider picture of open rules, see Is your Firebase database still in test mode?

Related