Reputation: 319
I have a little web app that constitues of only JavaScript/JQuery
files.
It's kind of anonymous link based messaging app, so there's no authentication stuff.
I'm worried that someone can easily read/write
to my database.
Is there any setting/security rule with which i can allow read/write
requests from my domain only? (same origin policy)
Upvotes: 5
Views: 1477
Reputation: 4021
I would recommend just using the basic make sure they are logged in rule
{
"rules": {
// only authenticated users can read or write to my Firebase
".read": "auth !== null",
".write": "auth !== null"
}
}
But wait, I want to stop access from other domains!
Well you can set the authorized domains from the authorization panel in the firebase console. This would only allow users to log in from your url and only your url and only logged in users can read/write.
Upvotes: 4