I using firebase to save my application data, but I found some hacker inject data to my firebase data cloud.
I have an idea to use encryption. May be like this :
client encrypt string of json data, and save it to firebase reference. before it saved properly, there is some function or middleware run first to decrypt that encrypted request back to original string of json data. I use AES256 for it, so there is a password to encrypt and decrypt it.
is this possible?
for example raw data:
{
"data" : {
"name" : "dolly"
},
"token" : "aZuy7d8a7"
}
become
{
"data" : "$6a87dab9dd9a8d-d9ad0a9n0an976786",
"token" : "aZuy7d8a7"
}
and before firebase server-side save it properly, it will try decrypt data
to original, if decrypt proccess fail, it will return bad request HTTP response, of data not good.