Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locking down Firebase DB access to specific apps

I think from searching the web this is not technically possible but I want to ask again in case I'm missing something.

I have an app that uses Firebase. Reading and writing is locked down through security rules for authorised users only but there's certain information I want unauthorised users to be able to access (so I don't have to put a login wall in front of them, influencing churn).

What I want to know is, is there any way of locking down this read access that only my app can call the DB? I know I can lock down domains to prevent someone writing localhost scrapers but what's to stop someone cloning and re-skinning an app and pointing it to the same back end? Is it possible to achieve this using your certificates fingerprint?

like image 316
JamesR Avatar asked Aug 25 '18 14:08

JamesR


People also ask

Can two apps use the same Firebase database?

Yes, You can use the same firebase database in more than one android application as below: In the Project Overview section of Firebase Console add an android application. For adding this application first you need to give that package name.

What is locked mode in Firebase?

Default rules: Locked mode When you create a database or storage instance in the Firebase console, you choose whether your Firebase Security Rules restrict access to your data (Locked mode) or allow anyone access (Test mode).

Can anyone access my Firebase database?

These rules live on the Firebase servers and are enforced automatically at all times. Every read and write request will only be completed if your rules allow it. By default, your rules do not allow anyone access to your database.


1 Answers

There is no way to limit access to your database to just your app. That just doesn't match with the cloud-based nature of the Firebase APIs. Anyone that knows the URL of your database can in in principle access it, and security rule are the way to ensure all access is authorized.

Note that security rules are not an all-or-nothing approach: you can require sign-in for some parts of your database, while leaving other parts publicly readable. But you can't make the publicly readable parts only be readable by your own app.

Some previous questions on the same topic:

  • how to make sure only my own website (clientside code) can talk to Firebase backend? (pretty much my go-to answer for this)
  • How to allow only my app to access firebase without a login?
  • Restrict Firebase database access to one Android app
  • How to allow only my app to access firebase without a login?

Update: since May 2021 you can actually restrict access to just users of your App by implementing Firebase App Check.

like image 121
Frank van Puffelen Avatar answered Oct 27 '22 00:10

Frank van Puffelen