繁体   English   中英

Firebase 存储如何限制图像域?

[英]How Firebase Storage limit images domains?

我使用 Firebase Storage 将图片作为图片空间,然后链接到我的博客,例如:

![example](https://firebasestorage.googleapis.com/v0/b/xxxxxx....)

我检查了提到的“https://firebase.google.com/support/guides/security-checklist”

rules_version = '2';
service firebase.storage {
   match /b/{bucket}/o {
     match /{allPaths=**} {
       allow read, write: if false;
     }
   }
}

但是似乎没有提到如何限制域,例如:图像只能在example1.com中读取,不能在example2.com中读取

Firebase 的 Cloud Storage 安全规则没有办法限制可以读取文件的域。 可能可以通过 Cloud Storage 的配置本身来控制它,但否则您需要查看 Firebase App Check ,它确保只有您自己的代码才能进行 API 调用。

注意:如果您为 Cloud Storage 中的文件生成下载 URL,则通过该 URL(设计)访问会绕过安全规则和 App Check,因此将始终被允许。 鉴于您可能适用于此处的“博客中”用例,但我不确定。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM