Skip to content

Firebase checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • FIREBASE-1 (10) Start every Firestore database, Realtime Database and Storage bucket with rules that deny all access, and never deploy test-mode rules, allow read, write: if true, or rules that let any signed-in user (request.auth != null) reach all data. (specific/firebase) Automatable: @firebase/eslint-plugin-security-rules, Security Rules unit tests.
  • FIREBASE-2 (8) Write the rules for each new collection or path together with the code that uses it, keep the rules and index definitions (firestore.rules, storage.rules and firestore.indexes.json) in the repository, and deploy them with the Firebase CLI instead of editing them in the console. (specific/firebase)
  • FIREBASE-4 (8) Validate every client write in the rules: allow only known fields with request.resource.data.keys().hasOnly(), check their types, and use diff().affectedKeys() to stop clients from changing fields such as an owner ID, a role or a balance. (specific/firebase) Automatable: Security Rules unit tests.
  • FIREBASE-8 (8) Treat Firebase API keys and Remote Config values as public: restrict each API key to the APIs it needs, use a separate restricted key for any API that isn't a Firebase service, and never put a Gemini Developer API key, a service account key or another server credential in a client. (specific/firebase) Automatable: GitHub secret scanning push protection.
  • FIREBASE-10 (8) Use a separate Firebase project for each environment, such as development, staging and production, register debug and release builds in different projects, and don't put unrelated apps in one project. (specific/firebase)
  • FIREBASE-3 (7) Unit-test the rules with @firebase/rules-unit-testing against the emulators, asserting with assertSucceeds and assertFails that allowed requests succeed and forbidden ones fail, and run the tests in CI with firebase emulators:exec. (specific/firebase) Automatable: Security Rules unit tests.
  • FIREBASE-5 (7) Keep fields that not every reader may see in a separate document, such as a private subcollection with its own rules, because rules allow or deny reads of whole documents. (specific/firebase) Automatable: Security Rules unit tests.
  • FIREBASE-6 (7) If you use anonymous authentication, protect all non-public data with rules that require a permanent sign-in provider or a verified email address, because anyone can create an anonymous account. (specific/firebase) Automatable: Security Rules unit tests.
  • FIREBASE-7 (7) Enforce App Check for every product that supports it, such as Firestore, Realtime Database, Cloud Storage, Authentication and callable functions, once its request metrics show that your current app versions send valid tokens. (specific/firebase)
  • FIREBASE-9 (7) Harden Firebase Authentication before launch: disable the sign-in providers you don't use, enable email enumeration protection, tighten the quota of the sign-in endpoints, and allow only your own domains. (specific/firebase)
  • FIREBASE-11 (7) Model Firestore data around the queries your screens run and what they cost: each document a query returns, each document a listener receives when it's added or changed, and each document a rule reads with get() or exists() is billed as a read. (specific/firebase)
  • FIREBASE-12 (7) Turn on point-in-time recovery and scheduled backups for production Firestore databases. (specific/firebase)
  • FIREBASE-13 (7) Give Cloud Functions their credentials through Secret Manager, with defineSecret() bound only to the functions that need each secret, not through .env files or functions.config(). (specific/firebase)
  • FIREBASE-14 (7) Make event-triggered functions idempotent, for example by using the event ID as an idempotency key, turn on retries only for transient errors, and test on the emulators that a function's writes can't trigger it again in a loop. (specific/firebase)
  • FIREBASE-15 (7) Set budget alerts on every project on the pay-as-you-go Blaze plan, add spend caps for the services that support them, such as Cloud Functions, and limit each function's maximum number of instances to what normal traffic needs. (specific/firebase)
  • FIREBASE-16 (7) Where users must consent to analytics or crash reporting, set the Google Analytics consent defaults in the app's configuration, update them with setConsent() when the user decides, and turn on Crashlytics opt-in reporting. (specific/firebase)