Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Access checks

An access check answers one question: may this principal take this action on this resource? Your code asks before it acts, and IdentityHound answers allowed with a reason your code or an agent acts on. IdentityHound uses the same check for operations that require a role permission, such as adding a member.

What a check names

  • The principal, any principal, a guest included.
  • The action, one of the resource type’s actions in your config, such as edit.
  • The resource, by its type and your own id, and the workspaceId it belongs to, if any. The workspaceId you name places the resource in its workspace and decides which workspace role counts.

Who may ask about whom

  • A principal asks about itself. Its credential decides who is acting: a session or an API key acts as its own principal, and a delegated token as the delegator, with the delegate and its delegation applied.
  • Your server asks about anyone, with your secret key: it names principalId, and may name the delegateId and delegationId of a delegate acting for it. With a delegateId and no delegationId, the check uses the newest active delegation from the principal to that delegate that covers the permission, among those for the resource’s workspace or for none, and matched.delegationId names it when the answer has a match. With no active, unexpired candidate, it answers delegation_missing. With candidates but none that count, it answers workspace_archived if any candidate is for an archived workspace, and delegation_scope otherwise.

If a server names only a delegationId, the delegation step answers delegation_missing.

The order

A check denies by default, and takes these steps in order. The first that fails decides the answer, and its reason names it:

Step Reason
The permission exists unknown_permission
The principal is active principal_inactive
The delegate is active actor_inactive
The delegation holds delegation_missing, delegation_expired
The delegation covers it delegation_workspace, workspace_archived, delegation_scope
The credential allows it credential_restricted
A role grants it no_access, workspace_archived
The entitlement is held entitlement_missing

The delegate and delegation steps run only when a delegate acts for the principal, and the credential step only for an API key with restrictions, or a delegated token from one.

An archived workspace grants nothing, so a check that only it would allow answers workspace_archived.

Roles are tried in the order project, workspace, then resource. The first that grants the permission decides an allowed answer’s reason: project_role, workspace_role, or resource_role. matched names the role, and the membership, resource role, delegation, and grant that counted. Roles says where each role is held, and Entitlements how an action comes to need one. The errors page explains each reason and what to do.

What an answer carries

  • configVersion: the config the answer used. A config change can turn an answer around, so record it beside a decision you keep.
  • steps, with explain: true: each step’s outcome, pass, fail, or skip, with a detail when there is one, for finding out why a check answered as it did.
  • An event, with audit: true: a denied check writes access.denied to the change feed. Batch checks write no audit events. A principal’s own audits are limited to 60 every 15 minutes; past that the check still answers, and writes nothing.

Other questions

  • Many at once: a batch takes 1 to 100 checks and answers each in order.
  • Everything at once: listing permissions on a resource answers every action of its type the principal may take, after every step above, such as the report:view and report:edit a delegation allows.

Where to act on it