Will it affect MySQL databases accessible from the Internet but secured with a long random password?
Will it affect MySQL databases accessible from the Internet but secured with a long random password?
That said, if you'd read the article you'd see that so far only unsecured MongoDB, Elasticsearch and Redis installations are being attacked so far.
PS: I don't know exactly what you mean by "Stick an API layer in at the very least with key based auth" because I never used an API before and didn't know I would need something like this.
Also, for that matter, its a good idea to run backups too, just in case something goes wrong and you need to restore.
This is literally people allowing users to run arbitrary commands on their fully exposed db, and then being surprised when someone runs a delete.
Don't allow access to `mysql -h hostname` from WWW. Instead, keep your MySQL server accessible only by machines you control in the same security group/network/etc. To get access to the database from the public, create an API that allows predefined queries only to users you've authorized. This API would also be hosted within the same security group/network/etc. The public never gets direct access to the database, yet gets the predefined access they need.
If you want to run a database securely, you configure a decent password (should be asked during installation), create new users for each application/database (easy with tools like MySQL workbench) and make all applications running on the server (Flask, in this instance) connect to localhost/127.0.0.1. Don't expose services like databases to the outside world if you cannot in any way help it.
Then enable a firewall on your server (Ubuntu server comes with UFW by default) and lastly use a port scanning tool like nmap/zenmap to check if you have left any services other than HTTP(S) exposed.
I don't know much myself about Flask deployments specifically, but you'll probably use something like nginx or Apache to handle the actual web requests. There's an article here [0] on how to do that. After you've done that, you can secure your connections for free through Let's Encrypt clients like certbot [1] which handle most of the configuration for you.
TL;DR:
1. Configure your application to connect to localhost with a secure password
2. Enable a firewall, run "nmap <your domain>" to check if it works (should only expose HTTP(S) and probably SSH if you did it right).
3. Install nginx or Apache to handle requests for you and follow the guide at [1]
[0] https://www.digitalocean.com/community/tutorials/how-to-depl...
Trouble is modern web-development is so dumb they just treat databases as dumb-blackboxes. So hence they end up in situations like this where security is thrown out the window in the name of minimising any obstacles to get data from the database (and no doubt dump it all into a stupid array in the frontend).
This creates a self-perpetuating lore amongst devs that databases are "slow".
But this is largely because they can't be bothered to use the database in the correct manner (correct schema design, sprocs etc. etc.)
And don't get me started on the "portable query" junk ! Sure you can write dumb queries that run on everything from SQLite to Oracle, but its far from being a remotely sensible thing to do.
Rant over. ;)
However, it's highly recommended you never expose such services to the public, or at least limit allowed IP ranges.
That's really not something you should be gambling on. Assume the worst, and architect based on it.
Limit what can be exposed where / how (e.g. as you say, "at least limit allowed IP ranges", but to me that's absolute bare minimum)
For example I'd probably trust MySQL or PostgreSQL key validation more than what some random dev has coded in a private repo (more eyes on the code and probably better developers looking at it).
Auth is something that a lot of devs still do not implement properly and even popular libs for it like passport for node and others (including default configs for most JWT libs) have had very bad security issues.
If your minimum permissions map well onto the databases permission model then it's better to not have a layer in between. Proper db permissions and a using TLS/SSH as a transport is probably better.
As for us, we give access via an SSH tunnel, which requires public keys from certain IPs.