RolebookDocs

Delegation and denials

The delegation ceiling, deny-carrying roles on groups, owner recovery, and how denials hide resource existence.

Sharing grants are made by actors less trusted than the resource’s owner: anyone the policy allows management.members or management.invitations. Without a bound, a manager could grant a second account a role stronger than its own and have that account promote it in return. The module therefore enforces a delegation ceiling. The current owner is exempt.

The ceiling

  • grantRole, changeRole, and issueInvitation to a role require the actor to cover every allow rule of that role’s policy role, inherited roles included. A type:* wildcard expands to every action the type declares.
  • changeRole and revokeMember also require covering the member’s current role, so a weaker manager can neither demote nor remove a stronger member.
  • Lifting a deny hands out the access it blocked. Every deny of the member’s current role that the new role does not carry identically (all of them, for revokeMember) must be covered as if the actor were granting an unconditional allow of each permission it names.
  • A role, or a stored role label, that cannot be resolved is never covered.

An allow rule is covered, for each concrete permission it names, by a rule-level test over the rules of every role the actor holds on the resource, through its own and its groups’ assignments:

  1. the actor holds an allow naming the permission (or its type’s wildcard) that is unconditional and field-free, or that has exactly the granted rule’s where and fields. An allow whose condition merely happens to hold right now never covers a broader grant; and
  2. every deny the actor holds naming the permission is carried, identical in effect, permission, where, and fields, into the role being handed out, so the recipient is restricted exactly as the actor is.

A permission on the resource’s own type must also be allowed now by a real Rolebook decision for the actor on this resource, resource-wide and bound like the management check. A permission on a descendant type cannot be checked against this resource, so the rule-level test is all it gets. Anything not covered is FORBIDDEN.

Groups, denies, and the owner

A deny on a group’s membership reaches every current member of the group, the owner included. So that a less-trusted manager cannot lock the owner out of their own resource, granting, changing, or inviting a group to a role that carries any deny requires the actor to be the current owner (FORBIDDEN otherwise). An individual may still receive such a role from a manager who covers its allows. An invitation whose recipient does not resolve as a group when it is issued is judged again when a member accepts it on a group’s behalf.

The owner can always recover from a deny that reaches them anyway. When the current owner revokes or changes a membership, the management check is bound with ownership and the identity adapter’s own assignments only, so no membership-derived deny applies, and the owner may revoke a deny-carrying membership of a group they belong to. Other owner commands, such as transferOwnership, still honor the deny until it is removed. Workspace assignments from the identity adapter are application policy, not sharing grants, and still apply.

An actor may not grant, change, or invite a group it belongs to (SELF_PROMOTION). It may revoke its own group’s membership when that role only allows, since that can only reduce its own access; revoking a role that carries a deny stays SELF_PROMOTION, except for the owner.

Invitations follow their creator

An invitation is a deferred grant by its creator. When it is first accepted, the creator is resolved again in the tenant and must still be eligible, still be allowed management.invitations, and still own the resource or satisfy the ceiling for the invited role, including the group-deny rule. Otherwise acceptance returns INVITATION_UNAVAILABLE, the same outcome as a revoked invitation. The creator’s eligibility and relevant authorization facts are fenced in the acceptance’s storage transaction alongside the acceptor’s. An exact retry of an acceptance that already committed still replays as ALREADY_APPLIED.

Denials and resource existence

authorize() and execute() answer a caller with no relationship to a resource exactly as they answer for a resource that does not exist, so tenant members cannot probe resource IDs through them (response timing aside). A caller who is not the owner, has no membership on the resource (directly or through a group), and holds none of its type’s configured action or management permissions gets NOT_FOUND_OR_DENIED, whatever the command or Rolebook decision, including a fault in its own assignments such as UNKNOWN_ROLE. Accepting an invitation for a missing resource answers INVITATION_UNAVAILABLE, as a wrong token does.

A caller who has a relationship, such as a viewer asking to edit or a member whose role carries a deny, already knows the resource exists and gets FORBIDDEN, with the Rolebook decision on authorize().

The inspecting reads (describeAccess(), permissions(), auditHistory()) answer every refusal, including a missing or malformed resource, as NOT_FOUND_OR_DENIED.

Assignment projection and the budget

Sharing passes every assignment the identity adapter returns to Rolebook unchanged, then projects only the resource owner or the memberships belonging to the requesting principal and its groups. Unrelated members never consume the binding’s budget. An unknown or corrupt role for the requesting principal still fails closed.

A Rolebook binding accepts at most 256 assignments. Under the single-owner and single-membership storage invariants, a direct share adds one: 255 identity-adapter assignments plus the projected one succeeds, while 256 plus one fails closed with Rolebook’s INVALID_ASSIGNMENT (reported by sharing as FORBIDDEN on resources the principal owns or is a member of, and as NOT_FOUND_OR_DENIED elsewhere). Applications that map workspace roles into assignments must stay within this combined budget.

Governed approvals count a party the same way: the owner row, the party’s memberships on the resource (and on its ancestors when the type inherits), and every identity assignment the governance identity source holds for the party, wherever it applies. A party over 256 is not counted as an approver, and its approval or rejection is answered UNKNOWN_REQUEST, like any party without standing. A rejection it recorded earlier stops holding the request, as if the party had lost its role, and an owner over 256 cannot consent to an ownership transfer.

Two cases are stricter than the direct check. On a resource whose type passes access down, the delegation proof keeps one entry in reserve, so governance stops at 255. Under evidenceSources.groups: "none", every identity assignment held by a group in the tenant counts as possibly the party’s, because governance cannot see who belongs to the group. When they could carry a party over 256, a party that would otherwise count is answered UNKNOWN_REQUEST and nothing is recorded. A rejection, sponsor approval or owner consent that party already recorded keeps the request from applying until the count can be confirmed again. Once groups hold 256 identity assignments in a tenant, governance can confirm no party there, the owner included. Bind a group graph before that.

Sharing does not filter identity-adapter assignments by resource, ancestry, appliesTo, or subject: Rolebook validates the whole collection before selecting the applicable ones, and filtering would weaken that fail-closed validation.