Skip to content

Commit e91f85d

Browse files
committed
wip: clearing mental hurdles
1 parent 0c510fc commit e91f85d

File tree

4 files changed

+380
-156
lines changed

4 files changed

+380
-156
lines changed

docs/reference/specifications/cap/CAP-01.mdx

Lines changed: 117 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,72 @@
33
<details>
44
<summary>Metadata</summary>
55
<dl>
6-
<dt>Status:</dt><dd>Draft</dd>
7-
<dt>Edition:</dt><dd>2025-09-02</dd>
8-
<dt>Extends:</dt><dd>-</dd>
9-
<dt>Updates:</dt><dd>-</dd>
10-
<dt>Obsoletes:</dt><dd>-</dd>
11-
<dt>Depends on:</dt><dd>SIGCHAIN-01, RSC-01, PRIVACY-01</dd>
6+
<dt>Status:</dt>
7+
<dd>Draft</dd>
8+
<dt>Edition:</dt>
9+
<dd>2025-09-02</dd>
10+
<dt>Extends:</dt>
11+
<dd>-</dd>
12+
<dt>Updates:</dt>
13+
<dd>-</dd>
14+
<dt>Obsoletes:</dt>
15+
<dd>-</dd>
16+
<dt>Depends on:</dt>
17+
<dd>SIGCHAIN-01, RSC-01, PRIVACY-01</dd>
1218
</dl>
1319
</details>
1420

1521
## Abstract
1622

17-
CAP-01 defines the portable, verifiable capability model used by Polykey to express delegated authority. It specifies the structure and semantics of Grants (capability tokens) and Presentations (ephemeral proofs of capability), including verbs, resource addressing, binding constraints, attenuation, and revocation. CAP-01 ensures capabilities are composable, attenuable (never broadened), and safely enforceable at CEPs (Capability Enforcement Points), producing settlement-grade receipts (RSC-01).
23+
CAP-01 defines the portable, verifiable capability model used by Polykey to
24+
express delegated authority. It specifies the structure and semantics of Grants
25+
(capability tokens) and Presentations (ephemeral proofs of capability),
26+
including verbs, resource addressing, binding constraints, attenuation, and
27+
revocation. CAP-01 ensures capabilities are composable, attenuable (never
28+
broadened), and safely enforceable at CEPs (Capability Enforcement Points),
29+
producing settlement-grade receipts (RSC-01).
1830

1931
## Terminology
2032

2133
- Principal (P): Originator of authority; issues a Grant to a Subject.
2234
- Subject (S): Holder that exercises the capability by creating a Presentation.
2335
- Resource (R): Target of the action; may host a native CEP (CEP(R)).
24-
- CEP: Capability Enforcement Point at P/S/R that verifies Presentations and enforces capabilities (writes the Access PoAR).
36+
- CEP: Capability Enforcement Point at P/S/R that verifies Presentations and
37+
enforces capabilities (writes the Access PoAR).
2538
- Grant (G): A signed, portable capability issued by P to S.
26-
- Presentation (Π): An ephemeral, proof-of-possession token created by S that references a Grant with context and channel binding. Not stored on-chain.
27-
- Bind: Binding constraints inside a Grant that restrict its use (audience, purpose, time, context, etc.).
28-
- Attenuation: Narrowing a capability when delegating; derived Grants must be a subset of their parent capability.
29-
- Verification (Σ): The verification handshake at the enforcing CEP. `Σ = verify(Π, G, Bind, Channel, TTL, Attenuation?, Lease?)`
30-
- Lease: The upstream authority relationship to a non-native SoA; referenced via leaseRef in PoAR (RSC-01).
39+
- Presentation (Π): An ephemeral, proof-of-possession token created by S that
40+
references a Grant with context and channel binding. Not stored on-chain.
41+
- Bind: Binding constraints inside a Grant that restrict its use (audience,
42+
purpose, time, context, etc.).
43+
- Attenuation: Narrowing a capability when delegating; derived Grants must be a
44+
subset of their parent capability.
45+
- Verification (Σ): The verification handshake at the enforcing CEP.
46+
`Σ = verify(Π, G, Bind, Channel, TTL, Attenuation?, Lease?)`
47+
- Lease: The upstream authority relationship to a non-native SoA; referenced via
48+
leaseRef in PoAR (RSC-01).
3149
- PoAR: Proof-of-Action receipt written by the enforcing CEP (RSC-01).
3250

3351
## Overview and Goals
3452

3553
CAP-01 provides:
3654

37-
- A minimal, expressive grammar for capabilities (verbs over resources with constraints).
38-
- A binding system (Bind) to tie capability use to audience, purpose, context, and time.
39-
- A safe delegation model: capabilities can be attenuated and re-delegated without ever broadening power.
40-
- A secure, ephemeral Presentation that is resistant to theft and replay (PoP + channel binding).
55+
- A minimal, expressive grammar for capabilities (verbs over resources with
56+
constraints).
57+
- A binding system (Bind) to tie capability use to audience, purpose, context,
58+
and time.
59+
- A safe delegation model: capabilities can be attenuated and re-delegated
60+
without ever broadening power.
61+
- A secure, ephemeral Presentation that is resistant to theft and replay (PoP +
62+
channel binding).
4163
- Clear interoperability with CEP enforcement and receipt minting (RSC-01).
4264

4365
Design goals:
4466

4567
- Portable: Grants and Presentations are verifiable across boundaries.
4668
- Minimal: Core fields are few and clearly defined; extensions via vocabularies.
4769
- Attenuable: Derived Grants must shrink authority; verifiable at enforcement.
48-
- Secure by default: Holder-of-key + channel binding; short TTLs for Presentations.
70+
- Secure by default: Holder-of-key + channel binding; short TTLs for
71+
Presentations.
4972
- Receipt-ready: CEPS capture a bind_snapshot in PoAR.
5073

5174
## Verbs and Resources
@@ -62,7 +85,8 @@ Verbs are strings, recommended namespaced for clarity:
6285
- secret:read, secret:derive
6386
- data:export, model:infer
6487

65-
Verb semantics must be documented in a public or private registry (with versioned definitions). TAP profiles may whitelist verb sets per domain.
88+
Verb semantics must be documented in a public or private registry (with
89+
versioned definitions). TAP profiles may whitelist verb sets per domain.
6690

6791
### Resource addressing
6892

@@ -78,7 +102,8 @@ TAP profiles may restrict acceptable schemes per domain and verb.
78102

79103
## Grant Structure and Rules
80104

81-
A Grant is a signed claim on P's sigchain that authorizes S to perform actions (verbs) on resources, subject to Bind constraints.
105+
A Grant is a signed claim on P's sigchain that authorizes S to perform actions
106+
(verbs) on resources, subject to Bind constraints.
82107

83108
Required fields:
84109

@@ -97,7 +122,8 @@ Normative rules:
97122

98123
- Grants MUST be written on the issuer's (P's) sigchain.
99124
- expiry MUST be present and enforced; Presentations beyond expiry are invalid.
100-
- action/resource MUST be specific; wildcards SHOULD be avoided unless constrained by Bind.
125+
- action/resource MUST be specific; wildcards SHOULD be avoided unless
126+
constrained by Bind.
101127
- bind MUST be enforceable by CEPs and included in the PoAR bind_snapshot.
102128
- A Grant MAY be revoked (Section 8).
103129

@@ -118,19 +144,25 @@ Minimal JSON skeleton:
118144
}
119145
```
120146

121-
Bind constrains how a capability may be exercised. CEPs MUST enforce Bind and include a bind_snapshot in PoAR.
147+
Bind constrains how a capability may be exercised. CEPs MUST enforce Bind and
148+
include a bind_snapshot in PoAR.
122149

123150
Recommended fields:
124151

125152
- audience: list of DIDs of acceptable enforcers (e.g., ["did:pk:P","did:pk:R"])
126-
- purpose: semantic hash or descriptor of intent (e.g., hash of artifact H, “door-visit-123”)
127-
- context: structured k/v describing runtime context (e.g., `{"pod":"runner-xyz","ns":"ci"}`)
153+
- purpose: semantic hash or descriptor of intent (e.g., hash of artifact H,
154+
“door-visit-123”)
155+
- context: structured k/v describing runtime context (e.g.,
156+
`{"pod":"runner-xyz","ns":"ci"}`)
128157
- time_window: `{ notBefore, notAfter }` narrower than Grant expiry
129158
- ttl: maximum Presentation TTL (e.g., "120s")
130-
- maxUses: optional counter for total uses (enforced by CEP capable of maintaining state)
159+
- maxUses: optional counter for total uses (enforced by CEP capable of
160+
maintaining state)
131161
- geofence / net: optional constraints (e.g., CIDR, region, location)
132162

133-
Subset rule (for attenuation, Section 6): child.bind MUST be a subset (narrower or equal) of parent.bind on every dimension (audience, purpose scope, time, ttl, etc.).
163+
Subset rule (for attenuation, Section 6): child.bind MUST be a subset (narrower
164+
or equal) of parent.bind on every dimension (audience, purpose scope, time, ttl,
165+
etc.).
134166

135167
```json
136168
"bind": {
@@ -144,43 +176,57 @@ Subset rule (for attenuation, Section 6): child.bind MUST be a subset (narrower
144176

145177
## Attenuation and Delegation
146178

147-
A capability MAY be delegated by S to S2 by issuing a derived Grant on the delegator's sigchain, provided:
179+
A capability MAY be delegated by S to S2 by issuing a derived Grant on the
180+
delegator's sigchain, provided:
148181

149182
- The derived Grant's action/resource are identical or narrower (subset).
150-
- The derived Grant's bind is a subset of the parent Grant's bind on all dimensions.
183+
- The derived Grant's bind is a subset of the parent Grant's bind on all
184+
dimensions.
151185
- The chain of custody (P → S → S2) is provable via sigchains.
152-
- No broadening: delegation MUST NOT increase the set of allowed enforcers, time, scope, or resource coverage.
186+
- No broadening: delegation MUST NOT increase the set of allowed enforcers,
187+
time, scope, or resource coverage.
153188

154189
Normative subset checks (examples):
155190

156191
- `time_window.child``time_window.parent`
157192
- `audience.child``audience.parent`
158193
- `ttl.child``ttl.parent`
159194
- `resource.child` narrower (e.g., specific door vs building-wide)
160-
- `purpose.child` equals or narrower (e.g., same artifact hash or a stricter descriptor)
195+
- `purpose.child` equals or narrower (e.g., same artifact hash or a stricter
196+
descriptor)
161197

162-
CEPs SHOULD verify chain attenuation if presented with a chain (Grant_ref may include a chain; otherwise, single-hop P→S is verified).
198+
CEPs SHOULD verify chain attenuation if presented with a chain (Grant_ref may
199+
include a chain; otherwise, single-hop P→S is verified).
163200

164201
## Presentation
165202

166-
A Presentation is an ephemeral proof by S that it holds a Grant and is using it now, in this context, on this channel. Presentations are NOT written to sigchains.
203+
A Presentation is an ephemeral proof by S that it holds a Grant and is using it
204+
now, in this context, on this channel. Presentations are NOT written to
205+
sigchains.
167206

168207
Required fields:
208+
169209
- grant_ref: hash of Grant (or terminal of a chain)
170210
- holder: DID of S
171211
- pop_sig: signature by S’s private key over the presentation payload
172-
- channelBinding: exporter-derived key for the live TLS/mTLS session (or equivalent)
212+
- channelBinding: exporter-derived key for the live TLS/mTLS session (or
213+
equivalent)
173214
- ctx: runtime context (subset of bind.context)
174215
- ttl: small (e.g., 120s)
175216
- nonce: unique value to prevent replay
176217

177218
Normative rules:
178-
- Presentations MUST be bound to holder’s key (PoP) and to the transport/session (channelBinding).
219+
220+
- Presentations MUST be bound to holder’s key (PoP) and to the transport/session
221+
(channelBinding).
179222
- Presentation ttl MUST be enforced by CEPs.
180-
- Presentations MUST include binding to Grant_ref and context; CEPs MUST check bind subset.
181-
- CEPs MUST reject Presentations beyond Grant expiry or outside bind.time_window.
223+
- Presentations MUST include binding to Grant_ref and context; CEPs MUST check
224+
bind subset.
225+
- CEPs MUST reject Presentations beyond Grant expiry or outside
226+
bind.time_window.
182227

183228
Minimal JSON skeleton (often conveyed as a signed JWT/DSSE):
229+
184230
```
185231
{
186232
"type": "presentation",
@@ -197,42 +243,56 @@ Minimal JSON skeleton (often conveyed as a signed JWT/DSSE):
197243
## 8. Revocation and rotation
198244

199245
### 8.1 Revocation
200-
A Grant MAY be revoked by its issuer with a signed revocation claim on P’s sigchain:
246+
247+
A Grant MAY be revoked by its issuer with a signed revocation claim on P’s
248+
sigchain:
249+
201250
- type: "revoke", target: grant_id/hash(G), reason(optional), time, sig
202251
- CEPs MUST check for revocation before enforcing.
203-
- ViewReceipts SHOULD include knowledge of revocation state at time of action (via bind_snapshot + revocation check in PoAR).
252+
- ViewReceipts SHOULD include knowledge of revocation state at time of action
253+
(via bind_snapshot + revocation check in PoAR).
204254

205255
### 8.2 Rotation
206-
For secret-bound flows (PS-BA/SS-BA), upstream leases and secrets MUST be rotated per TAP policy. PoAR includes leaseRef (freshness proof). Rotation receipts may be recorded per SIGCHAIN-01 (optional).
256+
257+
For secret-bound flows (PS-BA/SS-BA), upstream leases and secrets MUST be
258+
rotated per TAP policy. PoAR includes leaseRef (freshness proof). Rotation
259+
receipts may be recorded per SIGCHAIN-01 (optional).
207260

208261
## 9. CEP enforcement (normative algorithm)
209262

210263
Given a Presentation p from S and an asserted Grant G:
211-
1) Verify issuer signature of G (P’s sigchain), subject DID, action/resource.
212-
2) Check expiry and revocation of G.
213-
3) Verify Presentation:
264+
265+
1. Verify issuer signature of G (P’s sigchain), subject DID, action/resource.
266+
2. Check expiry and revocation of G.
267+
3. Verify Presentation:
214268
- pop_sig by holder S
215269
- channelBinding matches live session (mTLS/DPoP)
216270
- ttl within bind.ttl and current time within bind.time_window
217271
- ctx consistent and bind subset satisfied
218-
4) If Grant is a derived chain: verify attenuation (child bind/resource/action ⊆ parent).
219-
5) If enforcement passes, enforce per placement/mode and write PoAR:
220-
- Include bind_snapshot (canonical copy of bind at enforcement), cepRef, exposureMode, time_source, requestDigest (if mediate).
272+
4. If Grant is a derived chain: verify attenuation (child bind/resource/action ⊆
273+
parent).
274+
5. If enforcement passes, enforce per placement/mode and write PoAR:
275+
- Include bind_snapshot (canonical copy of bind at enforcement), cepRef,
276+
exposureMode, time_source, requestDigest (if mediate).
221277
- Deliver PoAR to S.
222-
6) If any check fails, mint DenyReceipt with reason_code and deliver to S.
278+
6. If any check fails, mint DenyReceipt with reason_code and deliver to S.
223279

224280
## 10. Security considerations
225281

226282
- Holder-of-key (PoP) + channel binding prevent token theft and replay.
227-
- Presentations MUST be short-lived; CEPs SHOULD reject stale nonces (optional stateful defense).
283+
- Presentations MUST be short-lived; CEPs SHOULD reject stale nonces (optional
284+
stateful defense).
228285
- Bind MUST be enforced; failure to snapshot bind in PoAR weakens auditability.
229286
- Delegation MUST be attenuating; TAP SHOULD disallow broadening by policy.
230-
- Reveal is dangerous; exposureMode="reveal" MUST follow strict TAP guardrails (tiny ttl/scope, dual-control, immediate revoke/rotate).
231-
- Privacy: Do not include raw PII in Grants/Presentations; use DIDs and contextual claims; ViewReceipts handle selective disclosure.
287+
- Reveal is dangerous; exposureMode="reveal" MUST follow strict TAP guardrails
288+
(tiny ttl/scope, dual-control, immediate revoke/rotate).
289+
- Privacy: Do not include raw PII in Grants/Presentations; use DIDs and
290+
contextual claims; ViewReceipts handle selective disclosure.
232291

233292
## 11. Examples (JSON)
234293

235294
Grant (P → S; deploy to prod for artifact H)
295+
236296
```
237297
{
238298
"type": "grant",
@@ -271,10 +331,14 @@ Presentation (S → CEP)
271331

272332
## Revision history
273333

274-
- 2025-09-02: Initial draft edition (holder-of-key + channel binding; Bind subset rules; attenuation; revocation; CEP enforcement algorithm; examples).
334+
- 2025-09-02: Initial draft edition (holder-of-key + channel binding; Bind
335+
subset rules; attenuation; revocation; CEP enforcement algorithm; examples).
275336

276337
Notes:
277338

278-
- Registries (verbs, resource schemes) MAY be maintained as content-addressed vocabularies; TAP profiles SHOULD reference accepted vocab ids.
279-
- RSC-01 specifies how bind_snapshot, cepRef, exposureMode, leaseRef, and requestDigest appear in PoAR.
280-
- SIGCHAIN-01 and STORAGE-01 specify durability/archival; PRIVACY-01 covers ViewReceipts/redactions/crypto-erasure.
339+
- Registries (verbs, resource schemes) MAY be maintained as content-addressed
340+
vocabularies; TAP profiles SHOULD reference accepted vocab ids.
341+
- RSC-01 specifies how bind_snapshot, cepRef, exposureMode, leaseRef, and
342+
requestDigest appear in PoAR.
343+
- SIGCHAIN-01 and STORAGE-01 specify durability/archival; PRIVACY-01 covers
344+
ViewReceipts/redactions/crypto-erasure.

0 commit comments

Comments
 (0)