firebase - 什么规则将使我的 Firebase 存储桶只能由同一项目中的 Firebase 函数访问?
问题描述
我的文件上传到 Cloud Storage 存储分区只能从 Firebase 控制台进行。什么 Cloud Storage 规则只允许我在同一个项目中的 Firebase 函数读取/写入存储桶?
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
???
}
}
}
解决方案
Cloud Functions 以对其所属项目的管理访问权限运行。这意味着您可以简单地不授予普通用户访问存储桶的权限,因为 Cloud Functions 无论如何都会绕过您的规则。
从文档中:
// Access to files through Firebase Storage is completely disallowed. // Files may still be accessible through Google App Engine or GCS APIs. service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read, write: if false; } } }
您对 Cloud Functions 的访问属于上述评论中的“GCS API”。
推荐阅读
- scikit-learn - 有什么方法可以将输入向量化为 sgdclassifier?
- discrete-mathematics - 从离散数学 - 图论
- angular - 开玩笑:nativeElement.getBoundingClientRect 不是函数
- python - 构造函数调用中的Python意外关键字参数
- linux - CMake 找不到源文件,但在 TFS 构建定义中的 CMakeLists.txt 中未指定文件
- python - 尝试解析 gzip 压缩的 CSV 文件时出现“ValueError:找不到子字符串”
- python - Python 中的测试数据预测
- windows - PowerShell AuditQuerySystemPolicy:审核策略的值
- python-3.x - python:与控制台程序的通信
- routes - MikroTik 路由