ABY-2 — HTTP Envelope, Proof, Challenge#
Version 0.2.14-draft · Part of the AllowedBy specification set
1. Purpose#
Defines how a runtime presents a grant (or, when no grant is needed, a passport) on an HTTP request to a service, how it proves possession of its key for that exact request, how the service verifies everything offline, and what the service answers when the proof is missing or insufficient.
Design rule: the runtime provides two headers and parses nothing. The grant is an opaque string received from the node. The proof is a small JWT the runtime signs.
2. Envelope headers#
| Header | Value | When |
|---|---|---|
Allowed-By |
Either one or more grant JWS (ABY-1), comma-separated, leaf first, root last; or one passport JWS (OAID-3) when the request needs no grant (identity-only, node API calls, the first request of a challenge flow). The JWS typ tells them apart. |
Every request |
AllowedBy-Proof |
The proof JWT (§3) | Every request |
AllowedBy-Nonce |
A service-issued nonce (§3.2) | Only on routes where the service requires one |
A request carries exactly one Allowed-By value: a grant chain or a passport, never both. Node issuance endpoints are not services and define their own document rules (OAID-2, OAID-3 §4). Header values are ASCII.
Size budget. Allowed-By and AllowedBy-Proof together MUST NOT exceed 8 KiB, and a chain MUST NOT exceed depth 1 (two JWS: a root and one child, ABY-1 §4). Services MUST accept envelopes within that budget and reject larger ones, or more JWS, with 431 envelope_too_large.
Why depth 1. Each grant carries the human's registration (human.reg), and a root also carries the WebAuthn assertion, so a root grant is about 3.7 KB and a child about 2.7 KB, with a proof of about 0.6 KB. A root and one child (depth 1) come to about 7.0 KB, within the budget; depth 2 would be about 9.7 KB and depth 3 about 12.4 KB, which no envelope within 8 KiB can carry. A slimmer child (one that does not copy human from its parent but refers to it) could make deeper chains fit later, with its own version of this rule.
3. The proof#
JWS compact, typ: aby-proof+jwt, alg EdDSA or ES256 (OAID-1 §3.1), kid = RFC 7638 thumbprint of the signing key. No iss.
{
"v": 1,
"htm": "POST",
"htu": "https://api.example.com/invoices/4711/approve",
"iat": 1761480000,
"jti": "b7c1Qm…",
"dth": "<base64url SHA-256 of the exact Allowed-By header value>",
"bdh": "<base64url SHA-256 of the content as transmitted>",
"run": "01J9X…",
"call": 7
}| Claim | Required | Meaning |
|---|---|---|
htm |
yes | HTTP method, uppercase |
htu |
yes | The request's public URL without query and fragment, normalised per RFC 3986 §6.2.2: lowercase scheme and host, default port removed, percent-encoding normalised |
iat |
yes | Issued at. Valid when within [now − 120 s, now + 60 s] |
jti |
yes | Unique id with at least 96 bits of randomness, base64url (a ULID qualifies). Same definition as for documents (OAID-1 §4.2) |
dth |
when Allowed-By is present |
Document hash: SHA-256 over the full header value, commas included. Omitted on calls without Allowed-By (service, node and operator calls to a node); there bdh binds the body |
bdh |
when a body exists | SHA-256 of the content as transmitted, after content-coding; identical to RFC 9530 Content-Digest: sha-256. MUST be absent when there is no body |
nonce |
when required | The current AllowedBy-Nonce value (§3.2) |
run, call |
no | Run id and call index for audit |
The proof binds the key named in the document to this method, this URL, this document, this body, this moment. It is the DPoP (RFC 9449) shape with the access-token hash replaced by a document hash and a body hash added.
Strict comparison. htu is compared byte for byte; the runtime normalises before signing, and an unnormalised htu (for example HTTPS://API.EXAMPLE.COM:443/…) fails. The verifier normalises only the request path (percent-encoding, dot segments).
htu behind proxies. A service compares htu with its configured public_origin plus the request path, normalised the same way. Forwarded headers (Forwarded, X-Forwarded-*) MUST NOT be trusted unless explicitly configured.
3.1 Optional profile: RFC 9421#
Services that already deploy HTTP Message Signatures MAY accept, instead of AllowedBy-Proof, an RFC 9421 signature in the Web Bot Auth profile:
tag="web-bot-auth",keyid= the thumbprint of the key of §4,algOPTIONAL and, when present, the RFC 9421 registry name matching that key (ed25519orecdsa-p256-sha256),createdchecked likeiat,noncechecked likejti,expiresOPTIONAL and enforced when present;- covered components
"@method" "@target-uri" "allowed-by"and"signature-agent";"content-digest"is REQUIRED when a body exists, and the service recomputesContent-Digest: sha-256from the content as transmitted; @target-uriis built from the service'spublic_origin, the request path and the query; unlikehtu, it includes the query;(keyid, nonce)enters the replay set of §3.3;Signature-Agentis the quoted origin of the issuing node ("https://node.example.org"), and names the issuing node, whose key directory is at/.well-known/http-message-signatures-directory(OAID-2). AllowedBy verifiers still take the key from the document (§4), never from the directory.
A conforming runtime MUST implement the proof JWT; RFC 9421 is OPTIONAL for both sides.
3.2 Optional service nonce#
A service MAY require a nonce, on its irreversible routes or on any route it chooses. It then returns AllowedBy-Nonce: <value> on responses, and rejects a proof without a current nonce claim with 401 invalid_signature carrying a fresh AllowedBy-Nonce. The runtime retries once with that nonce, whatever the route's class. Nonce lifetime is the service's choice and at most 300 s. With the RFC 9421 profile (§3.1), whose nonce parameter is the signature's own replay nonce, the request carries the service nonce in the AllowedBy-Nonce header, and "allowedby-nonce" MUST be a covered component; a header the signature does not cover is no nonce.
3.3 Replay set#
The service rejects any (kid, jti) seen in the last 300 s (the iat window plus skew). For non-safe methods (RFC 9110: anything but GET, HEAD, OPTIONS), a service with more than one instance MUST use a replay set shared by all instances. Safe methods MAY use a per-instance set. Single-use grants MUST be consumed atomically across instances (§5 step 9).
4. Where the key comes from#
- With a grant chain: the leaf grant's
actor.key(ABY-1 §2.1). Sub-agents sign with their own key. The proofkidMUST equal the leaf'sactor.key.kid, and the request MUST arrive before the leaf'sactor.exp. - With a passport: the passport's
key.
A service never looks a key up. If the key in the document does not verify the proof, the request is rejected.
5. Verification algorithm#
There is one verifier (CONF-1). Input: an HTTP request and the service's route map. Output: accept with (agent URI, human id, level, capabilities), or an error, with or without a challenge.
-
Pick the document.
Allowed-Byabsent:401 passport_required, with a challenge when the route (step 5) needs a grant (§6).typof the first JWS isoaid-passport+jwt(exactly one JWS) oraby-grant+jwt(a chain); anything else or a mix:400 invalid_request. Over budget (§2):431 envelope_too_large. -
Parse the proof. Absent, malformed, or
typ,algorkidnot as in §3:401 invalid_signature. -
Verify the document. For a grant chain, every grant in the chain, none skipped:
- JWS against the node's
countersignkey delegated by a node key pinned in the trust list (OAID-5 §3);typ;issequals that node;exp;nbf(REQUIRED); - status bit (Token Status List, OAID-3 §7) of every grant and of the root's
human.reg, with the class from step 5: forread/writethe list is refreshed at least every 300 s and a stale list is used for at most 3600 s, then503 status_stale; forwrite-hard/irreversiblethe list MUST be at most 60 s old, else503 status_stale; audiencelists explicit origins and contains this service's origin;"*"is rejected; when it lists more than one origin,displayMUST equal the rendering ofcapabilitieswith this service's own templates (AMH-1 §4), elsegrant_insufficient;- root (
depth = 0):human.regis a validoaid-human+jwtfrom a trusted home node (OAID-7 §4), andhuman_sigpasses every WebAuthn check of ABY-1 §3.3 (type,challenge,origin=https://<human.reg.rp_id>,rpIdHash, UP and UV, signature withhuman.reg.key); - each child:
child.parent == parent.gid,child.depth == parent.depth + 1,depth ≤ 1, and the child is narrower than its parent in capabilities, constraints, audience and time (ABY-3 §3).
For a passport: OAID-3 §8. Any failure:
401and no challenge, with codeuntrusted_node(node not trusted),expired,not_yet_valid,revoked,status_stale(503),grant_insufficient(audience), orinvalid_signaturefor every other failure, includinghuman_sig, a missingnbfand a broken chain link. - JWS against the node's
-
Verify the proof. Signature with the key of §4;
now < actor.expof the leaf, elseactor_expired;iatwindow;(kid, jti)unseen (§3.3);noncewhen required;htmequals the method;htuequals the normalised public URL;dthequals the hash of the header value;bdhequals the content hash, or absent when there is no body. Failure:401 invalid_signature(actor_expired: §6). -
Look up the route in the service's route map: required capability, class, level, tier,
authn,authority, and the class's maximum lifetime (ABY-3 §4). The class is always the route map's, never the grant'sclassmember. -
If the route needs no grant: accept with the passport identity.
-
Passport on a route that needs a grant:
401 grant_requiredwith a challenge. -
Check sufficiency against the leaf grant:
- the required capability matches a leaf capability with the request parameters satisfying its constraints (ABY-3 §3); a constraint the route depends on MUST be present: a route with an
amount_fieldneeds anamountconstraint, a resource with parameters needs ascope. A capability without it does not satisfy the route (fail closed); exp − nbfof every grant ≤ the class maximum (class_lifetime_exceeded);- for
write-hardandirreversible: the root'sinitiator.by == "service"andinitiator.kidis one of this service's ownkids (grant_insufficient); - effective level
min(human.level, human.reg level, max_level of the countersigning node, max_level of the home node)(trust list) ≥ required level; - custody tier and
human.regauthnmeet the route (tier_insufficient); - when the route requires
authority, a validauthoritycountersign covers the request (authority_required); - when the route sets
qes, the root carries a valid qualified electronic signature (OAID-7 §10) (qes_required); - when the route sets
mandate, or the root carriesacting_for, the mandate is valid for this human and covers the grant (ORG-1 §6) (mandate_required); - the stricter tenant settings apply when the resource belongs to a tenant (ORG-1 §3.3);
- when the route requires a linked human, the pair
(human.reg.iss, human.id)is linked and authorised for the resource (human_not_linked, AMH-1 §7); - single-use:
request_digestequalsSHA-256(JCS({ "htm", "htu", "query", "bdh" }))of this request (query= the raw query string;queryandbdhomitted when absent), and the grant is unconsumed.
- the required capability matches a leaf capability with the request parameters satisfying its constraints (ABY-3 §3); a constraint the route depends on MUST be present: a route with an
-
Consume and count atomically: mark a single-use grant consumed; add the call to
countand toamounttotals (per: grant,day,week,month) kept under the rootgid; add the amount to any authority rulebudget, refusing with403 budget_exceededwhen it would be exceeded (ORG-1 §5.3). When the service itself refuses the request after this step and before serving it (its own dispatch checks), it gives back exactly what this step charged for the request, so the approval stays usable; when it cannot (its store does not answer), the approval stays consumed. -
Accept. Audit:
gidchain withrev,actor.sub,human.id, level,run,call,jti, time.
Steps 3 and 4 MUST both succeed before any challenge that reveals action-specific information is returned; the step 1 challenge carries only realm and error.
6. Errors and status codes#
| Status | Codes | Challenge |
|---|---|---|
400 |
invalid_request |
no |
401 |
passport_required |
yes when the route needs a grant, with realm and error only |
401 |
invalid_signature, untrusted_node |
no |
401 |
grant_required, grant_insufficient, level_insufficient, qes_required, authority_required, mandate_required, expired, revoked, actor_expired, class_lifetime_exceeded, single_use_consumed |
yes, when the service can create an approval that would succeed; actor_expired also means "rebind" (§9) |
403 |
capability_denied, tier_insufficient, human_not_linked, budget_exceeded |
no — policy refusals no approval can fix |
429 |
rate_limited |
no |
431 |
envelope_too_large |
no |
503 |
status_stale |
no; Retry-After set |
Every error response is application/problem+json (RFC 9457, OAID-1 §5).
HTTP/1.1 401 Unauthorized
WWW-Authenticate: AllowedBy realm="api.example.com", error="grant_required",
action="invoices:approve", scope="invoice:4711", class="write-hard",
level="2", tier="1", code="K7QM",
approve="https://askmyhuman.org/a/8ZK3V4Q9T2M6R1XJ5WB0YHCDNE",
poll="https://node.example.org/allowedby/v1/approvals/8ZK3V4Q9T2M6R1XJ5WB0YHCDNE/grant",
request="8ZK3V4Q9T2M6R1XJ5WB0YHCDNE", expires="2026-10-26T12:15:00Z"
Content-Type: application/problem+json
{
"type": "https://allowedby.org/errors/grant_required",
"title": "A human approval is required for this action",
"action": "invoices:approve",
"scope": "invoice:4711",
"class": "write-hard",
"summary": "Approve invoice 4711, up to 4200.00 EUR",
"code": "K7QM",
"level_required": 2,
"tier_required": 1,
"single_use": true,
"request_digest": "<base64url SHA-256(JCS({htm, htu, query, bdh})) expected on retry>",
"approve_url": "https://askmyhuman.org/a/8ZK3V4Q9T2M6R1XJ5WB0YHCDNE",
"poll_url": "https://node.example.org/allowedby/v1/approvals/8ZK3V4Q9T2M6R1XJ5WB0YHCDNE/grant",
"approval_id": "8ZK3V4Q9T2M6R1XJ5WB0YHCDNE",
"expires": "2026-10-26T12:15:00Z"
}Parameters: error, action, scope, class, level, tier, amount_field, code, approve, poll, request, expires. amount_field (also in the problem JSON) is the route's JSON Pointer for amounts, present when the route has one, so that a runtime-initiated approval can carry an amount constraint the route will match. approve, poll, request, code, expires and summary are absent when the challenge invites a runtime-initiated approval (§7), since no approval exists yet. The problem JSON carries status (RFC 9457) and single_use; request_digest only when single-use. summary is the display.summary the node rendered from the service's templates (AMH-1 §4); it never contains secrets or full personal data.
Scope. scope MUST be exactly the resource the verifier compares in §5 step 8: the route's resource with the request's path values, taken from the path normalised as for htu (RFC 3986 §6.2.2: unreserved characters decoded, so %61b gives ab), and it MUST be a valid ABY-3 §2 scope. A resource may have several segments (ABY-3 §3): / and : appear only where the template has them. The service answers 400 invalid_request, never a challenge, when the path holds a malformed escape (a % not followed by two hex digits) or an escape that decodes to a control character (%00–%1F, %7F) or to / (%2F); when a value of the scope, decoded, is not 1 to 64 of A-Z a-z 0-9 . _ - (so never *, **, a space, :, ~, a sub-delimiter or a non-ASCII character: a%20b and x%C3%A9 are refused); or when the whole scope is longer than 256 bytes. An approval of that scope can then always satisfy the route on the same request. A service never re-encodes such a value and never logs it. The scope goes back only to the caller that sent its values.
7. Who creates the approval request#
- Service-initiated: the service calls
POST {approvals}(AMH-1 §3) at a node from its trust list, passingsub, capabilities,request_digest,audience(exactly its own origin) and, when known,human_hintandhuman_home. It returnsapprove,pollandcodein the challenge. REQUIRED forwrite-hardandirreversible; the grant records it ininitiatorand the verifier checks it (§5 step 8). - Runtime-initiated: allowed only for
readandwrite. The challenge has noapprove; the runtime callsPOST {approvals}at its own node. The service later verifies the grant against the actual request, so the runtime cannot widen what was asked. This is also case 0: the runtime creates the approval before any call, from the service's published vocabulary (ABY-3 §5).
8. Runtime behaviour on challenge#
- Read
approve, or create the approval request (§7). The runtime usesapproveandpollonly when they are HTTPS URLs on its own home node (or on a node its operator trusts); it never opens any other link a service sends. - Deliver the link,
summaryandcodeverbatim to the human through the operator's channel. - Poll
pollwith a proof-signed request (Allowed-By= passport +AllowedBy-Proof) no more than every 5 seconds, honouringRetry-After, until200(grant),410(denied, expired, revoked), orexpires. - Retry the original request with
Allowed-Byand a fresh proof. For single-use grants the method, URL, query and body MUST be byte-identical.
9. Rebind#
A tier 0 runtime that restarts, or a runtime whose actor.exp approaches, keeps its standing grants by rebinding (ABY-1 §6). It calls POST {approvals}/grants/{gid}/rebind with Allowed-By = the new passport and a proof signed by the new passport's key. The node accepts when:
- the new passport has the same
operator.idandruntime.idand a custody tier not lower, and - the new passport chains to the grant's bound passport through
prev, or the body carriesoperator_sig: a JWStyp: aby-operator+jwtover{ "gid", "sub", "aud": <this node>, "iat", "exp" }withexp ≤ iat + 300, signed by an operator key published in the operator'shttps://<domain>/.well-known/oaid-operatorJWKS (OAID-2 §6);subis the new passport; - the grant is not single-use and has no children.
Operators without a verified domain cannot rebind after a tier 0 restart; they request new approvals.
The node then issues a new revision: same gid, rev incremented, new jti, new actor and actor.exp, its own status index, same human, human_sig, capabilities and exp; and logs it. actor (except actor.operator and actor.runtime), rev and jti are outside the human-signed core, so human_sig stays valid. Earlier revisions are not revoked; they die at their own actor.exp. Several replicas MAY each hold their own revision. No human is involved; services see a normal grant.
10. Security considerations#
- The proof binds the document, the body, the method and the URL to one moment and one nonce. A captured envelope cannot be replayed, re-targeted or given a different body. The query is bound only for single-use grants (§5 step 8); services MUST NOT carry authorisation-relevant parameters in the query of a non-single-use route unless they check them as constraints.
- The proof key is the leaf grant's, bounded by
actor.exp: a leaked tier 0 key dies with its passport. - Copying the key into the grant means a compromised node could mint a grant naming any key.
human_sigover the core,human.regfrom the home node and the log make this detectable, and trust lists make it revocable. - Rebinding is bounded by the operator binding, the custody tier and the
prevchain or operator signature; every revision is logged where the operator's monitor sees it. - Challenges leak which actions exist. Services MAY answer callers with no valid document with the bare
passport_requiredform.
Change log#
Every change to this document adds a row here and increments its version (README, Versioning).
| Version | Date | Change |
|---|---|---|
| 0.2.14-draft | 2026-11-28 | §2, §5 step 3: a chain is at most depth 1 (two JWS), not 3; the size arithmetic behind it (ABY-1 0.2.6). |
| 0.2.13-draft | 2026-11-28 | §3.2: a service MAY require a nonce on any route it chooses, not only on irreversible ones, and the runtime retries once whatever the route's class; with RFC 9421 the nonce is the AllowedBy-Nonce header, a covered component. |
| 0.2.12-draft | 2026-11-27 | §5 step 9: a service that refuses the request itself after step 9, before serving it, gives back exactly what the step charged for it; when it cannot, the approval stays consumed. A service's own dispatch checks after the verification no longer burn a single-use approval. |
| 0.2.11-draft | 2026-11-26 | Change-log rows 0.2.7 to 0.2.10 cite CHANGES §26. |
| 0.2.10-draft | 2026-11-26 | §6: the scope is the resource the verifier compares (normalised path values) and a valid ABY-3 scope: a value outside the ABY-3 segment grammar (1 to 64 of A-Z a-z 0-9 . _ -), once decoded, is 400 invalid_request; malformed escapes, control characters, %2F and the 256-byte cap as before. (CHANGES §26) |
| 0.2.9-draft | 2026-11-26 | §6: the summary sentence (never secrets or full personal data), dropped by 0.2.7, is restored. (CHANGES §26) |
| 0.2.8-draft | 2026-11-26 | §6: the scope rule holds per value: no / inside a value (%2F refused); the 256 bytes are for the whole scope. (CHANGES §26) |
| 0.2.7-draft | 2026-11-26 | §6: the challenge scope is escaped-path characters only, at most 256 bytes, else 400 invalid_request; never re-encoded, never logged. (CHANGES §26) |
| 0.2.6-draft | 2026-11-08 | Verifiers check display against their own templates when several audiences are named, and fail closed on missing constraints; runtimes open only links on their node (CHANGES §23). |
| 0.2.5-draft | 2026-10-29 | Challenge parameter amount_field (CHANGES §19). |
| 0.2.4-draft | 2026-10-29 | Mandate check, tenant settings, period amounts and authority budgets in verification; codes mandate_required, budget_exceeded (CHANGES §18). |
| 0.2.3-draft | 2026-10-28 | Step 8 checks qes; qes_required challenges (CHANGES §17). |
| 0.2.2-draft | 2026-10-27 | Step 3 error codes named; strict htu; RFC 9421 profile details; runtime-initiated challenge omits expires (CHANGES §16). |
| 0.2.1-draft | 2026-10-27 | Passport in Allowed-By; initiator check for write-hard and irreversible; dth omitted without Allowed-By; rebind rules (CHANGES §15). |
| 0.2.0-draft | 2026-10-27 | One verifier algorithm; request_digest; shared replay set; status freshness per class (CHANGES §8). |