来自 Firebase 中数据库的警告消息 [英] Warning message from databases in Firebase

查看:28
本文介绍了来自 Firebase 中数据库的警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了来自 Firebase 的以下消息.我该怎么办?

I received the following message from Firebase. What am I supposed to do?

您选择在测试模式下开始开发,这让您的 Realtime数据库实例完全对互联网开放.因为这个选择使您的应用程序容易受到攻击者的攻击,您的数据库安全规则配置为在前 30 天后停止允许请求.在5 天,所有客户端对您的实时数据库实例的请求都将被拒绝.在此之前,请将您的安全规则更新为允许您的应用正常运行,同时适当保护您的数据.分析每天运行;如果您在过去 24 年中修改了规则可能不考虑这些变化的小时数.

You chose to start developing in Test Mode, which leaves your Realtime Database instance completely open to the Internet. Because this choice makes your app vulnerable to attackers, your database security rules were configured to stop allowing requests after the first 30 days. In 5 day(s), all client requests to your Realtime Database instance will be denied. Before that time, please update your security rules to allow your app to function while appropriately protecting your data. Analysis is run daily; if you've modified your rules in the last 24 hours those changes may not be accounted for.

这是我在 Firebase 的数据库中发现的

And this is what I found in databases in Firebase

{
  "rules": {

    ".read": "now < 1602709200000",  // 2020-10-15

    ".write": "now < 1602709200000",  // 2020-10-15
  }
}

推荐答案

在实时数据库规则中设置此条件:

Set this conditions in Realtime Database Rules:

{
  "rules": {
    "users": {
      "$uid": {
        ".read": "auth != null && auth.uid == $uid",
        ".write": "auth != null && auth.uid == $uid",
      }
    }
  }
}

这篇关于来自 Firebase 中数据库的警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆