Firebase App Check: what it blocks, and why your rules still decide

Firebase App Check attaches a proof to each request that it comes from your registered app, and lets Firebase reject requests without it. It cuts down scripts that call your backend directly. It does not know who the user is or what they are allowed to read: a signed-in user of your real app passes App Check and then gets whatever your security rules allow. Turn it on, and keep writing rules as if it were not there.

The team behind Keybrum's attacksUpdated 9 min read

In short

  • App Check answers one question: does this request come from my app? Security rules answer another: may this user read or write this document?
  • Nothing is blocked until you click Enforce for each product. Before that, App Check only measures.
  • Firebase's own page says App Check prevents some, but not all, abuse, and does not guarantee the elimination of all abuse.
  • On the web the provider is reCAPTCHA Enterprise. On Cloud Functions, App Check covers callable functions only.
  • Rules that say if true or if request.auth != null leak the same data with App Check on, to anyone using your real app.
On this page

What Firebase App Check does

A Firebase app talks to Firestore, the Realtime Database and Cloud Storage straight from the browser or the phone. The project ID and the API key are in the app, in plain sight, and that is by design. The Firebase API key guide explains why. The side effect is that anyone can write a script that calls the same backend without ever opening your app.

App Check is Firebase's answer to that script. In Firebase's words, it "helps protect your app backends from abuse by preventing unauthorized clients from accessing your backend resources". Your app asks an attestation provider to vouch for it, receives a short-lived App Check token, and sends that token with every request. Once you enforce App Check on a product, requests without a valid token are rejected.

PlatformAttestation providers
WebreCAPTCHA Enterprise
AndroidPlay Integrity, reCAPTCHA Enterprise
AppleApp Attest, DeviceCheck, reCAPTCHA Enterprise
AnyA custom provider you build
Providers listed in Firebase's App Check documentation, read on 13 November 2026.

It covers Cloud Firestore, the Realtime Database, Cloud Storage, callable Cloud Functions, Firebase AI Logic and Firebase SQL Connect, with Firebase Authentication in preview. Tokens last one hour by default. You can set the lifetime anywhere between 30 minutes and 7 days.

What App Check does not do

App Check checks the app. It has no opinion about the person. That one sentence explains every limit below.

QuestionWho answers it
Does this request come from my registered app?App Check
Is this person signed in, and as whom?Firebase Authentication
May this user read or change this document or file?Security rules
May this server code touch this data?Your own checks: the Admin SDK skips rules
  • A real user in your real app passes. Someone who opens your site in a normal browser gets a valid token. If your rules let any signed-in user read every profile, that person reads every profile, App Check or not.
  • Sign-up is usually open. If anyone can create an account in your app, anyone can be that real user.
  • It is a filter with known gaps. Firebase writes that App Check "prevents some, but not all, abuse vectors" and that using it "does not guarantee the elimination of all abuse". Its strength depends on the attestation provider.
  • It only covers what you enforce. A project with Firestore enforced and Storage left unenforced is still open on Storage.
  • Plain HTTP functions are outside it. The Cloud Functions page covers callable functions. A function you expose with onRequest needs its own checks.

How to set up App Check on a web app

  1. 1

    Create a reCAPTCHA Enterprise key

    In the Google Cloud console, create a key of type Web for your domains, without the checkbox challenge. Firebase's guide walks through it.

  2. 2

    Register the app in Firebase

    In the Firebase console, open Security, then App Check, then the Apps tab, and register your web app with that key. Register every app in the project: once enforcement is on, only registered apps get through.

  3. 3

    Initialise App Check before anything else

    Add the snippet below early in your app, before the first call to Firestore or Storage. Token auto-refresh is off unless you turn it on.

  4. 4

    Watch the metrics

    Deploy, then come back to the App Check page over the next days. It shows how much of your traffic arrives with a valid token. Old tabs and old app versions send none.

  5. 5

    Enforce, product by product

    When nearly all legitimate traffic is verified, expand a product on the App Check page and click Enforce. Firebase says it can take up to 15 minutes to take effect.

javascript
import { initializeApp } from "firebase/app";
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";

const app = initializeApp({
  // your Firebase config
});

initializeAppCheck(app, {
  provider: new ReCaptchaEnterpriseProvider("YOUR_RECAPTCHA_ENTERPRISE_KEY"),
  isTokenAutoRefreshEnabled: true,
});
From Firebase's web guide. The reCAPTCHA key is a site key, meant to be public.

Two practical notes. Localhost and CI are not valid environments for a production provider, so Firebase offers a debug provider for them: keep its debug token out of your public bundle. And attestation is not unlimited: Firebase's page lists reCAPTCHA Enterprise as free for 10,000 assessments a month, then billed, so check the quota against your traffic.

For callable Cloud Functions, enforcement is an option in your code. Setting enforceAppCheck: true on onCall rejects requests with missing or invalid tokens. The ownership check inside the function is still yours to write, as shown in the Firebase security guide.

Enforcement: the step people skip

Adding the SDK changes nothing for an attacker. Firebase's guide says so directly: App Check "won't block requests with invalid tokens until App Check is enforced". Many projects stop after the snippet, see green numbers in the console and assume the door is closed.

  • Every app in the project is registered with a provider
  • Firestore shows Enforced on the App Check page
  • The Realtime Database shows Enforced, if you use it
  • Cloud Storage shows Enforced
  • Every callable function sets enforceAppCheck: true
  • No debug token is committed to the repository or shipped in the bundle

Enforce too early and you lock out real users on old versions. Enforce never and you have a dashboard. The metrics exist to pick the day.

How to check that your rules hold without App Check

The useful test is to forget App Check and ask: if a signed-in stranger sends this request from my own app, what comes back? Three checks, on your own project.

  1. 1

    Read your rules for the two leaking patterns

    Open the rules of Firestore, the Realtime Database and Storage. Search for if true and for conditions that stop at request.auth != null. Each one grants access to everyone, or to every account. The Firebase rules checker reads pasted rules and flags these patterns.

  2. 2

    Ask as a stranger

    From a terminal, request one document of a private collection with no sign-in at all, as in the block below. With App Check enforced, Firebase rejects the request for lacking a token, which tells you nothing about the rules. Run this before you enforce, or test the rules in the emulator.

  3. 3

    Ask as a second user

    Create two test accounts in your app. Signed in as the second, try to open the first one's data. This is the request App Check will never stop, because it comes from your app.

bash
# Your own project only.
curl "https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/users?pageSize=1"
A permission error is what you want. Documents in the answer mean anyone can read the collection.

The Firebase security rules guide has rules to paste for the usual cases: one profile per user, documents with an owner field, files in a per-user folder. It also shows how to unit test rules in the emulator with two users, which is the reliable way to test once App Check is enforced.

What to do, in order

  1. Fix the rules first. Deny by default, then one rule per collection tied to request.auth.uid. This is what protects the data.
  2. Lock the fields that grant power. A user who can write their own role, plan or credits field does not need to attack anything.
  3. Add App Check in monitoring mode. Ship the SDK and watch the numbers.
  4. Enforce on each product. Firestore, Realtime Database, Storage, then callable functions.
  5. Test again as two users. After every change to the rules, and after every feature the coding agent adds.

What Keybrum tests on a Firebase app

Keybrum is the automated pentest we build for apps made with AI. On Firebase it tests the rules, from the outside, on the live project:

  • it reads each Firestore collection named in your app's code, first with no account, then as a new account, and keeps counts, field names and one redacted document;
  • it checks whether a write would be allowed, using a precondition that can never hold, so nothing is created;
  • it checks whether a new account can set role, isAdmin, plan or credits on its own document, the same way;
  • it reads the Realtime Database root, lists the Storage bucket and the folders named in the code, and downloads one byte of one file;
  • it looks for API keys stored in readable documents and checks whether they work.

What it does not test: App Check itself. Keybrum does not grade your App Check configuration and does not send App Check tokens. On a product where you enforce App Check, Firebase rejects requests that carry no token, so a run from outside cannot tell you whether the rules behind it would hold for a user of your real app. Test those with the emulator and two accounts. Keybrum also does not read your rules file: it reports what the live backend answers.

It only attacks apps whose owner proved ownership. A one-time report is €49. The Maker plan, €29 a month excluding VAT for 5 apps, attacks again on every deploy.

Questions

Does Firebase App Check replace security rules?

No. App Check verifies that a request comes from your registered app. Security rules decide which user may read or write which document. A signed-in user of your real app passes App Check and then gets whatever the rules allow, so the rules still carry the access control.

Is Firebase App Check free?

App Check has no separate price, but the attestation providers have quotas. Firebase's page lists reCAPTCHA Enterprise as free for 10,000 assessments a month and billed beyond that, and Play Integrity at 10,000 calls a day on its Standard tier. Check the current numbers against your traffic.

Why is App Check not blocking anything?

Because it is not enforced yet. Adding the SDK only makes your app send tokens. Requests without a valid token are rejected only after you click Enforce for each product in the console, and that can take up to 15 minutes to apply.

Can App Check be bypassed?

Firebase itself says App Check prevents some, but not all, abuse, and that its protection depends on the strength of the attestation provider. Treat it as a filter that removes cheap abuse. Anything that must stay private has to be protected by rules.

Does App Check work with Cloud Functions?

With callable functions. You set enforceAppCheck: true in the options of onCall, and requests with a missing or invalid token are rejected. Functions exposed with onRequest are not covered by that option and need their own checks.

How long does an App Check token last?

One hour by default. You can set it between 30 minutes and 7 days in the app's registration settings. A shorter lifetime means more attestation calls, which count against the provider's quota.

Sources

  1. 1.Firebase App Check, Firebase Docs
  2. 2.Enable App Check enforcement, Firebase Docs
  3. 3.Get started using App Check with reCAPTCHA Enterprise in web apps, Firebase Docs
  4. 4.Enable App Check enforcement for Cloud Functions, Firebase Docs
  5. 5.Fix insecure rules, Firebase Docs
  6. 6.Firebase security checklist, Firebase Docs

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub