My application uses AngularJS + Firebase authentication using google. As user signs up into the application it creates an entry of that user in database as shown below:
user
->Firebase Unique Key
-> UserId: "google ID"
-> User Name: "User Name"
-> Payment Status:"No"
Now once user logins user will see payment option and once payment has been done database value for that particular ID will get populated against "Payment Status" as shown in JSON above. Once payment status is yes then only user is allowed to view the main page.
I have created security rules as shown below:
{
"rules": {
".read": "true",
"user":{
".write": "auth.provider == 'google' && auth.uid!=null"
}
}}
Now the question is: Any user who can login using google has access to write to this database. So once user is authorized user can make changes in the database. Also user can run his own code from localhost and can make changes to the database.I don't want any user to hack data and mark payment status as "Yes" and proceed to main website.
How to make sure that authorized user wont perform any malicious activity in this database.