I have read about Parse server which was created by facebook , but I think there are serious security issues.
I can decompile other people apk
and get Parse master key
, appId
and then I can connect this people parse server from my own application and can do whatever I want to do with his data which very dangerous
Even I can make while(true)
loop and insert infinite data to the parse server.
So how can I connect any API in Android Studio securily?
3
Answers
You can store your API keys, Secret keys or any other important key information in .C file.
For that you have to use NDK.
You can follow this link for how to use the NDK to secure your file. You can also find GitHub demo app link at the bottom of the page.
The Application ID is not a security mechanism and you must not ever use the master key in public applications as it allows you to bypass all of your app’s security mechanisms. It’s a big mistake to store master key in the app.
Security must be provided to Parse Server by Class Level Permissions and ACLs (and all connections should be made with HTTPS and SSL).
In my experience, Class Level Permissions should rarely grant Public access (default behavior when creating a Class in Parse Dashboard). I only use Master key for testing purposes and to do some queries/savings in afterSave triggers and cloud functions.
I recommend reading the Parse’s Security Guide to understand a bit better how to build a secure Parse API. Here is an important fragment that backups my answer:
You shouldn’t put the master key anywhere publicly available. If it’s in your APK, you’re doing something dangerously wrong. Master key should only be an environment variable on your server.
Sure, you could get anybody’s app id and client key (if they added one) by decompiling, but that’s the same with basically any API. You need to use the security tools provided by Parse, namely CLPs and ACLs. You shouldn’t have any data too sensitive on your server at all. I.e., you never need to store a user’s actual payment information, you should use a payment API, pass any information needed to them directly from clients, and store the tokens they give you. I.e. with Stripe, there is a “public key” that is used on the client to talk to their secure server, pass credit card info, and create a card token, and you pass that card token back to your server, which can use the secret key, which should absolutely never be put in a client app, to create charges and things.
CLPs and ACLs restrict access to your objects. CLP (Class Level Permissions) are used to restrict entire tables. They have a cool thing called Pointer Permissions, so if an object has pointers to a user, you can set it to the user set on that field can access their objects. You can restrict public access so you can only get an object with the id, but not find it in a query. You can completely restrict read access, and you should restrict write access on most classes. Business logic goes on the server, you can verify a session token to make sure a user should be accessing an object and then use your master key to actually do necessary updates.
Parse-Server has all of the security implementation you need to protect your user’s data. You just have to implement it properly. If you don’t use CLPs and ACLs, anyone can decompile your app and get your entire database.
Also, Parse wasn’t created by Facebook. It was acquired, then shut down and open sourced about a year or so later.