IF Commons GitHub

Identity authorize

0041Active

0041-identity-authorize · owner if · domain data

Requirements

FR-001checkpassing

decide MUST allow a principal that holds a permission through a role assigned to it directly, to a group it is in (to any depth up to five), or inherited from a role it holds, within the tenant, the resource and the time of the assignment, and MUST refuse a principal that is not known or is not active.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: one decision answers for a person, a group's members and an agent: roles, inheritance and groups permit, a privileged role is never an agent's, entitlements gate, relationships permit, a refusal wins, unknown never allows, and a disabled principal can do nothing; suite/identity-operations.test.ts: what a group passes on reaches a member three groups down and not one six down, and a delegation made in one tenant gives nothing in another though its root holds the role there; suite/identity-operations.test.ts: a permission is for people, machines and groups unless it names the kinds it is for, and a role that names the kinds that may hold it is not held by another kind

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/decide.ts, data/sql/extensions/operations/identity/mod.ts

Tests: passed: suite/identity-operations.test.ts one decision answers for a person, a group's members and an agent: roles, inheritance and ; passed: suite/identity-operations.test.ts what a group passes on reaches a member three groups down and not one six down, and a dele; passed: suite/identity-operations.test.ts a permission is for people, machines and groups unless it names the kinds it is for, and a

FR-002checkpassing

decide MUST NOT let an agent use a role that is privileged, MUST refuse a permission that names a feature the tenant is not entitled to, and MUST allow a permission through a relation tuple that a permission relation joins to it, for that object only, until the tuple expires.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: one decision answers for a person, a group's members and an agent: roles, inheritance and groups permit, a privileged role is never an agent's, entitlements gate, relationships permit, a refusal wins, unknown never allows, and a disabled principal can do nothing

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/decide.ts

Tests: passed: suite/identity-operations.test.ts one decision answers for a person, a group's members and an agent: roles, inheritance and

FR-003checkpassing

decide MUST apply policies so that a refusal wins over any permit, an allow whose condition is unknown allows nothing, a refusal whose condition cannot be told not to apply refuses, and a stored attribute that is older than its definition allows is unknown.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: one decision answers for a person, a group's members and an agent: roles, inheritance and groups permit, a privileged role is never an agent's, entitlements gate, relationships permit, a refusal wins, unknown never allows, and a disabled principal can do nothing

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/decide.ts

Tests: passed: suite/identity-operations.test.ts one decision answers for a person, a group's members and an agent: roles, inheritance and

FR-004checkpassing

The expression language MUST be a closed tree (and, or, not, eq, ne, lt, le, gt, ge, in, contains, startsWith, exists, attributes by key, literals) that evaluates to true, false or unknown, where a missing attribute and a comparison of different types are unknown, and MUST refuse as unknown anything that is not a well-formed expression.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: the policy language is a closed tree that answers true, false or unknown, where unknown never allows, and anything that is not an expression is refused

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/expr.ts

Tests: passed: suite/identity-operations.test.ts the policy language is a closed tree that answers true, false or unknown, where unknown ne

FR-005checkpassing

For a principal acting under a delegation, decide MUST require every delegation of the chain to be active, in force, in the tenant, to the one who holds it, passing on the permission, limited to a resource that includes the one asked about and with a condition that holds, and MUST then require the delegator at the root of the chain to be allowed the action itself, so that a delegation never adds.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: a delegation can only attenuate, a delegate can do only what every delegation of its chain passes on and what the person at the root can do now, and revoking one revokes everything below it; suite/identity-operations.test.ts: what a group passes on reaches a member three groups down and not one six down, and a delegation made in one tenant gives nothing in another though its root holds the role there

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/decide.ts

Tests: passed: suite/identity-operations.test.ts what a group passes on reaches a member three groups down and not one six down, and a dele; passed: suite/identity-operations.test.ts a delegation can only attenuate, a delegate can do only what every delegation of its chain

FR-006checkpassing

The identity audit sink MUST write each event in the transaction of what it records with the hash of the event before it, and verifyAuditChain MUST make each event's hash again from the fields the event holds and report a chain that is forked or broken or an event whose hash is not the one it holds, so that a change to a field of an event, and not only to a link, shows.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: the kill switch switches an agent off at once, and the audit trail is a chain in which a change to an event shows; suite/identity-operations.test.ts: a refused call uses nothing up: an approval is not consumed and no budget is spent when another budget has no room, and an event whose fields were changed shows in the chain though its links are intact

Proved by: data/suite/identity-operations.test.ts

Written in: data/sql/extensions/operations/identity/audit.ts

Tests: passed: suite/identity-operations.test.ts a refused call uses nothing up: an approval is not consumed and no budget is spent when an; passed: suite/identity-operations.test.ts the kill switch switches an agent off at once, and the audit trail is a chain in which a c

FR-007checkpassing

The decision MUST read every column of the access models that says who or when: a permission is for people, machines and groups unless it names the kinds it is for, a role that names the kinds that may hold it is not held by another kind, and a relationship that holds only under a caveat, which the engine does not evaluate, MUST NOT allow.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity-operations.test.ts: a permission is for people, machines and groups unless it names the kinds it is for, and a role that names the kinds that may hold it is not held by another kind

Proved by: data/suite/identity-operations.test.ts

Tests: passed: suite/identity-operations.test.ts a permission is for people, machines and groups unless it names the kinds it is for, and a

Out of scope

  • A generated typed client and a server: the runtime is a function.
  • Operations that are not of delegation and agents (create a human, a session, a key, a device): later specifications.
  • Real concurrency: two connections at the same instant cannot be shown by these in-process engines; each operation's single conditional update is what decides.

Edge cases

  • DuckDB cannot update a row that another row refers to, so these operations run on PostgreSQL and SQLite, per FR-001.
  • A decision about a principal that is disabled is a refusal whatever it holds, per FR-001.
  • A delegation whose delegator loses the right it passed on stops working at once, because the root is asked again at every decision, per FR-001.

Assumptions

  • A role of a group is held by its members, and a group's members may be principals of any kind.
  • The clock is given to each operation, so that a test is the same every time.

Open questions

OQ-1open question

Whether an approval by two people (four eyes) is wanted for a critical action; the model supports one.

OQ-2open question

Whether the decision engine should be given bound parameters instead of literals, since agents supply free text.

Key entities

  • Decision - allow or deny, with why, what must happen first, and what decided.
  • Delegation chain - the delegations from a principal back to the person at the root.

Success criteria

SC-001success criterion

An agent can be given exactly the authority of a person for exactly one task, can be stopped at once, and leaves a trail in which a change shows.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

Data, sql/extensions/operations/identity/audit, sql/extensions/operations/identity/decide, sql/extensions/operations/identity/expr

Titles, headings, exports, tables, columns and requirements. Esc closes.