ADL 0.6.0 reference · Review draft 1 · November 14, 2026.
Contents · Source map · Evidence
The 0.6 edition note
Permissions decide whether a caller may attempt an operation. Policies then impose additional conditions on covered operations. A policy permit does not supply a role grant that ordinary permissions denied. In this edition, §21.12 is the owning retained section for resource policies and recorded permits.
The policy example declares a named require policy on create and requires a configured boolean training claim. The parser accepts it at 0.6.0 and rejects it at 0.5.2 with ADL_POLICY_VERSION. It also rejects a misspelled policy key. These are syntax/admission checks; policy enforcement requires the supervising extension and its configuration.
A policy names ops, an effect, and the expressions appropriate to that effect. Deny overrides applies among applicable decisions. A referenced missing claim causes refusal, including when that claim appears in applicability logic. The current implementation accepts get, list, export, create, update, delete, and transition in ops; accepting the declaration does not establish coverage on other surfaces.
Operation permissions and field permissions have different empty-list behavior in the inspected profile. An operation’s empty role list denies that operation; an empty field read/write list means no additional field restriction. The calibration example uses explicit field writer roles to protect lifecycle and provenance fields. Do not use write: [] as an assumed field lock.
List filtering occurs after page retrieval; it does not establish policy-correct totals or full pages. Missing supervision refuses covered operations with 503. record: true requests recording of a successful covered operation after it completes; list/export are not recorded per row through that mechanism. See the coverage table before generalizing from a successful GET or transition.
Retained reference detail
The numbered sections below are carried from 21-permissions-and-rbac.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.
21.1 Scope and enforcement layers
Permissions determine who may perform an operation and which fields that caller may read or write. Role-based access control (RBAC) compares the caller’s roles with an operation’s role list. An AEL expression can combine role, ownership, and record conditions.
The inherited contract has three layers: an operation grant, field restrictions, and transition restrictions. A field grant does not authorize a denied operation. A transition with no grant of its own inherits the resource’s update permission (§21.6).
This chapter develops the
converted ADL 21 (v0.5.0, retired),
with the Draft 05 delta
and signed rulings.
Statements labeled observed describe source revision 13ed164e and a fresh
Release build of that checkout. They are evidence, not amendments to the
language. The verification record
identifies the source files, hashes, build, inputs, and results.
ADL 3 owns execution identity; KD 8 (v0.5.0, retired) owns authentication and token handling. ADL 18 owns expression syntax and function scopes. ADL 22 owns state machines, ADL 26 generated CRUD, and ADL 31 the general error envelope.
A request’s route through middleware and the checks inside its generated handler
are separate. The inherited claim that every internal call bypasses permissions
is too broad: the checked http, internal, and seeder requests all reject
a nonowner update. These are kernel requests with synthetic identities, not an
HTTP server or JWT integration test (§21.8).
21.2 Operation permissions
Place permissions beside object in a resource. This fragment comes from
notes.yaml:
permissions:
ownerField: createdById
list: [owner, admin]
get: [owner, admin]
create: [authenticated]
update: [owner, editor, admin]
delete: [admin]
| Declaration | Meaning |
|---|---|
list | Collection read; count uses the same permission in the checked runtime |
get | Read one identified record |
create | Create a record, before an owned record exists |
update | Change an existing record |
delete | Delete an existing record |
read | Compatibility alias supplying both list and get when their explicit keys are absent |
| Missing operation or entire block | Closed default [admin] |
Explicit operation [] | Nobody, including admin |
The parser tracks whether an operation was declared. Thus read: ['*'] alongside
list: [] leaves list denied and makes get public; the alias does not overwrite
the explicit denial. Runtime action generation also seeds undeclared operations
so a model constructed outside the parser receives the same defaults.
See the permission model and
parser.
21.2.1 Roles and expressions
Use a YAML sequence for roles and a quoted string for an AEL expression:
update: [owner, editor]
update: "isOwner() && hasRole('editor')"
These alternative fragments differ: the sequence allows either an owner or an editor; the expression requires both. Within one role list, matching any entry suffices. Role names are exact strings; naming a role does not define it, assign it to anyone, or create a role hierarchy.
| Role token | Match |
|---|---|
'*' | Public, including an anonymous caller; quote the YAML asterisk |
authenticated | A caller with an established subject identity |
owner | Subject ID equals the resolved ownership value for this record |
admin | Caller has the admin role; it is also the default role for omitted operations |
| Other string in a role array | Caller holds that exact custom role |
Admin is not a universal override. [editor] does not implicitly grant admin;
[] explicitly denies it. The checker considers both the primary role and
entries in roles. An actor with primary role user and roles: [admin] passes
an explicit admin grant in the checked matrix.
Observed admission limits. Scalar update: editor is compiled as a bare AEL
identifier and denies the checked editor. Use [editor]. Scalar built-ins such
as admin are accepted as role shorthand. Scalar '?' becomes '*', while
['?'] is rejected with a message directing the author to use '*'. These two
shapes disagree; use the explicit public role array ['*'].
A mixed sequence such as [editor, 7] silently drops the nonstring element.
A numeric operation value is rejected. Successful expression parsing alone does
not establish that the expression can execute: the checked unknown function
is admitted. Malformed-shape and expression cases are retained in the evidence.
21.2.2 The checked actor matrix
The complete notes example contains Alice’s row 1 and Bob’s row 2. Each matrix
cell runs with a fresh store, so a successful delete cannot affect another cell.
The update changes only title; create supplies a title and a forged owner value.
| Actor | List | Get row 1 | Create | Update row 1 | Delete row 1 |
|---|---|---|---|---|---|
| Anonymous | 401 | 401 | 401 | 401 | 401 |
| Alice, role user | 200, row 1 | 200 | 201 | 200 | 403 |
| Bob, role user | 200, row 2 | 403 | 201 | 403 | 403 |
| Eve, role editor | 200, empty | 403 | 201 | 200 | 403 |
| Sam, role user plus admin in roles | 200, both rows | 200 | 201 | 200 | 204 |
The matrix demonstrates that read and update are independent permissions: Eve
can change the title but cannot GET the record under this particular policy.
An authenticated caller denied by ordinary CRUD receives 403 FORBIDDEN;
a missing identity receives 401 AUTH_REQUIRED. Successful authorization does
not waive validation, state, privacy, storage, or domain-authority checks.
21.3 Field permissions
A field restriction narrows an already permitted operation. This fragment is also included in notes.yaml:
fields:
secret:
read: [admin]
write: [admin]
salary:
read: [admin]
write: [admin]
mask: true
Here fields is inside permissions, not inside object.
| Field key | Form and default |
|---|---|
read | Role sequence; absent or empty means no additional read restriction |
write | Role sequence; absent or empty means no additional write restriction |
mask | Boolean, default false; substitutes "***" for an unreadable field instead of omitting it |
aggregate | ADL 0.5.2. {roles, dimensions, minGroupSize}: roles that may total the field in a declared query without reading it (ADL 38 §38.8.1) |
An empty field role list therefore differs from an empty operation role list.
fields.secret.read: [] does not deny that field. The current field parser
also accepts a scalar literal role; it does not compile field rules as AEL.
21.3.1 Reads and response coverage
On the checked GET, Alice sees no secret key and sees salary: '***'; Sam sees
both original values. Masking does not change the stored integer salary. The
response value is a string, so consumers must not assume a masked field retains
its declared scalar type. Field restrictions also apply to ordinary list and
update responses in the reviewed handlers.
Create and transition responses. Since ADL plugin 0.102.85 (#1528), the
generated create and transition responses apply the same permission filter as
GET. A create whose secret receives the default default-private no longer
returns that secret to Alice, and the editor’s successful publish response omits
secret and masks the salary. A caller who may read a field still gets it.
Before that release both responses returned every field, which a subsequent GET
would have omitted. Field restrictions on the transition’s write body are
unchanged (§21.6). Bus events carry the full row; this filter applies to the
response only.
The separate field security declarations, such as writeOnly, internal, and
hidden, are handled by FieldSecurity.
They are not aliases for field role lists. This chapter’s probes isolate the
permission filter; they do not establish complete coverage for every security
flag or generated route.
21.3.2 Writes
Observed: supplying any forbidden field to ordinary create or update returns
403 FORBIDDEN with a message naming the field, and the checked row remains
unchanged. This includes optional fields and a required secret. The inherited
account of silently ignoring optional forbidden writes and returning
FIELD_FORBIDDEN only for required fields does not describe these handlers.
A permitted operation does not imply permission to submit every field. Omit a restricted field when the operation can proceed without it; do not treat it as an instruction to preserve the submitted value invisibly.
Owner-field restriction gap: the current field checker compares roles with
an empty record. Consequently read: [owner] omits the secret even on the owner’s
allowed GET, and write: [owner] rejects a submitted secret. A successful
operation-level owner test does not supply ownership to the field test.
This is an implementation limitation, not a new meaning for the owner token.
See PermissionChecker.
21.4 Ownership and owner-field chains
Ownership compares a stable subject ID with a record value. It does not compare
the mutable username. The username alice with subject ID bob does not own a
record whose owner value is alice.
21.4.1 Selecting the ownership value
Ruling R10 (kalos#475).
owneris whateverpermissions.ownerFielddeclares. The name conventions below are a fallback, consulted only when no field is declared — never a supplement to one. This section is the single statement of the rule; ADL 22 cites it rather than restating it.
An explicit permissions.ownerField takes precedence. Without it, the generated
actions try these existing fields in order:
createdById.userId.authorId.created_by, the legacy spelling.- The foreign-key column of the first
belongsTorelationship targetingUser.
Conventions 1–4 skip a field that is the foreign key of a belongsTo to a
resource other than User (#1485). Such a field holds the other resource’s id,
not a user’s. For example, authorId with author: {type: belongsTo, target: Author, foreignKey: authorId} is the shape of Rails’s belongs_to :author.
Taking it as the owner would make create (§21.4.2) overwrite the author the
client chose with the caller’s subject id. With the field skipped, resolution
continues down the list, and adl validate warns OWNER_CONVENTION_SKIPPED_FK
for the skipped field. A belongsTo to User (or <domain>.User) and a plain
field with no relationship are unaffected. AEL’s isOwner() sees only the
record, not its relationships, so a resource that relies on ownership should
declare ownerField explicitly.
ownerId alone is not a convention: declare ownerField: ownerId when that is
the intended column. If no owner field can be resolved, owner never matches —
ownership that cannot be established is not ownership, so the guard fails
closed rather than falling open.
The order is a precedence, not a search for any match. A record carrying both
createdById and authorId is owned by whoever createdById names; authorId
is never consulted. This matters because the two can disagree.
The same resolution governs AEL’s isOwner(), the state-machine owner guard,
and the generated list scope. Until R10 they disagreed: isOwner() checked the
literal created_by and nothing else, while generated DDL emits camelCase, so
isOwner() denied the actual owner of any ordinary generated record — silently,
because a failed ownership check is indistinguishable from a genuine non-owner.
That was the same defect already fixed in the list path (#396) and the
permission checker (#397), surviving in the third copy.
Resolution is centralized in
action generation, using
the convention helper.
The inherited contract requires an explicitly named ownership field to exist.
The checked parser nevertheless accepts ownerField: missing and a multi-hop
string. Admission is not proof of a usable ownership path.
21.4.2 Creation and later changes
owner cannot authorize create because no existing owned row is available.
Use an appropriate create grant, then establish ownership on the created row.
For an authenticated ordinary create, the checked handler overwrites a submitted
direct owner column with the caller’s subject ID. Alice’s request containing
createdById: forged stores alice. This injection is skipped for internal
and seeder transports; both preserve forged in the same experiment. Those
labels are trusted execution context supplied by the host, not ordinary payload
fields a client should control.
Creation-time injection does not by itself make the column immutable. If ownership must never transfer through an ordinary update, specify and verify the appropriate write/immutability policy. ADL 10 owns immutable fields; this chapter does not define a new ownership-transfer operation.
21.4.3 Lists and caching
For a direct role-list rule such as [owner, admin], an admin match authorizes an
unscoped list. Otherwise an authenticated owner-list caller receives a query
bound to that caller’s subject ID. Alice and Bob each see their own row; Eve sees
an empty collection. Count follows the same filtering in the checked runtime.
This translation is limited. distinct rejects the owner-only path with 403,
although it succeeds for admin. list: "isOwner()" also returns 403; it does not
become a row-by-row predicate. Trait conjunctions must not be assumed to acquire
SQL owner filtering simply because a conjunct contains owner.
The focused permission suite checks that a cached owner GET does not expose the record to a later nonowner, for both role and AEL permissions. That establishes those cache regressions, not a proof covering all scopes, masks, and cache keys. See list handling, get handling, and the regression tests.
21.4.4 One-hop local ownership
The inherited form relationship.field follows one belongsTo relationship to
a field on its target. It does not define arbitrary dotted traversal. The complete
indirect-owner.yaml uses:
relationships:
account:
type: belongsTo
target: Account
foreignKey: accountId
permissions:
ownerField: account.ownerId
read: [owner, admin]
update: [owner, admin]
delete: [owner, admin]
With Account 1 owned by Alice and Note 1 referencing it, the fresh build returns:
| Alice’s operation | Observed result |
|---|---|
| Get | 200; ownership is fetched from the related account |
| Update | 403 in this fixture, which has no conditional permission block |
| Delete | 204 |
| List | 403; the indirect owner filter is unavailable |
The update hydration call is inside its conditional-permission branch; GET and
delete hydrate unconditionally before the record check. The list refusal is
403, not the inherited promise of a successful empty list. These paths fail
closed but do not have equivalent capabilities. GET also exposes the synthetic
account.ownerId key in its returned record.
The hydration helper queries the local target table using the resolved foreign key and target primary key. It does not call the account’s ordinary GET permission. This identity lookup is not authorization to return the account’s full data or to fetch another site.
21.4.5 An unresolved reference is forbidden
Signed R4
requires parse-time rejection with OWNER_CHAIN_CROSSES_REFERENCE when an
owner-field chain crosses an unresolved reference. A type: reference field
pointing into another suite does not become a locally traversable belongsTo.
The complete
reference-owner-forbidden.yaml
contains this fragment:
object:
account:
type: reference
references: adl.identity.accounts.Account
permissions:
ownerField: account.ownerId
read: [owner]
Required result: rejection under R4. Observed: the native parser accepts it, and submission into the empty example registry returns 201. This is an unimplemented rejection in the checked build, not a usable alternative ownership mechanism. ADL 12 owns reference binding, locality, and the broader relationship rules.
21.5 State-conditional permissions
The inherited mapping selects roles by operation and the record’s current state:
conditional:
update:
draft: [editor, admin]
published: [admin]
This is a fragment inside permissions. The resource must also have a state machine identifying its state field. The inherited rule says a matching state entry replaces the base role list, and an unlisted state falls back to that list.
Observed update behavior is narrower: the handler checks the selected
conditional roles and then checks the original update rule. Both must pass.
In states.yaml, base update is
[owner, admin] while draft permits [editor, admin]. Alice fails the conditional
check, Eve fails the base check, and Sam passes both. Neither refusal changes the
record’s title or state. A conditional grant therefore does not currently let
an otherwise denied editor update the draft.
The parser stores conditional arrays. A conditional expression string is admitted as an empty role vector rather than compiled as AEL; it can therefore deny the matched update. Avoid assuming operation expression support also exists at this nested location.
The reviewed delete handler does not consult this map: deleting a draft as admin
succeeds with 204 even when conditional.delete.draft: [] is declared. A helper’s
ability to select roles for an operation is not evidence that every action calls
it. See update and
delete.
21.6 Transition permissions
Place named transition grants under permissions.transitions:
transitions:
publish: [editor]
An unlisted transition inherits update, and an explicit transition permission takes precedence over it. The generated transition endpoint enforces this in order (#1213):
- With no grant for the transition under
permissions.transitions(or a custom-action entry of the same name), it checks the resource’s update permission before loading the row, then again against the loaded row, the same sequence delete uses. A caller who cannot update the record gets403 FORBIDDEN. - With a grant, it checks that grant instead of update.
- It then checks write-body restrictions and attempts the transition and its guards. Other host checks can also intervene.
In the checked states example:
- Alice is denied publish with
403 FORBIDDENbefore state validity is tested. - Eve publishes with 200 despite failing the resource’s base update rule.
- Eve’s second publish returns
422 INVALID_TRANSITIONbecause the row is now published; the permission grant does not make a nonexistent transition valid. - Bob is refused the unlisted
submittransition with403 FORBIDDEN, because he cannot update Alice’s row andsubmithas no grant of its own. - Eve cannot submit
secretin a publish body: the action returns 403 and leaves both secret and state unchanged. Its successful response omitssecretand masks the salary (§21.3.1).
The anonymous publish refusal is 403 in this handler, rather than CRUD’s
401 AUTH_REQUIRED. Code depends on the consuming operation; clients should
not infer identity semantics solely from one status code.
The current parser retains transition arrays, but ignores a transition expression string. An unknown nonreserved operation key with a nonempty role array is stored as a custom-action permission; that does not create an action endpoint. When a transition name also has such an entry, the generated transition handler checks both maps. Neither the parser accepting a mapping nor a generic permissions table establishes coverage for every custom operation.
Explicitly review every transition’s guard, accepted body, and returned fields. These are observations of transition action generation; inline precedence and every PUT/state-update route are not newly certified here.
21.7 Permission expressions
The complete expressions.yaml shows
role and owner conditions. An operation expression sees:
| Binding | Value supplied by PermissionChecker |
|---|---|
op | Current operation name |
user.id | Subject ID |
user.username | Username |
user.role, user.roles | Primary role and role array |
user.claims | Claims the host put on the request. From an authd token: email, status, username, amr (how the user signed in, such as ["pwd"]) and mfa (whether more than one factor was used) |
record | Existing row for record checks; empty for ordinary create/list |
A claim the request does not carry. By default it is null, so
user.claims.clearance != 'none' is true for a caller with no clearance claim
at all. With the host setting adl.claims.unknown: deny, an expression that
names user.claims.<name> for a claim the request lacks is not evaluated and
the operation is denied. The same setting governs guards (ADL 22 §22.3.2) and
rules (ADL 23 §23.3.1). An anonymous request carries no claims. Check:
tools/repro/adl/75_unknown_claim_denies.py (#1560).
These are permission-context names; validation’s $this, $old, and $op
contract is separate. Row values arrive from the database as strings in this
context, so comparisons must follow AEL’s actual coercion rules.
Use hasRole('editor'), hasAnyRole('editor', 'admin'), and isOwner() for the
corresponding conditions. The checker passes the resolved owner field to
isOwner(). The current inState() helper recognizes record.status,
record.state, or transition from metadata; it does not discover any arbitrarily
named state-machine field in an ordinary permission context. For such a field,
write an explicit comparison, for example record.phase == 'draft'.
See the AEL helpers.
The record precheck matters. GET, update, and delete tentatively admit an
authenticated expression caller before the row exists in context, then check
the expression on the fetched row. An anonymous request governed by the literal
expression "true" is still rejected with 401 on those three paths. The same
expression permits the checked list and create. An expression is therefore not
an interchangeable spelling for a public role on every current action. To let
anonymous callers read only some rows, such as published posts, grant the
operation to '*' and declare a readCondition (§21.7.2).
Errors or false results at the authoritative permission test deny the operation. The native parser’s admission of an unknown function is not a working grant. ADL 18 owns the complete function inventory, query services, and scope limits; this chapter does not grant record-query capabilities merely because an expression compiles.
21.7.1 Traits and protected rules
Multiple trait permissions on one operation are combined with AND, preserving
the individual rules and their origins. In
trait-permissions.yaml, the
Staff trait requires editor and the Owned trait requires owner. An editor who
owns the row passes; a different editor fails. This conjunction differs from a
single role array [editor, owner], which is OR.
ADL 13 owns merge precedence, conflicts, and provenance.
ADL 14 owns protected derivation contracts. The operation form
{rule: [editor], protected: true} is admitted and records the protection flag;
protection controls overrides during derivation, not a separate runtime role.
Do not author resolved $all or $origin output as a substitute for these rules.
21.7.2 Row read conditions
An operation permission decides who may call get or list. A role grant
cannot see the row, and an operation expression on get refuses anonymous
callers before the row is loaded (§21.7). readCondition decides which rows
a caller may read (#1527):
permissions:
ownerField: authorId
list: ['*']
get: ['*']
readCondition: "record.status == 'publish' || isOwner() || hasAnyRole('editor', 'administrator')"
The runtime compiles the condition to SQL and ANDs it into the WHERE clause of
get, list, count and distinct. It applies under every ?scope=,
?scope=all included: a scope chooses which rows a caller asks for, and
readCondition bounds what they may see. Anonymous callers are evaluated like
any other caller, with an empty user.id and no roles. A row the condition
excludes is not there, so get answers 404 NOT_FOUND rather than 403,
and the id is not confirmed to exist. The condition filters rows; it does not
authorize the call. The operation permission is checked first, as before.
Only a subset of AEL compiles to SQL. Anything outside it is refused when the domain is submitted, never evaluated loosely at request time:
| Form | Meaning |
|---|---|
record.<field> == <value>, also !=, <, <=, >, >= | <value> is a string, number or boolean literal, user.id or user.username; either side may be the field |
record.<field> == null, record.<field> != null | IS NULL, IS NOT NULL |
record.<field> in ['a', 'b'] | A list of non-null literals |
hasRole('r'), hasAnyRole('a', 'b'), isAuthenticated() | Evaluated for the caller, then fixed |
isOwner() | The resolved owner column (§21.4) equals the caller; false with no owner column, an indirect one, or an anonymous caller |
&&, ` |
<field> must be a declared field or id, createdAt, updatedAt,
deletedAt, createdById or updatedById. Comparisons are two-valued: a NULL
column is unequal to every value, so !(record.status == 'draft') keeps rows
whose status is NULL, as AEL does. When a resource and its traits each declare a
readCondition, all of them must hold.
Two consequences follow. The read caches skip a resource with a condition, so one
caller’s rows are never served to another. The websocket allow-check for a
deleted row (.read_allowed, #1192) denies it, since the condition is SQL over
live rows, so those deletions are not pushed to subscribers. ADL 38 views, report
metrics and dashboard widgets also bind the source read condition in SQL before
selecting, grouping or aggregating records (#1672), including sharedVia
predicates. Analytics computed columns and filters use the same caller-bound
target-query handler. This does not establish coverage for every other read path.
21.7.3 Relational record sharing (#1545)
permissions.sharing defines named SQL predicates over application resources.
Use sharedVia('name') inside readCondition, updateCondition, or
deleteCondition. These conditions restrict the operation’s existing role
permission; a sharing row does not bypass operation, field, transition,
validation, or consent checks. Declare a role grant broad enough to admit the
potential collaborators, then restrict their rows with the condition.
permissions:
ownerField: ownerId
read: [authenticated]
create: [admin]
update: [authenticated]
delete: [admin]
sharing:
collaborators:
resource: DealCollaborator
recordField: id
matchField: opportunityId
where: "record.collaboratorUserId == user.id"
reports:
resource: ReportingLine
recordField: ownerId
matchField: reportUserId
parentField: managerId
where: "record.managerId == user.id"
readCondition: "hasRole('admin') || isOwner() || sharedVia('collaborators') || (hasRole('manager') && sharedVia('reports'))"
updateCondition: "hasRole('admin') || isOwner() || sharedVia('collaborators')"
A rule correlates its target’s matchField with the protected resource’s
recordField. Its where uses the §21.7.2 SQL subset, with record referring
to the target row. It cannot call sharedVia recursively. resource names
a local resource or an active same-suite domain.Resource; the engine resolves
physical tables from ADL metadata. The join fields must have matching types.
Ordinary single-table resources are supported; inheritance, views, composite
keys and dynamic sheets are refused. Soft-deleted grant rows never grant access.
sharedVia requires an authenticated caller. All identity and literal values
are bound parameters.
Adding parentField makes the rule recursive: start with target rows matching
where, then follow rows whose parentField equals a previous matchField.
This expresses a manager’s direct and indirect reports. SQL UNION deduplicates
the chain and terminates cycles. An owner outside that chain is excluded.
Read conditions filter get, list, count, and distinct before pagination
or aggregation. Denied individual reads return 404. On resources declaring
sharing, an omitted update/delete condition inherits readCondition. Explicit
write conditions can instead narrow or broaden that row restriction while the
operation grant still applies. The delete condition also governs restore;
update conditions govern PATCH, PUT, revert, and declared state transitions. Creation
continues to use its operation and field permissions. Upserts are refused.
Writes first check access before running user code, then recheck it in the normal mutation transaction/savepoint after before-hooks. They recheck the stored result before commit. Before-hooks retain their existing execution boundary; acquiring a new database lock before entering Lua would invert the runtime’s lock order. Moving a row outside the caller’s permitted set is refused and rolled back; held events are discarded. Denied initial row checks return 404. Membership is read afresh on every request; conditioned reads do not use response caches. Restrict writes to grant and reporting resources to trusted administrators: allowing arbitrary users to create their own grants would defeat the policy.
Included sharing-protected rows are checked against the same live predicate. Relationship lists delegate to the parent’s get and target’s list; link/unlink also require the parent’s update condition. Linking to a sharing-protected target is refused until the target’s access can be enforced on that mutation. Per-record audit/version history requires current read access; revert requires update access before and after restoration. Collection-wide audit with a read condition, export/import and custom commands currently fail closed. Domain analytics apply the source read condition, including sharing, instead of refusing the whole domain (#1672). Dashboard requests recompute caller-bound results so revoked memberships cannot survive in a cached payload. Deleted-row websocket notifications retain the §21.7.2 restriction. Author-controlled Lua, raw SQL, and internal aggregation are privileged application logic; these conditions govern generated CRUD, not a database-wide row security policy. Each resource needs its own declaration; a policy on an Issue does not automatically protect the flat Comment endpoint.
This is an additive runtime enhancement for the three parity blockers. It does not declare the proposed 0.5.5 teams/business-units/sharing edition complete.
21.8 Identity, roles, and internal execution
The runtime Request treats a nonempty subject ID as authenticated. In a real deployment, the host must establish that identity through a trusted authentication or internal-execution path. The example adapter populates it directly to isolate authorization behavior.
The inspected auth middleware
verifies a presented access token unless the action is on its public list or the
transport is internal. A missing token passes onward to later authentication
checks; a bad token produces TOKEN_INVALID. The
RBAC middleware
loads assigned roles and enforces endpoint security declarations as the shipped
baseline. Its optional rbac.action_permissions map adds a
deployment-specific requirement for an exact action name. When both sources
name permissions, both checks must pass; the map cannot override or relax the
declaration. An action omitted from the map remains subject to its declaration.
Thus ADL’s public '*' grant alone does not prove that the surrounding host never
attempts authentication for that endpoint.
authd’s role seeding creates admin,
moderator, editor, and user. These names do not imply an ADL hierarchy.
Custom role assignment, token lifecycle, cache invalidation, and operator account
management remain KD 8 concerns.
An internal transport label does not itself grant admin or owner. The tested nonowner update returns 403 for http, internal, and seeder alike. What differs in the checked create path is canonical owner injection (§21.4.2). Lua, workflows, schedules, imports, bulk operations, relationship actions, and management calls must each be reviewed for the identity they supply and the handler they reach; this chapter makes no blanket bypass claim for them.
21.9 Domain authority is an additional boundary
Caller RBAC and a domain’s authority over another domain’s tables answer different
questions. Draft 05 §10.3 requires the target to opt in to cross-domain cascading
through allowCascadeFrom; the default is RESTRICT. Section 10.4 requires an
owning resource’s allowWriteFrom grant before an importing domain can write it;
the default is read-only. Bedrock soft-delete rules also remain independent.
An admin role is not a substitute for those grants. Conversely, a domain-level grant is not a caller-level permission. ADL 12 and ADL 14 own the complete declaration and implementation limits, including foreign mapping. The fresh Phase-12 tests exercise reference and authority infrastructure; they do not turn this chapter’s local SQLite matrix into an end-to-end proof for every cross-domain grant.
21.10 Exported and restored policies
A generated schema is a projection of a policy, not necessarily a lossless backup. The checked exporter retains ordinary role lists, expression text, field rules/masks, and conditional arrays, but omits ownerField, transition maps, protection flags, empty-operation denials, and trait conjunctions from the relevant exported operation data.
The registry normally has stored source from which it can reconstruct the full model. The examples compare that normal restoration with a deliberately forced fallback: they clear raw and authored source in a disposable registry, then reload.
| Model | Source-backed restoration | Forced source-free fallback |
|---|---|---|
| Direct-owner notes | Owner field and field rules retained | Explicit ownerField disappears |
| All operations explicitly empty | Denials retained | Defaults become [admin] |
| AEL operations | Expressions and ownerField retained | Expression text survives; ownerField disappears |
| Protected update | Protection retained | Protection flag disappears |
| Trait conjunction | Conjuncts and origins retained | Reload refused because required provenance members are missing |
| State example | Conditional and transition maps retained | Reload fails with a JSON type error |
The direct owner convention can hide a missing exported ownerField in one example; it cannot preserve the meaning of every explicit or indirect ownership choice. The all-empty policy’s fallback is especially significant: it widens the model to admin defaults. Preserve the authoritative authored/resolved model data when moving or restoring a registry. These fallback experiments do not describe the normal boot of an intact registry, and no existing database was modified.
21.11 Examples, diagnostics, and verification limits
The example directory contains nine complete YAML inputs, a native adapter, a reproducible runner, explicit assertions, and a source-path register. Positive examples and negative/boundary fixtures are labeled separately. They are illustrative tests, not newly ratified conformance vectors.
| Condition | Required or observed result |
|---|---|
| Ordinary CRUD grant fails without identity | Observed 401 AUTH_REQUIRED |
| Authenticated operation or field-write refusal | Observed 403 FORBIDDEN |
| Publish permission fails | Observed 403 FORBIDDEN, including anonymous |
| Permitted transition unavailable from current state | Observed 422 INVALID_TRANSITION |
| Numeric operation declaration | Parser rejection; permission shape message |
Public wildcard as ['?'] | Parser rejection; use '*' message |
| Owner chain across unresolved reference | Required OWNER_CHAIN_CROSSES_REFERENCE; observed admission gap |
The evidence separates model inspection, direct PermissionChecker calls, generated actions, stored-row controls, independent modeller projections, and existing tests. The native source and executable are from the same checkout; no old binary, archived header set, or copied source snapshot is used.
Execution covers a disposable SQLite store and synthetic kernel identities. It does not cover real token issuance, a network server, PostgreSQL behavior, all generated action families, concurrent authorization changes, or complete release conformance. Consult the dated evidence before carrying an observed limitation into a later build.
21.12 Policies (ADL 0.6.0)
A policy is a condition on an operation of one resource, on top of
permissions:. Permissions stay the role layer and are checked first. A policy
can only refuse what permissions allowed; it never grants. A document that
declares policies: must declare adl: "0.6.0" (#1561).
resources:
Document:
permissions: { get: [authenticated], list: [authenticated] }
policies:
denyForeignPersonItar:
ops: [get, list, export]
when: "record.classification == 'itar'"
effect: deny
unless: "user.claims.us_person == true"
error: COMPLIANCE_ACCESS_DENIED
cuiNeedsCurrentTraining:
ops: [get, list, export]
when: "record.classification == 'cui'"
effect: require
obligations:
- "count(TrainingRecord, username == $user.username && expiresAt > now()) > 0"
error: COMPLIANCE_OBLIGATION_UNSATISFIED
| Key | Meaning |
|---|---|
ops | Required. One or more of get, list, export, create, update, delete, transition |
when | The policy applies when this is true. Absent: it always applies |
effect | Required. deny or require |
unless | With deny: the operation is refused unless this is true. Absent: refused whenever the policy applies |
obligations | With require: a list; the operation is refused unless every one is true |
error | The error name of the refusal, UPPER_SNAKE_CASE. Default POLICY_DENIED |
message, description | Text for the refusal, and for the reader of the document |
record | true, or an expression. The supervisor keeps a row each time this policy applied and let the operation through (§21.12.5) |
21.12.1 How a policy is decided
- Permissions are checked as before. A caller they refuse never reaches a policy.
- Every policy of the resource that lists the operation is evaluated. One
denial refuses the operation (deny overrides), and the first denial in
document order names the error. The refusal is
403with that error. - A claim the request does not carry is unknown, and unknown denies. This
holds in
when,unlessand every obligation, whateveradl.claims.unknownsays (§21.7). - An expression that cannot be evaluated denies.
The engine parses and carries policies and evaluates their expressions. The
decision, the mode (observe, warn, enforce, strict) and the decision log belong
to the extension that supervises policies, the compliance plugin
(reference). An operation a policy covers
is refused with 503 POLICY_SUPERVISOR_MISSING when no supervisor is loaded,
so a policy is never silently unenforced.
21.12.2 What an expression sees
| Name | Value |
|---|---|
record, $record | The stored record, before field permissions hide anything. On create, the body as sent: defaults and hooks have not run |
input | The body of a create or an update |
user, $user | The caller: id, username, role, roles, claims |
op | The operation |
transition | The transition’s name when op is transition, otherwise empty |
system | True for a write the domain made itself, elevated to system (a schedule, a workflow, a hook) |
The read functions of Validation scope are available: exists, count,
lookup and the other aggregates. They read under the caller’s own
readCondition. Name a resource of the same domain bare (count(TrainingRecord, ...))
and another domain’s by its quoted address.
21.12.3 Where a policy applies
| Operation | What happens to a refused record |
|---|---|
get | 403 with the policy’s error |
list, export | The row is left out. count is the rows returned; totalCount and hasMore still count rows before policies |
?include= of the resource | The included row is null, or left out of the array, under its get policies |
create, update (PATCH and PUT), delete, transition | 403 with the policy’s error; nothing is written |
| Bulk create, update and delete | Each item goes through the single-record action, so each is checked |
Policies apply to every caller, internal callers and Lua included. The
seeder’s creates are the one exception. A read of a resource with a policy on
get or list is never served from the read cache.
Paths that reach records without the action a policy covers are refused with
403 POLICY_OPERATION_UNAVAILABLE instead of being served unchecked:
| Path | Refused when a policy covers |
|---|---|
distinct, a declared query (ADL 38 §38.8) | list |
| A record’s versions and history | get |
| The history list | list |
restore, revert | update |
import | create |
21.12.4 Limits
- Custom operations, relationship sub-routes (
/{id}/<relationship>), views, reports and dashboards over the resource, and what leaves through an integration or an AI dispatch are not checked against policies. - An AEL read from another resource’s rule or guard (
count(Document, ...)) is the server’s own and is not checked. - A policy on
listis applied to the page after it is read, so a page can be shorter thanlimitandtotalCountreveals that withheld rows exist. - A policy sees the stored record. It cannot be written against a computed or virtual field.
21.12.5 Recording what a policy let through
A denial is always recorded. A policy that lets an operation through leaves
nothing, unless it says record (#1563):
policies:
breakGlassOnly:
ops: [get]
when: "record.restricted == true"
effect: deny
unless: "user.claims.break_glass == true"
record: true
Each read this policy permits then leaves a permit row in the supervisor’s
decision log, naming the caller, the record and the policy. The row is
written after the operation has answered, and only when it answered
successfully. record can be an expression instead of true; a row is
written unless the expression is false, so one that cannot be evaluated is
recorded.
- It covers
get,create,update,deleteandtransition. Alistor anexportis not recorded row by row. - A policy that did not apply (
whenis false) leaves no row. - The operation is not undone when the row cannot be written. The supervisor logs an error.
21.12.6 Diagnostics
| Condition | Result |
|---|---|
policies: in a document that does not declare "0.6.0" | Submit refused, ADL_POLICY_VERSION |
Unknown key, missing or unknown ops, effect not deny or require, obligations on a deny, unless on a require, a require with no obligation, an error that is not UPPER_SNAKE_CASE, a record that is neither true, false nor an expression, an expression that does not parse | Submit refused, ADL_POLICY_INVALID |
| A policy denies | 403 with the policy’s error, default POLICY_DENIED; data.policy names it, data.decisionId the recorded decision |
| No supervisor is loaded | 503 POLICY_SUPERVISOR_MISSING |
| A path a row policy cannot be applied to | 403 POLICY_OPERATION_UNAVAILABLE |
| The supervisor failed while deciding | 500 POLICY_EVALUATION_FAILED |
Checks: plugins/adl/tests/test_adl_action_policy.cpp,
plugins/compliance/tests/test_compliance_extension.cpp, and over HTTP on
SQLite and PostgreSQL tools/repro/aegis/policy_modes.py. A complete example
is 01-classified-documents.yaml.