您的Cloud Firestore数据库具有不安全的规则-扑火的Firebase数据库

时间:2020-06-14 05:31:39

标签: firebase google-cloud-firestore firebase-security

我开发了Flutter应用, 我使用Firebase作为我的数据库,这意味着任何用户都可以从我的数据库中进行读写,

每隔几个小时我会收到以下电子邮件。

[Firebase] Your Cloud Firestore database has insecure rules

    We've detected the following issue(s) with your security rules:
any user can read your entire database
any user can write to your entire database

这正是我想要的,因为我希望未注册的用户可以使用我的应用。

我错过了什么吗?我的应用程序实际上不安全吗?

通过应用程序访问数据库,仅过滤用户特定数据。

有没有一种方法可以使我更安全,并使未注册用户可以使用它?

我也不确定为什么只允许注册用户会使其不安全,因为任何人都可以单击按钮来注册该应用程序。

请阐明此问题。

2 个答案:

答案 0 :(得分:0)

您肯定需要学习如何使用security rules。完整的讨论超出了单个答案的范围,但是您应该知道,安全规则允许您指定谁(通过Firebase Auth登录)可以读取和写入哪些文档和集合。根本不使用安全规则是一个巨大的安全漏洞。

答案 1 :(得分:0)

以下文档中的视频以非常简单的方式对其进行了解释 https://firebase.google.com/docs/firestore/security/get-started#writing_rules

最重要的是,您必须对用户进行身份验证,然后使用安全规则过滤数据,以保护数据安全。

仅在测试s时才应使用不安全的规则