Identity, Authorization, and Least Privilege › Least privilege in practice: minting, narrowing, and expiring
Language AI HandbookAll chapters The evaluator is the check. Least privilege also depends on which authority the issuer grants. Start by identifying the resources and operation needed for one task. A summary workflow can use a draft-read grant, while publishing a review-state change can require a different grant and an independent approval decision. Giving both workflows an unrestricted service identity expands the effect that an application logic error can cause.
Keep renewed authority tied to the task. A long-running workflow might wait for a person to review a proposal, so the original grant or approval might no longer apply when the effect is ready. Determine which context can be refreshed, which parts require another user decision, and which parts are recovered by simply stopping the task. A stale grant should not become fresh merely because the application retries the operation.
Narrow the child grant when the subtask needs fewer operations, fewer resources, or less time. A child can keep a dimension unchanged if the task needs the same boundary on that dimension. The subset and interval checks in the fixture prevent broadening in these three dimensions during a hop. A deployed issuer also needs to establish which actor may delegate and in what context. The fixture demonstrates the comparisons, with trusted first-hop issuance as an assumption.
Record the consent information separately when a user authorizes a specific task. In production the consent record includes the details the service needs to evaluate the authorization boundary. A wider grant than the user intended can be limited by separate consent enforcement, but the system still needs to correct the issuer or policy that produced an overbroad grant. A scope field that says read describes one dimension. The service still needs to verify resource ownership and that the workload is acting under the right grant.
Revocation latency should be a design input. Consider a human withdrawing a task while a background worker waits for another result. A service with an authoritative current-state check can observe the withdrawal after the withdrawal reaches that enforcement point. A service using a cached decision may need an invalidation mechanism or a freshness limit consistent with its risk tolerance. The fixture models a resolved revocation flag, so it does not predict any propagation or cache latency.
The workload requests a bounded operation, an issuer grants scoped authority, and the resource service checks the effect it will apply. The controls protect different aspects of the task. The issuer limits the grant even if the workload later proposes too much. The service evaluates the resolved operation and resource even when the issuer allowed several operations. Auditing records which decision the service made without supplying permission itself.
Tenant separation as a hard invariant
In the orchard/coast example, a resource key includes its workspace because the same draft identifier can be reused across workspaces. A real catalog may have globally unique resource identifiers and still need authorization against the tenant or ownership relation. The policy should use a trusted ownership record to establish that relation. The service then applies the effect to that same resolved resource.
A business process that needs cross-tenant work requires an explicit policy for that scope. The fixture chooses the simpler invariant that all principals, chain endpoints, and the target share a workspace. Do not infer a production exception from the order of the tests. In this policy an operation scope can never substitute for the workspace invariant.
Report tenant-related decisions according to trusted observability policy. A mismatch can reflect an ordinary user action, a routing error, or a broken assumption in another component. A useful audit record preserves the reason, request or task correlation, and policy version while avoiding disclosure of unrelated tenant contents. Investigate patterns with enough context to distinguish expected rejects from an unexpected change.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!