As anyone can access and read my JavaScript file using view-source:
in browser they can also see my firebase config:
var firebaseConfig = {
apiKey: "<apikey>",
authDomain: "<authDomain>",
databaseURL: "https://<databaseurl>",
projectId: "<projectId>",
storageBucket: "<projectId>.appspot.com",
messagingSenderId: "<messagingSenderId>",
appId: "<appId>"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
If anyone tries to access my database from the database URL from config then its permission will deny from firebase but if anybody tries to access my database JSON file from this link: https://PROJECTID.firebaseio.com/.json
then he/she can easily read my full JSON mean what I have stored in the database they can easily access. Is there is any way to deny permission to see my database JSON file from https://<PROJECTID>.firebaseio.com/.json?
Yes, I know it will not cause problems if I will apply firebase security rules but I am creating a messaging website and I want to keep my user data private. And yes if the user will create a password for him/her they can keep their data private but if somebody is expert in coding or can read the JSON he/she can easily read the data of my whole firebase real-time database.
If you doesn't understand what I want to say than you can see a demo I've created to understand it better here: https://game-check-2-default-rtdb.firebaseio.com/.json
If anybody knows it please help me.
Edited: My firebase rules :-
{
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
"rules": {
".read": true,
".write": "data.exists() && newData.exists()"
}
}