Part 4 of 14 · 2 min read
A task-scoped grant expires before untrusted text can widen it
The question "what does this task need?" has to be asked and answered before the model reads anything an attacker could have written.
Think of a permanent master key versus a visitor pass that works today and only for the third floor. The master key is risky precisely because it is still there tomorrow, no matter who asks to borrow it.
In plain words: a standing grant is one broad, long-lived credential handed out once for a whole session. A task grant is minted by a broker for exactly one purpose and expires on its own. Because the broker decides the grant's contents before the model has read any untrusted text, nothing that text says later can widen what the grant allows.
A worked example. The standing grant used in setups C1 and C2 holds five permissions at once, including payments:refund and tickets:close, valid for the whole session. The task grant minted for a "view" task holds only tickets:read, with one allowed write and a 300-second lifetime. Calls at t=0 and t=299 are allowed, but the identical call at t=300 is denied with "grant expired," and so is the same call at t=900. A poisoned ticket read during a "view" task cannot close or refund anything. That is not because the gateway caught a request to do so; it is because the grant it is working with was never minted with those permissions in the first place.
The key lines. From code/mini-privilege/privilege.py:
# from code/mini-privilege/privilege.py
def mint(self, task: str, customer_id: int, principal: str = "support-agent", max_refund: float = 50.0) -> Grant:
if task not in self.TASK_SCOPES:
raise ValueError(f"unknown task {task!r}; known tasks: {', '.join(self.TASK_SCOPES)}")
scopes = frozenset(self.TASK_SCOPES[task])
return Grant(principal, scopes, customer_id, max_refund if "payments:refund" in scopes else 0.0,
max_writes=1, expires_at=self.clock.now + self.ttl)
Read it as: mint takes only task, customer_id and a principal, never anything from the text the model is about to read. The broker is asked "what does a 'view' task need?" before the ticket body is seen at all. So the grant it returns is fixed by the time any poisoned instruction could try to influence it.
Grant, broker
A grant states what one caller may do, for one purpose, for a limited time. A broker mints a grant for one task instead of handing out a standing key.
Example: the same get_ticket call that is allowed at t=299 is denied at t=300 with exactly the same arguments. The grant's expiry, not anything about the request itself, is what changed. That is the whole point of a credential that is short-lived by design.