Google cloud storage 具有特定路径异常的Firebase存储安全规则?

Google cloud storage 具有特定路径异常的Firebase存储安全规则?,google-cloud-storage,firebase-storage,firebase-security,Google Cloud Storage,Firebase Storage,Firebase Security,我想使用存储规则限制对整个路径的读写,但有一个例外,我的意思是: 只有通过身份验证,才能在任何路径中进行写入和读取 public可以写入但auth user可以读取的唯一路径是“/appUsers” 我尝试过,但没有成功: service firebase.storage { match /b/{bucket}/o { match /appUsers { allow write; allow read : if request.auth != nu

我想使用存储规则限制对整个路径的读写,但有一个例外,我的意思是:

  • 只有通过身份验证,才能在任何路径中进行写入和读取
  • public可以写入但auth user可以读取的唯一路径是“/appUsers”
我尝试过,但没有成功:

service firebase.storage {
  match /b/{bucket}/o {
    match /appUsers {
        allow write;
        allow read : if request.auth != null;
    }
    match /{allPaths=**} {
        allow read,write : if request.auth != null;
    } 
  }
}
使用该代码,Im只能通过身份验证进行读取和/或写入


如何实现此特定的安全规则?

您如何测试此规则?规则是游戏场还是生产应用程序?在控制台规则中,你的要求对我有效Playground@ScottCrossen天哪,你说得对,我已经在firebase模拟器上进行了测试,似乎工作得很好。我正在从React本机应用程序中写入。即使我将AllPath设置为public write,应用程序也无法写入其上载,这在我看来似乎表明规则不是问题所在。我不知道该怎么帮。奇怪的是,你能写,但只是通过身份验证。您可能使用了错误的SDK(GCS vs Firebase vs Firebase Admin)。您如何测试它?规则是游戏场还是生产应用程序?在控制台规则中,你的要求对我有效Playground@ScottCrossen天哪,你说得对,我已经在firebase模拟器上进行了测试,似乎工作得很好。我正在从React本机应用程序中写入。即使我将AllPath设置为public write,应用程序也无法写入其上载,这在我看来似乎表明规则不是问题所在。我不知道该怎么帮。奇怪的是,你能写,但只是通过身份验证。您可能使用了错误的SDK(GCS vs Firebase vs Firebase Admin)。