android - 如何防止黑客在firebase数据库上读/写

标签 android security firebase firebase-authentication firebase-security

我对保护移动应用程序的 firebase 数据库有一些疑问。
例如,在反编译Android应用程序后,黑客可以获取firebase api key 然后访问firebase数据库,这是正确的吗?
假设,我添加了一些安全规则,例如,只有当 auth!=null 时,应用程序才能在 firebase 上读/写,这意味着身份验证正在保护我的 firebase 数据库,但这让我问同样的问题,如果我配置facebook/google/甚至是firebase电子邮件身份验证我将需要一些api key 用于我的应用程序中的这些提供商,如果黑客可以访问这些 key ,他是否能够在他自己的应用程序中使用我的身份验证并访问我的火力数据?
我想了解在 Android 应用程序中要做什么,以确保只有我的应用程序才能访问 firebase 数据库。

最佳答案

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



仅当您的数据库不使用任何将访问限制为仅经过身份验证的用户的安全规则时。

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?



不,它不是那样工作的。

每个通过 Firebase 进行身份验证的用户都会获得一个 token ,用于在用户访问 protected 服务(例如实时数据库、Firestore 或存储)时识别用户。此 token 有效期为 1 小时,之后必须刷新,SDK 会自动执行此操作。

黑客要想控制该用户的数据,他们必须获得这个 token ,而且他们使用它的时间不会超过一个小时。之后,他们必须获得 SDK 获得的下一个 token 。所有这些都必须在用户的设备上发生。

关于android - 如何防止黑客在firebase数据库上读/写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47686589/

相关文章:

firebase - 通过缩短字段名称来节省 Firebase 带宽?

javascript - 我可以将 Firebase 与 Squarespace 一起使用吗?

java - 将自定义用户操作添加到 Android 媒体 session

android - 为什么 registerForContextMenu 将 null ContextMenuInfo 传递给 onCreateContextMenu?

security - 我应该了解哪些常见的 Web 漏洞利用?

firebase - Firebase 中的 Fanout 方法可以用 ref.orderByChild(key).equalTo(value) 代替吗?

android - 如何从 MainActivity 获取当前 fragment

android - 如何克服这个错误 android.permission.MODIFY_PHONE_STATE.?

java - 解密(RSA)字符串的长度正在改变

c - 在 ret2ret 漏洞上执行 shellcode