How to prevent a hacker from reading/writing on firebase database

不羁的心 提交于 2020-05-13 07:06:45

问题


I have some questions about securing firebase database for mobile applications.

For example, after decompiling Android application a hacker can get firebase api key and then get access to firebase database, is this correct?

Let's assume, I added some security rules like for example an app can read/write on firebase only if auth!=null, this means that the authentication is protecting my firebase database, but this put me to ask the same question, if I configure facebook/google/ or even firebase email authentication I'm gonna need some api keys for those providers in my application, If a hacker got access to those keys, will he be able to use my authentication in his own application and get access to my firebase data?

I want to understand what to do in Android applications to make sure only my application will get access to firebase datatabase.

Thank you.


回答1:


after decompiling Android application a hacker can get firebase api key and then get access to firebase database, is this correct?

Only if your database does not use any security rules that limit access to only authenticated users.

if I configure facebook/google/ or even firebase email authentication I'm gonna need some api keys for those providers in my application, If a hacker got access to those keys, will he be able to use my authentication in his own application and get access to my firebase data?

No, it doesn't work that way.

Each user authenticated with Firebase is issued a token that's used to identify the user when they access protected services, such as Realtime Database, Firestore, or Storage. This token is valid 1 hour and must be refreshed after that, which the SDK will do automatically.

For a hacker to gain control of that user's data, they would have to obtain this token, and they would have no more than an hour to work with it. After that, they would have to obtain the next token obtained by the SDK. All this would have to happen on the user's device.



来源:https://stackoverflow.com/questions/47686589/how-to-prevent-a-hacker-from-reading-writing-on-firebase-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!