有没有一种方法可以使我的燃料查询更加安全?

发布于 2025-02-11 04:16:10 字数 410 浏览 0 评论 0原文

基本上,我们希望我们的应用使用用户名/密码而不是电子邮件/密码登录。我想查询给定用户名的实时数据库,它将返回与该用户名相关联的电子邮件(每个用户名都是唯一的btw),然后继续使用电子邮件/密码登录。工作中的标志,但我意识到这可能会带来安全风险。我们实时数据库的规则如下:

"rules": {
    "user":{
        ".read": true,
        ".indexOn": ["username"],
        "$uid": {
            ".write" :"$uid == auth.uid && auth != null",   
        }  
    }
}

显然,只有经过身份验证的用户允许写入,但这是每个人都读取的问题吗?这是我能想到的唯一解决方案。

Basically, we want our app to sign in with a username/password instead of email/password. I had the idea to query the realtime database given the username and it would return the email associated with that username (each username is unique btw) and then continue to sign in with email/password. The sign in works, but I realize this could pose a security risk. The rules for our realtime database are as follows:

"rules": {
    "user":{
        ".read": true,
        ".indexOn": ["username"],
        "$uid": {
            ".write" :"$uid == auth.uid && auth != null",   
        }  
    }
}

Obviously, write would only by allowed by authenticated users, but would this be a problem having read be true for everyone? This is the only solution that I can think of.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文