Is it safe to hardcode your MySQL Database credientials?

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jr180180
Posts: 12
Joined: Fri Apr 20, 2012 8:59 am

Is it safe to hardcode your MySQL Database credientials?

Post by jr180180 » Thu Jun 19, 2014 1:18 am

I'm not sure if this has been covered but is it safe to hardcode your cloud database into the application as demonstrated in http://lessons.runrev.com/s/lessons/m/4 ... L-database? Especially, if you want to distribute this over the app store.

Would someone be able to decompile your application after you publish it to grab your database login?

Is there a way to encrypt that on compile so that if someone tried to do something malicious to your application after distribution, they wouldn't be able to recover your login credentials for your production database?

Or is there a better way to have people login to your cloud database?

Thank you!

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Is it safe to hardcode your MySQL Database credientials?

Post by bangkok » Thu Jun 19, 2014 7:09 am

It's a classic problem.

Basically 2 answers.

-if your app connects directly to your remote MySQL database... then of course there is a risk.
You could "reduce" this risk by encrypting the login/password inside your app... But still : it will remain there... at the mercy of anyone.
But you could as well calculate that this risk is not really worrying (if your database contains information with low value, or value only to you). Or you could have a mixed approach : sensitive data would be encrypted in the database, and the rest would remain in plain text.

-then there is the classic answer, from a security point of view : close all links between your MySQL server and the "internet". And add a layer between the MySQL server and your apps : a local script system (in PHP or LiveCode Server).
This layer will check the credentials of the app, receive queries from your apps, and then forward those queries to the MySQL server, and then send back the results.

jr180180
Posts: 12
Joined: Fri Apr 20, 2012 8:59 am

Re: Is it safe to hardcode your MySQL Database credientials?

Post by jr180180 » Mon Jun 23, 2014 9:21 am

Gotcha. Makes sense. Thanks for the explanation.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Is it safe to hardcode your MySQL Database credientials?

Post by Mikey » Mon Jun 23, 2014 2:18 pm

This very problem was just discussed by one of the computer security magazines. A group from...somewhere...did a study of the Google Play store and found that there were many, many apps with hardcoded credentials. The folks doing the study were able to easily decompile the apps to extract the credentials. Some of the bigger providers, like Facebook, freaked out and terminated a bunch of developer accounts as a result. The main concern they had was that anyone could download these apps from the Google Play store, decompile the app, and pull the credentials.

If this is a "private" app, your exposure will be limited.

Post Reply