Section 1.7

Authorization

Definition

Authorization is the decision whether a subject (the user, device or program making a request) may perform a given action on a given object (the resource acted on) in the current context, together with the enforcement of that decision before the action takes effect. A policy, a set of rules, defines which combinations are allowed. Authentication §1.6 answers “who is asking?”; authorization answers “may this subject do this to that object, now?” Authorization usually takes the identity established by authentication as one of its inputs.

The idea

A person proves with a valid key to be technician T. May T now read a sensor? Replace the device’s recovery key §5.31? Install a program on a device that belongs to another customer? Authentication answered none of these questions; it only established who is asking. A system that treats “authenticated” as “allowed to do everything” gives every key holder, and every thief of a key, full control.

Authorization separates identity from permission. A hotel key card is a fair picture. The front desk checks identity once, then programs the card for one room and the gym, for the nights booked. The card opens those doors and no others, and each lock checks the card every time. The picture fails in one respect: a hotel lock decides only one action, opening its own door, from what the card and the lock’s clock say, whereas a software policy decides many different actions on many objects and can consult anything the system knows at that moment, such as a device’s mode.

How it works

An authorization check runs in these steps each time a protected action is requested.

  1. Request: a subject asks to perform an action on an object, such as “T: install a program on device A”.

  2. Subject binding: the system obtains the subject’s identity from a source it trusts, normally the authentication result for this very request, never from a name the requester wrote into the request.

  3. Decision: the policy decision point, the code that evaluates the policy, looks up the rules for this subject, action, object and context, and returns allow or deny. When no rule allows the request, the answer is deny; this is called default deny.

  4. Enforcement: the policy enforcement point, the code that stands in front of the protected action, lets the action proceed only after an allow decision, and acts on the same object that was checked.

  5. Record: where accountability matters, the decision is logged.

Policies are stored in a few standard forms.

Three design principles from Saltzer and Schroeder’s 1975 paper “The Protection of Information in Computer Systems” [233] govern enforcement. Complete mediation §1.16: every access is checked, not only the first. Least privilege §1.15: each subject receives only the permissions its task needs. Fail-safe defaults: access is denied unless it is explicitly granted. A reference monitor §1.17 is the classic enforcement mechanism that achieves complete mediation: every access passes through it, it cannot be tampered with, and it is small enough to be verified.

Worked example

A hypothetical maintenance service has one role, “diagnostic technician”, with three rules and default deny:

  1. a holder of the role on a device may read that device’s sensors;

  2. a holder of the role on a device may install a diagnostic program on it, but only while the device is in maintenance mode;

  3. no holder of the role may replace a device’s recovery key.

Technician T holds the role on device A only. T authenticates once, then sends five requests:

One identity, five requests: two allowed and three denied. Authentication was identical every time; the action, the object and the context changed the answer.

One mistake the example does not show concerns timing. Suppose the first request is checked while a handle, a reference the program uses to name a device, points to A, but before the sensor is read another task changes the handle to point to B. The check approved A; the action reads B. This is a time-of-check to time-of-use §9.26 (TOCTOU) error, a race condition §9.2 between the check and the use. The repair is to resolve the handle to a fixed object once, check that object, and act on that same object.

Stated precisely

Let 𝒮\mathcal{S} be the set of subjects, 𝒜\mathcal{A} the set of actions, 𝒪\mathcal{O} the set of objects and 𝒞\mathcal{C} the set of contexts. A policy is a function Pol:𝒮×𝒜×𝒪×𝒞→{allow,deny},\mathrm{Pol} : \mathcal{S} \times \mathcal{A} \times \mathcal{O} \times \mathcal{C} \to \{\text{allow}, \text{deny}\}, with the value deny for every combination that no rule allows. In the example, Pol(T,read sensor,A,normal)=allow,\mathrm{Pol}(\text{T},\ \text{read sensor},\ \text{A},\ \text{normal}) = \text{allow}, and changing only the action to “replace recovery key” gives deny.

An enforcement mechanism implements the policy correctly when, for every protected action aa performed on an object oo on behalf of a subject ss in a context cc, three conditions hold.

  1. Pol(s,a,o,c)\mathrm{Pol}(s, a, o, c) was evaluated and returned allow, on every path that leads to the action. This condition is complete mediation.

  2. ss came from authentication of this request, not from a value the requester chose.

  3. The object and context that were checked are the object and context at the moment the action takes effect, or a stated rule says how long a decision stays valid.

The policy and the mechanism are separate things: a mechanism can meet all three conditions and enforce an unwise policy perfectly.

Limits and common mistakes

Authorization is only as good as the subject binding. If the identity comes from a field the requester wrote, the requester chooses its own permissions.

A correct mechanism can enforce a bad policy. “Every authenticated peer may do everything” is a policy, and a dangerous one.

One unchecked path defeats the policy. A recovery mode or debug command that performs the protected action without calling the check bypasses it.

A confused deputy §1.25 is a privileged program that performs an action for a less privileged requester using its own permissions, so the check sees the deputy’s authority instead of the requester’s. The cure is to check the requester’s authority, or to have the requester pass a capability that carries exactly its own rights.

Permission to install code is not proof that the code is safe. Authorization decides who may submit a program; separate checks on the program itself, such as a verifier and a sandbox §2.30, decide whether it can run without harm.

Decisions age. A stored allow decision survives a role change or a key revocation §5.32 unless it is checked again or expires.

Questions answered

Can an authenticated peer install arbitrary code?

No, not unless the authorization policy explicitly grants that peer the right to install that code on that device; authentication by itself grants no permission. Authentication establishes which credential stands behind a request. Authorization is a separate decision: a policy is checked against the subject, the action, the object and the context, and the action proceeds only on allow. A careful policy restricts installation by device, by kind of program, by version (for example, nothing older than the version running), by operating mode, and possibly by a required second approval.

If a system skips authorization and lets every authenticated peer do everything, then yes: every key holder, including anyone who steals a key, can install arbitrary code. That is a flaw in the system’s policy, not a property of authentication. Even an authorized installation does not make the code safe. Whether a program can run without damaging the device is a third question, answered by checks on the code itself, such as a verifier, and by confinement, such as a sandbox.

Related entries: Complete mediation (§1.16), Policy versus mechanism (§1.19), Bytecode authenticity versus safety (§2.43), Authentication (§1.6), Least privilege (§1.15), Reference monitor (§1.17), Confused deputy (§1.25), Capability security (§1.40), Time-of-check to time-of-use (TOCTOU) (§9.26), Integrity endorsement: when untrusted input may influence trusted state (§1.49). Further reading: [233].