Home > Net >  How secure firestore query is? can data be sniffed or hacked?
How secure firestore query is? can data be sniffed or hacked?

Time:12-15

I am building flutter mobile app that is intensively using firebase services and firestore. in app start, the app communicates with firestore to retrieve some basic keys and paramaters that app uses in different services, like APIs Keys, IDs, .. etc.

would like to understand if this approach is secure enough? or there is a possibility that communication (firestore query) to be hacked somehow and the keys are stolen?

Note: I am using simple firebase rule that allow read and write if user is signed in using Firebase Authentication

I can indeed hardcode these keys in the app code, however I prefered this database approach to give myself the chance to change these keys if it is changed by the services providers for any reason.

any answers or links are much apprecaited.

CodePudding user response:

You should assume that any value used inside your client-side application can be found by a malicious user and used for their own purposes.

Once someone has those keys, they can call the APIs that require them differently than what your own application code does, unless you use some other means to prevent this such as Firebase's security rules and App Check.

When using security rules, the best way to prevent somebody from doing something different from your application's use-cases is to encode those use-cases in the security rules too. So instead of just requiring someone to be signed in, expand your rules to validate that only the operations that your own code requires are allowed. Use-case by use-case lock it down, until your cod and rules cover the same set of use-cases.

Also see:

  • Related