Firestore security rules checker

Paste your firestore.rules to pinpoint syntax errors, documented limits, and the insecure patterns Firebase warns about—each with its exact line and column. Free, no account required.

Runs locally in your browser. Nothing you enter leaves this page.

Last reviewed:

Paste your firestore.rules

Checked as you type. Nothing you paste leaves this page.

Load an example

Tab inserts two spaces. To leave the editor with the keyboard, press Esc, then Tab.

Results

The rules parse. Found 1 note.

Notes (1)

  • access-call-countFirebase docs for access-call-count (opens in a new tab)

A static check, not the Firebase compiler. It reads the text of your rules and never runs them against data. Before you deploy, test them with the Firestore emulator or the Rules Playground.

Parse, audit, and verify limits

  1. Parse every rule

    A parser built from Firebase's rules language reference reads every match, allow, and function using the documented operator precedence, reporting all syntax errors with their exact line and column—not just the first.

  2. Flag insecure patterns

    Once parsed, the checker inspects each rule against the risks in Firebase's insecure rules guide alongside common mistakes disallowed by the language.

  3. Verify documented limits

    It also checks the security rule limits visible in static analysis: nesting depth, wildcard count, function arguments, let bindings, and the number of get() and exists() calls per rule.

Every check, backed by Firebase docs

Each finding links directly to the Firebase documentation behind it. When static analysis can't be certain, the checker stays quiet to avoid false positives.

Security

  • Allow with no condition or if true
  • Test-mode rules open until a date
  • Writes allowed to any signed-in user
  • Email domain checked without email_verified
  • Every client request denied (locked mode)

Mistakes

  • No rules_version = '2'
  • Recursive wildcard semantics in version 1
  • Recursive wildcard not at the end in version 1
  • Two recursive wildcards in one match
  • let used without rules_version = '2'
  • Allow method that does not exist
  • Method repeated in one allow
  • read with get or list (or write with create, update, delete) in one match
  • Call to a function that is not declared
  • Call to a function declared in another match
  • Wrong number of arguments
  • Unknown function in math, timestamp, duration, latlng or hashing
  • Unknown unit in duration.value()
  • Function that is never called
  • Function declared twice in one block
  • Function that calls itself, directly or not
  • resource read in a create rule, where it is null
  • request.resource read in a read rule
  • request.resource read in a delete rule
  • Name that is not a variable, wildcard or global
  • Method that a string, list, map or other type does not have
  • Unknown type after is
  • Condition that is a string, number or null
  • Chained comparison such as a < b < c
  • Match block with nothing inside
  • Allow on /databases/{database}/documents itself
  • Match that points to a collection, not a document
  • Top-level match not under /databases/{database}/documents
  • Storage rules: only the shared checks run
  • Service other than cloud.firestore or firebase.storage

Limits

  • get() and exists() calls per rule
  • Function with more than 7 arguments
  • Function with more than 10 let bindings
  • Match statements nested more than 10 deep
  • More than 20 wildcards in nested matches
  • More than 100 path segments in nested matches
  • Ruleset larger than 256 KB

Syntax

  • Unexpected token or missing punctuation
  • Character that is not part of the language
  • String without its closing quote
  • Block comment without its closing */
  • Block or bracket opened and never closed
  • Allow condition without the if keyword
  • No service declaration
  • More than one service in a file
  • Malformed match path or wildcard
  • Malformed path for get() or exists()
  • Function without a single return statement
  • rules_version that is not '1' or '2'
  • Expression nested too deeply

Common insecure patterns

Open access

With if true—or no condition at all—anyone who knows your project ID can read, modify, or delete your data (insecure rules).

match /{document=**} {
  allow read, write: if true;
}

Expiring test mode

The Firebase CLI's starter rules leave your entire database public until a cutoff date—after which every client request suddenly fails.

allow read, write: if request.time < timestamp.date(2027, 1, 3);

Any signed-in user

request.auth != null grants access to every authenticated user in your app, not just the document owner. Firebase flags this so you can verify that broad access is intentional (insecure rules).

// Every signed-in user can write every note
allow write: if request.auth != null;
// Only the owner can
allow write: if request.auth.uid == userId;

Unverified email domain

Checking an email address alone trusts an unconfirmed address. Require email_verified alongside the domain check (insecure rules).

allow read: if request.auth.token.email_verified
  && request.auth.token.email.matches('.*@example[.]com');

Reading resource on create

During a create operation, no document exists yet, so resource is null and resource.data fails (Firebase codelab). Read incoming fields from request.resource.data instead.

allow create: if request.auth.uid == request.resource.data.ownerId;
allow update, delete: if request.auth.uid == resource.data.ownerId;

A deny that doesn't override

When multiple match blocks cover the same document, access is granted if any single one allows it—a false rule never overrides a true one (overlapping match statements).

match /cities/{city} { allow read, write: if false; }
// Still allows everything under /cities:
match /cities/{document=**} { allow read, write: if true; }

What static analysis can't check

Evaluated by Firebase at runtime

  • Live document data. Whether resource.data.ownerId exists or has the expected type is only known at runtime; a missing field causes the rule to fail (rules and fields).
  • Results of get() and exists(). The checker counts calls against Firestore's limits, but it cannot fetch the referenced documents.
  • Query compatibility. Rules are not filters—a list query must request only what the rules allow (securely query data), which depends on the query your app sends.
  • Real user tokens. Auth tokens, custom claims, and sign-in providers are only evaluated when a request runs.
  • Full compiler validation. Type checking, complete built-in method signatures, and request-dependent limits belong to Firebase's compiler. Unknown methods are flagged only when the checker can determine the type with certainty.
  • Server-side access. Firebase Admin SDKs and other server client libraries bypass security rules entirely (rules structure).

How to test your rules for real

  • Run your rules in the Firestore emulator and write automated tests with @firebase/rules-unit-testing (unit tests) to evaluate real requests and inspect coverage.
  • Simulate individual requests in the Firebase console's Rules Playground using a target path, auth payload, and document data.
  • Deploy with firebase deploy --only firestore:rules (manage and deploy rules). Remember that each named database maintains its own rules.

More in Fuego

  • Emulators: Fuego automatically detects running Firebase emulators on their default ports so you can inspect the documents your rules tests write. Emulator projects require a paid plan.
  • Realtime Database rules: View Realtime Database security rules on any plan, and on a paid plan validate and apply edits after a side-by-side diff. Use Read as a user to see what an authenticated user or visitor can read.
  • The query builder runs Firestore queries against your live data with filters, sorting, and limits.

Frequently asked questions

Is this the official Firebase rules compiler?

No. It is a static analyzer that runs in your browser to catch syntax errors, documented limits, and risky patterns. Firebase's own compiler validates rules on deploy, and only the Firestore emulator or Rules Playground evaluates rules against real requests. A file accepted here can still be rejected by Firebase, and vice versa.

Are my rules sent to a server?

No. The checker runs completely locally in your browser—nothing you paste is uploaded, stored, or logged.

Why does it warn if rules_version = '2' is missing?

Without that declaration, Firebase defaults to version 1. Version 2 is required for collection group queries (allowing recursive wildcards anywhere in a path and matching empty paths) and adds support for let bindings inside functions.

Does it support Cloud Storage security rules?

Yes, partially. It parses Cloud Storage rules and runs all shared checks—such as syntax, open access, and expiring test-mode dates—while skipping Firestore-specific checks like resource on create or get() call counts.

How should I test my rules before deploying?

Run them against the local Firestore emulator using @firebase/rules-unit-testing for repeatable automated tests, or test individual requests in the Firebase console's Rules Playground. When ready, deploy with firebase deploy --only firestore:rules.

Work directly with your Firestore data

Fuego is a desktop app for Firestore, Realtime Database, Authentication, and Storage on macOS, Windows, and Linux. The Free plan covers one project.