Least privilege means: give each role only the privileges it needs for its job, and nothing more. If an attacker steals the password of a role, they get only what that role can do.
Set up Monster Market's roles. Use everything from this chapter.
- The shop application. Create a role
shop_appthat can connect. It readsproductsandcategories, reads and insertsordersandorder_items, and changes only thestockcolumn ofproducts. Nothing else. - The analytics team. Create a group role
analyticsthat cannot connect. It readsorders,order_items,productsandcategories. Create a rolemayathat can connect, as a member ofanalytics, with no privileges of her own. - Customers, without personal data. The analysts need each customer's country, not names or emails. Create a view
customer_countrieswith theidandcountryof every customer, and letanalyticsread it.analyticsmust not readcustomers. - Test it. Become
mayaand count the orders per country: thecountryof the customer, then the number of orders. Then go back to your own role.