0
votes

I just receive an email from firebase which is:

Email Title: [Firebase] Client access to your Realtime Database connectsocialmediaapp-default-rtdb is expiring in 5 day(s) Email Desciption: You chose to start developing in Test Mode, which leaves your Realtime Database instance completely open to the Internet. Because this choice makes your app vulnerable to attackers, your database security rules were configured to stop allowing requests after the first 30 days. In 5 day(s), all client requests to your Realtime Database instance will be denied. Before that time, please update your security rules to allow your app to function while appropriately protecting your data. Analysis is run daily; if you've modified your rules in the last 24 hours, those changes may not be accounted for. how can i update my database security rules so that client access to my realtime datbase would not expire...??

My current security rules are

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if
          request.time < timestamp.date(2021, 4, 22);
    }
  }
}

current security rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
1
Can you share an example of your database and demonstrate paths users should read. Firebase does not support public or open-faced databases and requires some sort of filtration - DIGI Byte
Is your issue resolved? Please let us know if you have further queries. You can mark the answer as checked if satisfied so others know that your query has been resolved. - Dharmaraj
my issue has not solved yet ...i am still getting email from firebase that Client access to your realtime database is expiring soon - Saad Ebad
@SaadEbad would you please update the security rules in your question? What are the current rules ? - Dharmaraj
@Dharmaraj i have updated current rules - Saad Ebad

1 Answers

1
votes

You can set your rules as follows:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

This rule above will allow only authenticated users to access/write data to your database. Please do note that any user can access all the information in your Firestore if you set the rules to if true;. You can checkout this link for some common security rules and their user cases. Here is the link to official documentation for Firestore security rules.

allow read, write: if false;

You can set this rule to disable users' access to the database.