I'm building a C# desktop app in Visual Studio's Windows Forms and am using the CefSharp library so I can use html, css, and front-end js for the UI rather than the default Windows Forms components. I've made a login page but need to connect to the database (MySQL).
Now, I realize that there are ways to do this without a library but for simplicity and for the fact that it's designed for this specific puprose, I'm using the MySql.Data
package from NuGet. So, my connection string would look like this:
using MySql.Data;
...
MySqlConnectionStringBuilder conn_string = new MySqlConnectionStringBuilder();
conn_string.Server = "xxx.xxx.xxx.xxx";
conn_string.UserID = "root";
conn_string.Password = "rootPassword";
conn_string.Database = "accounts";
using (MySqlConnection conn = new MySqlConnection(conn_string.ToString()))
using (MySqlCommand cmd = conn.CreateCommand())
{
// Run queries here (this probably won't sanitize them uh oh)
}
Now, this code works all fine and well.
My issue/question is that since I'm using a password in the source code, if someone were to decompile my application, then they would have the login credentials for my database, right?
Is that something I should even be worried about? Should I just run my final build through one of those pieces of software that claims to make your program harder to decompile?
I noticed that in Visual Studio, you can "Add a Data Source" - is there a way I can use that for a MySQL database rather than the default Azure/Oracle/MSS options?
Thanks so much for your time!