The idea
Least privilege means giving each person and each program only the access its job needs, and nothing more. Our example is a small online shop: Sam, a report bot, and the orders, payroll and settings they could touch.
Begin with what each job really needs. Sam works in customer support and reads orders to answer questions. The report bot, a small program, reads orders to count sales. Neither one needs payroll or the shop's settings.
The rule in Python
In Python, a dictionary called GRANTS maps each name to a set of allowed actions. Sam gets exactly one permission, "orders:read", and so does the bot. Anything not written here is not allowed.
Every request passes one check: the function allowed(). It finds the name in GRANTS and asks if the action is in its set. Sam asks to read an order: True. The lamp shows 1 and the request goes through.
Now Sam clicks the payroll page. "payroll:read" is not in Sam's set, so allowed() returns False. The lamp shows 0 and the check stops the request. Sam can still do the whole job.
A request from the internet uses the name "guest", which is not in GRANTS. GRANTS.get(who, set()) then gives an empty set, so every answer is False. Deny by default: if nobody wrote a rule, the answer is no.
Why it matters
Suppose Sam's password is stolen. The attacker signs in as Sam, so who is "sam" and they get only what Sam has: reading orders. Their try at the settings is refused. Least privilege keeps the harm small, the 'blast radius'.
The rule is for programs too. The report bot only reads orders. When a bug makes it try to delete orders, the check says no, and nothing is lost. NIST applies least privilege to processes, not just people.
Access piles up unless someone removes it; this is called privilege creep. When Sam moves to another team, take "orders:read" away and grant only what the new job needs. Review everyone's access on a schedule.
Four habits: start from the job, deny by default, check every request, and take access back when it is no longer needed. Mistakes and stolen accounts still happen; least privilege keeps the harm they can do small.
What happens
;; step 1/10 · meaning
least privilege only the access the job needs
nothing more, for people and programs
NIST "the minimum system resources and
authorizations that the entity needs
to perform its function"
here Sam, a report bot
orders · payroll · settings
Real systems keep permissions in a database or an identity service, and check far more than a name, but the idea is the same: one check, on every request, against a list that says what each account may do. Least privilege does not stop an account being stolen; MFA and phishing training help with that. It limits what a stolen account, or a mistake, can reach.