liveBook · Manning

Principle of least privilege

As explained in Grokking Software Architecture

A security principle that grants users, processes, and systems only the permissions necessary for their required functions.

A receptionist’s keycard opens the front door and breakroom, not the server room. If the card is stolen, the thief’s access is limited. The principle of least privilege (PoLP) applies the same idea to users, systems, and processes: give each only the permissions needed for its intended function. section 11.2.1

Deny access by default, then grant specific capabilities. A single application-wide administrator account does the opposite: a flaw in an ordinary feature can expose every table that account can reach. Granular permissions limit the blast radius if a component is compromised. section 11.2.1 section 11.10

Set boundaries around what each component actually does:

  • Database: Give a reporting service read-only access rather than permission to change or delete data. section 11.2.1
  • Network: Deny public inbound traffic to an email-queue worker that does not need to receive HTTP requests. section 11.2.1
  • Secrets: Give a server’s short-lived role permission to read only the specific secret its application needs; retrieve credentials at runtime instead of hardcoding them. section 11.5.1
  • Outbound connections: Allow an internal service to connect only to approved domains, limiting where a compromised server can send data. section 11.7.1
CREATE USER order_processor WITH PASSWORD 'your_secure_password';
GRANT SELECT, INSERT, UPDATE ON orders TO order_processor;

This SQL creates an order-processing user and grants SELECT, INSERT, and UPDATE on the orders table rather than using a database administrator account. Document the intended permissions and check that the account cannot delete or drop data. section 11.8

Authentication establishes who a caller is; authorization determines what that caller may do. In a Zero Trust design, internal services verify one another’s identities and check permissions rather than trusting a request merely because it came from inside the network. Least privilege complements defense in depth: restricted access contains a compromise while other layers provide additional protection. section 9.7.1 section 11.3.3 section 11.2.2

A vendor key that reached too far

In the 2013 Target breach, attackers stole an HVAC vendor’s portal credentials and moved from the billing network toward point-of-sale systems. The lesson: a vendor that submits invoices should have only the access needed for that job, with network boundaries separating the vendor portal from sensitive systems. section 11.7 section 11.7.1

How Grokking Software Architecture covers it

How deep it goes
Defines default denial and granular permissions, then gives database, network, and runtime-secret practices without detailing complex cloud IAM policy configuration.
Examples
Uses office keycards, a reporting-service database account, an order-processor SQL exercise, and the Target HVAC breach.
What you can do after
Apply least privilege by identifying required permissions, creating a restricted database user, and documenting the decision in an architectural decision record.
How it connects
Connects least privilege to authentication, authorization, defense in depth, zero trust, and secrets management.

Also explained in

Compare how 22 books explain principle of least privilege →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.