ADR-0042: grantr's commands: every action on access a command, called as the person it is for¶
Status: Accepted Date: 2026-11-01 Deciders: Alex Nodeland Implements: lattice RFC-0014's grantr catalog (phase 1, #916) and RFC-0011's grantr provider; on lattice ADR-0041
Context¶
RFC-0014 makes every action a person can take in portalr a command, declared once in each package's static catalog and called through RFC-0011's enforcer. grantr's covers members, groups, keys, roles, grants, integrations, settings, the audit log and approvals' reads. RFC-0014 names grantr's admin_high commands, and says answering an approval is never a tool. Three things are grantr's to settle:
- how to make
grantr.grantadmin_high"when the role holds owner or admin's actions", since a capability's risk class is fixed; - what a key's issuing is;
- which action
grantr.list_approvalsneeds, since RFC-0014 namesgrantr:read_approvals.
Decision¶
grantr.commandsdeclares the catalog,CATALOG, lattice-core'sCommands: 31 commands namedgrantr.<name>, version 1.0.0, among themgrantr.list_bindings,grantr.bindandgrantr.unbind, gated bygrantr:manage_bindings(ADR-0041).- Each is gated by the action grantr's own method asks: a list by the action that manages it, such as
grantr:add_memberforgrantr.list_members. - Every grantr action but
grantr:create_tenant, which is portalr's command (RFC-0014), is some command's gate. A test holds that. - Each is in the
admintoolset, but the approvals' reads, which are incore. - Each has a route in portalr's admin,
/portalr/admin/t/{tenant}/.... - The catalog is published as
schemas/grantr.commands.json, regenerated bygrantr:schemaand checked for drift.
- Each is gated by the action grantr's own method asks: a list by the action that manages it, such as
- Granting is two commands:
grantr.granton a workspace, thread, artifact or rule, andgrantr.grant_on_tenantfor the tenant's roles, which isadmin_high.grantr.grantrefuses a tenant. Revoking stays one command, on any resource. admin_high, each confirmed by its caller through lattice'sSettingsPolicy(lattice ADR-0038):grantr.delete_tenant;grantr.revoke_key;grantr.grant_on_tenant;grantr.define_role, always, since the actions it gives are known only as it is called;grantr.grant_operator.
- Not exposed, portalr's alone:
grantr.answer_approval("approvals come from a person") andgrantr.issue_key, whose secret is shown once, to the person who issues it, in portalr, never in a model's context. The provider doesn't offer either, and refuses to run one. grantr:read_approvals, a new action, gatesgrantr.list_approvalsandgrantr.read_approval. Every member of a tenant holds it, and what they read is still only what they may answer or were asked for (ADR-0040).grantr.commands.provider(grants)binds the catalog at the application's composition root:- It is lattice-core's
ProviderandCommands. - Its
callruns each command assubject_of_call(context), the person the call is for (ADR-0039), in the call's tenant, so grantr checks it again as it checks every command. - It answers JSON text.
- It is lattice-core's
Options considered¶
Option A: Split granting on the tenant (chosen)¶
Pros: the risk class stays a property of the command, which the enforcer, portr and the parity test read without arguments. Granting a tenant's role, the case RFC-0014 means, is always confirmed. Cons: a client sees two commands for granting.
Option B: One grantr.grant, always admin_high¶
Cons: every grant of an editor on a workspace would ask a confirmation, which people would learn to click through.
Option C: A risk class decided from the arguments¶
Cons: the policy reads only the capability and the call's context. Arguments would be a contract change to ApprovalPolicy, and portr couldn't say in a tool's annotations which calls confirm.
Consequences¶
- Easier: an application offers grantr through the enforcer with one
provider(grants), and an outside client or another library's agent manages access as the person it acts for. - Harder: a new grantr action needs a command, or a reason in the parity test, and a new command is a public name.
- The connections' commands come with connections (#917).
- The entry point that names the catalog comes with lattice-core's discovery of commands and the parity test.
Action items¶
-
grantr.commands: the catalog, its schema,grantr:read_approvalsand the provider, tested, and through the enforcer, anadmin_highcommand waiting for its caller's confirmation. - The bindings' commands, with the bindings' store (grantr ADR-0041).
- The parity test, which reads this catalog (lattice ADR-0041).