Skip to content

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.grant admin_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_approvals needs, since RFC-0014 names grantr:read_approvals.

Decision

  • grantr.commands declares the catalog, CATALOG, lattice-core's Commands: 31 commands named grantr.<name>, version 1.0.0, among them grantr.list_bindings, grantr.bind and grantr.unbind, gated by grantr: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_member for grantr.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 admin toolset, but the approvals' reads, which are in core.
    • Each has a route in portalr's admin, /portalr/admin/t/{tenant}/....
    • The catalog is published as schemas/grantr.commands.json, regenerated by grantr:schema and checked for drift.
  • Granting is two commands: grantr.grant on a workspace, thread, artifact or rule, and grantr.grant_on_tenant for the tenant's roles, which is admin_high. grantr.grant refuses a tenant. Revoking stays one command, on any resource.
  • admin_high, each confirmed by its caller through lattice's SettingsPolicy (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") and grantr.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, gates grantr.list_approvals and grantr.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 Provider and Commands.
    • Its call runs each command as subject_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.

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

  1. grantr.commands: the catalog, its schema, grantr:read_approvals and the provider, tested, and through the enforcer, an admin_high command waiting for its caller's confirmation.
  2. The bindings' commands, with the bindings' store (grantr ADR-0041).
  3. The parity test, which reads this catalog (lattice ADR-0041).