Firestore 限制每小时或每天的读取和写入,以防止用户在检查器中设置计时器 [英] Firestore limit reads and writes per hour or per day to prevent user setting a timer in the inspector

查看:19
本文介绍了Firestore 限制每小时或每天的读取和写入,以防止用户在检查器中设置计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 Firebase,我可能会在生产中使用它.我找不到如何阻止登录用户编辑 javascript 代码并每天自动触发数千次读取,而我必须为此付费.据我所知,任何想要增加我的 firebase 账单的用户都可以通过编辑 javascript 代码来设置一个计时器,并在 firestore 数据库中每 4 秒读写一次.您如何防止用户每天或每小时的阅读率?

I am learning Firebase and I might use it in production. I can not find how to prevent a logged in user to edit javascript code and trigger thousands of reads per day automatically and that I will have to pay for. As far as I know, any user who would like to increase my firebase bill could set a timer by editing javascript code and read and write every 4 seconds where he can in the firestore database. How can you prevent a user read rate per day or hour?

推荐答案

无法在 Cloud Firestore 上设置读取限制.

There is no way to set a read limit on Cloud Firestore.

您可以在安全规则中实施写入限制,如本答案所示:如何在 Cloud Firestore 安全规则中实施写入速率限制?.或者,您可以通过 Cloud Functions 传递所有写入,您可以在其中通过自己的代码控制速率.

You can implement a write limit in security rules as shown in this answer: How do I implement a write rate limit in Cloud Firestore security rules?. Alternatively you can pass all writes through Cloud Functions, where you can control the rate through your own code.

如果您将安全规则设置为将用户限制在他们需要能够访问的最少数据,并认为您受到了滥用,联系 Firebase 支持人员,寻求个性化的故障排除帮助.

If you've set your security rules to limit users to the minimum data they need to be able to access, and think you're being abused, reach out to Firebase support for personalized help in troubleshooting.

这篇关于Firestore 限制每小时或每天的读取和写入,以防止用户在检查器中设置计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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