The least privilege is a term coined in IT Security that stablishs a user or an entity should only have access to specific resources or data to complete with their tasks. This means instead of creating several super users or only one super user and sharing the credentials, we should be focus en creating granular access for every user or application.

[!note] The Principle of Least Privilege is consider a fundamental best practice.

We can understand this easily with some examples:

  • Instead of having only one root user to access the database and execute all type of queries and also create and drop new tables or indexes, it is more sensible to create a user for the application with access to execute SELECT, UPDATE, DELETE queries and another user for maintenance labors CREATE/DROP indexes/tables.
  • When creating a new AWS account instead of using the root account, the recommendation is adding 2FA to the account and creating a new user with non root permissions but that can perform administration tasks in the account.
  • When assigning permissions to finance users to access AWS, instead of allowing them to creating EC2 instances, limiting them to access only the billing is a better approach.
  • Assigning Grafana permissions to only access cloudwatch on AWS or using the Grafana predefined permissions on AWS.

This principle is so important that all big cloud providers integrate a sevice called IAM that allows to create users, groups, custom rules or implement predefines rules.

Encoraging the use of this principle will reduce the surface of any attack in case of a credential leakage, also will prevent any user from executing commands that are not expected.