INTERNETORDERSBOTPAYROLL01SETTINGS1GRANTS = {2 "sam": {"orders:read"},3 "bot": {"orders:read"},4}5def allowed(who, act):6 mine = GRANTS.get(who, set())7 return act in minewhoact
Back row: who asks, the access check, and what they ask forFront row: the rule in Python and the values it checksTokens: permission keys and requestsAt the back: the attacker on the internet, Sam in support and a report bot, the access check with its 1/0 lamp, and the orders, payroll and settings. In front: the Python rule, GRANTS and allowed(), and the two values the check reads. Sam's request to read orders passes; a page Sam does not need, an unknown name, a stolen account and a buggy bot are all stopped at the check. 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.

The idea

  1. 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.

The rule in Python

Why it matters

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.