Firebase security rules: “ruleset uses old version”, what is current version?

丶灬走出姿态 提交于 2020-07-22 06:06:49

问题


firebase --version 8.4.1

with Firebase init I created some files.

Now firebase deploy is complaining about firebase.storage. The error message is:

Ruleset uses old version (version [1]). Please update to the latest version (version [2]).

What is wrong with it?

firebase deploy
deploying database, storage, firestore, functions, hosting 
database:   checking rules syntax... 
database: rules syntax for database $db is valid 
firebase.storage: checking storage.rules for compilation errors... 
undefined:undefined - Ruleset uses old version (version
   [1]). Please update to the latest version (version [2]).
firebase.storage: rules file storage.rules compiled successfully

cat storage.rules

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth!=null;
    }
  }
}

回答1:


You should be using security rules version 2 going forward. Note the first line:

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


来源:https://stackoverflow.com/questions/62137672/firebase-security-rules-ruleset-uses-old-version-what-is-current-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!