1

When I log into cPanel, I go to create a new MySQL Database with the wizard. Usually, it is recommended to assign the database user with all of the permissions from Insert, Update, Alter, Execute, etc. in the list. This has gotten me thinking.

Please note: When I build my applications, all the permissions that are required is Insert, Update, Delete, Select and Alter. Which is very reasonable for doing everything we want to displaying data, and interacting with it.

When do we ever want to actually allow an web application such as a simple PHP CRUD to execute, drop, create, trigger, and a few other privileges? Would that be more of a security threat to MySQL and our database?

1

It wouldn´t be more of a threat since using a high privileged account by itself won´t give you any problem but it IS more of a risk if your application is somehow compromised by maybe a SQL Injection. It is recommended to run applications with just the level of privilege needed and not more, it is a security best practice known as the principle of least privilege.

http://en.wikipedia.org/wiki/Principle_of_least_privilege

1

When do we ever want to actually allow an web application such as a simple PHP CRUD to execute, drop, create, trigger, and a few other privileges?

To address this question, several scenarios come to mind:

  • Many web applications have installers (take Wordpress for example) which needs to create the schema
  • Often the credentials used in the web application are used to execute database migrations (ie. programmatic updates to the database schema)
  • Some applications create new tables on the fly, such as when a new customer is added. I'd consider this to be poor design in all but a few cases, but it happens nonetheless.
  • Software that has a plugin system often allow plugins to create new tables
  • Some operations such as truncate might be useful for clearing a cache table

Generally none of these uses are really in the interest of creating the most secure environment possible. If your application has an installer you might like to consider changing the credentials to a less privileged user after the install.

As for why cPanel might default to granting all operations - my guess is that they'd rather minimise the support requests from users who grant the wrong permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy