Doing CRUD
in firebase
is pretty easy and neat IMO. But I am confuse on how to protect the whole database.
So I have this database rules
:
{
"rules": {
".read": "auth != null",
".write": "auth != null",
}
}
Let's say I have a bunch of data on my database. If the user is not yet authenticated
this code firebase.database().ref('/').set(null)
is replying a permission_denied
error which is normal.
But the problem is once a certain user logs in and gets authenticated, this code firebase.database().ref('/').set(null)
will delete the entire database.
How do I secure this kind of setup? Also when I tried this code firebase.database().ref('/').set(null)
on the javascript web console it still deletes the data.