我的Firebase存储中有以下规则。但是,即使我没有经过授权/认证,当我具有以“ https://firebasestorage.googleapis.com/”开头的链接时,我仍然可以访问图像。我有一个名为 toyCarImages 的文件夹,我希望允许公众进行写入,并且只能从授权帐户中进行读取
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
// allow read, write: if request.auth == null;
allow read: if request.auth != null;
allow write: if request.resource.size < 5 * 1024 * 1024
&& request.resource.contentType.matches('image/.*');
}
}
}
如何解决此问题?我在应用程序中使用getDownloadUrl()
方法。使用getDownloadUrl()
时有多安全?
预先感谢
答案 0 :(得分:2)
下载URL为拥有该URL的任何人提供对该文件的公共只读访问权限。存储桶的规则不保证通过下载URL访问文件的安全性。
如果您要阻止某个下载URL,唯一的选择是从Firebase控制台撤消该URL。