我的 Firebase 存储规则是
service firebase.storage {
match /{allPaths=**} {
allow read: if request.auth != null;
}
}
我已从 Google 注销并在 Chrome 浏览器(隐身模式)中登录,然后输入从 firebase.storage 获取的 url(下载 url 链接)。我仍然可以下载该文件。如何保护文件仅在用户已通过 firebase.authentication 进行身份验证时才允许下载?
我的文件位于根 firebase.storage 位置。
我也尝试过
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if request.auth != null;
}
}
}
firebase.storage中有一个撤销下载url的url,但它似乎根本没有做任何事情。
最佳答案
下载网址可供公开访问,旨在将文件共享给 Firebase 外部的应用程序。 Firebase 安全规则不控制通过下载 URL 对存储对象的访问。您可以使用 Firebase 控制台撤销下载网址。
另请参阅 answer from a Firebase team member相关问题。他指出:
Using a download URL is the appropriate way to share files outside of an application, or to users who don't need to be logged in.
关于Firebase 存储安全规则 : After specifying "allow read: if request.auth != null" I can still access my files using the download link provided,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49540253/