Problem Statement
Which principle should guide database permission design for application users?
Explanation
Least privilege shrinks blast radius. If a credential leaks, the attacker is limited to the granted actions. Start with read-only and add specific INSERT, UPDATE, or EXECUTE rights as needed. Prefer role-based grants over per-user grants.
Code Solution
SolutionRead Only
CREATE ROLE app_read; GRANT SELECT ON ALL TABLES IN SCHEMA public TO app_read;
Practice Sets
This question appears in the following practice sets:
