Comparison
AuthorizationvsPrinciple of least privilege
Authorization
you check whether this particular user is allowed to touch this particular record, not merely that they are logged in.
Deciding whether an authenticated principal may perform an action on a resource. The dangerous gap is object-level: the endpoint checks the role but not that the record belongs to the caller, so changing an id in the URL returns someone else's data. It must be enforced server-side per request, on every path that reaches the resource.
Full entry →Principle of least privilege
you give the service a database user that can only read the two tables it needs, rather than the one that can drop everything.
Granting only the permissions needed for the task, for as long as they are needed. It does not prevent compromise; it bounds what a compromise reaches. The common violations are boring and universal: an admin credential in CI, a service account with wildcard permissions, a token that never expires.
Full entry →