@adastracomputing/ink 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/CODE_OF_CONDUCT.md +42 -0
  3. package/LICENSE-APACHE +201 -0
  4. package/LICENSE-MIT +21 -0
  5. package/README.md +133 -0
  6. package/SECURITY.md +57 -0
  7. package/docs/key-rotation-rule.md +108 -0
  8. package/docs/logo.svg +8 -0
  9. package/docs/maturity.md +81 -0
  10. package/docs/threat-model.md +150 -0
  11. package/package.json +72 -0
  12. package/specs/ink-agent-containment-and-governance-extension-spec.md +508 -0
  13. package/specs/ink-auditability.md +652 -0
  14. package/specs/ink-authorization-chain.md +242 -0
  15. package/specs/ink-compatibility-policy.md +263 -0
  16. package/specs/ink-compliance-checklist.md +309 -0
  17. package/specs/ink-containment-phase1-implementation-spec.md +593 -0
  18. package/specs/ink-introduction-receipts-extension.md +501 -0
  19. package/specs/ink-key-rotation-spec.md +535 -0
  20. package/src/crypto/ink.ts +902 -0
  21. package/src/crypto/keys.ts +211 -0
  22. package/src/crypto/multi-key-verify.ts +170 -0
  23. package/src/crypto/sign.ts +155 -0
  24. package/src/crypto/verify.ts +1 -0
  25. package/src/discovery/agent-card.ts +508 -0
  26. package/src/index.ts +59 -0
  27. package/src/ink/checkpoint.ts +75 -0
  28. package/src/ink/discovery-gating.ts +147 -0
  29. package/src/ink/handshake-budget.ts +413 -0
  30. package/src/ink/receipts.ts +114 -0
  31. package/src/ink/transport-auth.ts +96 -0
  32. package/src/middleware/ink-auth.ts +263 -0
  33. package/src/models/agent-card.ts +63 -0
  34. package/src/models/ink-audit.ts +205 -0
  35. package/src/models/ink-handshake.ts +123 -0
  36. package/src/models/intent.ts +201 -0
  37. package/src/models/key-entry.ts +52 -0
  38. package/src/models/profile.ts +31 -0
  39. package/test-vectors/README.md +129 -0
  40. package/test-vectors/encryption.json +90 -0
  41. package/test-vectors/handshake.json +482 -0
  42. package/test-vectors/jcs.json +30 -0
  43. package/test-vectors/key-rotation.json +101 -0
  44. package/test-vectors/keys.json +32 -0
  45. package/test-vectors/receipts-and-audit.json +142 -0
  46. package/test-vectors/replay.json +88 -0
  47. package/test-vectors/signing.json +61 -0
  48. package/test-vectors/witness.json +394 -0
@@ -0,0 +1,508 @@
1
+ # INK Agent Containment and Governance Extension v0.1
2
+
3
+ ## Status
4
+ Draft
5
+
6
+ ## Purpose
7
+
8
+ This specification extends INK with controls for:
9
+ - agent containment
10
+ - delegation-chain abuse prevention
11
+ - handshake flood resistance
12
+ - discovery minimization
13
+ - transport-bound authorization
14
+ - optional fleet-managed enterprise deployments
15
+
16
+ The goal is to preserve INK’s self-sovereign trust model while addressing operational risks common in agentic systems:
17
+ - runaway delegation
18
+ - uncontrolled agent spawning
19
+ - predictable workflow abuse
20
+ - excessive visibility of agent endpoints and capabilities
21
+ - ambiguous authorization across multiple transports
22
+
23
+ This specification complements, but does not replace, the authorization chain framing in [`ink-authorization-chain.md`](./ink-authorization-chain.md) and the auditability surface in [`ink-auditability.md`](./ink-auditability.md).
24
+
25
+ Core principle:
26
+
27
+ **INK should remain open enough for trustworthy coordination, while making delegation, visibility, and automation budgets explicit and enforceable.**
28
+
29
+ ---
30
+
31
+ ## 1. Motivation
32
+
33
+ INK already covers core identity, transport signing, auditability, receipts, authorization chains, and key rotation well.
34
+
35
+ However, agentic systems are often compromised by failures in operational basics:
36
+ - over-broad delegation
37
+ - unbounded automation
38
+ - ambiguous ownership of spawned agents
39
+ - exposure of machine-readable surfaces to unnecessary probing
40
+ - weak separation between transports and permission scopes
41
+
42
+ Recent zero-trust guidance for AI systems continues to emphasize:
43
+ - explicit verification
44
+ - least privilege
45
+ - assume breach
46
+ - containment of blast radius
47
+ - strong visibility and governance for autonomous actors
48
+
49
+ INK should therefore strengthen not just identity and audit, but containment and governance.
50
+
51
+ ---
52
+
53
+ ## 2. Design Goals
54
+
55
+ This extension adds:
56
+
57
+ 1. explicit delegation-depth and issuance-budget controls
58
+ 2. protocol-level anti-flood rules for handshake and challenge flows
59
+ 3. optional fleet-managed governance for enterprise deployments
60
+ 4. discovery minimization and capability-gated Agent Card exposure
61
+ 5. explicit transport binding for delegation tokens and chain hops
62
+
63
+ This extension does not attempt to:
64
+ - replace Tulpa’s broader abuse-prevention product controls
65
+ - require centralized identity for all INK deployments
66
+ - make proof-of-work mandatory
67
+ - turn INK into an enterprise-only protocol
68
+
69
+ ---
70
+
71
+ ## 3. Threat Model Additions
72
+
73
+ ### 3.1 Runaway delegation
74
+ An agent or extension repeatedly delegates or spawns child actors that continue acting within inherited scope.
75
+
76
+ ### 3.2 Handshake flooding
77
+ An attacker sends large volumes of validly signed challenges, rejections, or low-value handshake loops to consume resources or suppress legitimate traffic.
78
+
79
+ ### 3.3 Discovery probing
80
+ An attacker enumerates Agent Cards, capabilities, endpoints, or public-facing metadata to map the network or plan exploitation.
81
+
82
+ ### 3.4 Cross-transport confused deputy
83
+ A token intended only for INK HTTP use is replayed or reused in another channel such as a product API, extension callback, voice workflow, or fleet broker.
84
+
85
+ ### 3.5 Fleet compromise blast radius
86
+ In enterprise or managed deployments, a central provisioning layer is compromised or misconfigured, causing broad misissuance or delayed revocation.
87
+
88
+ ---
89
+
90
+ ## 4. Containment Model
91
+
92
+ ### 4.1 Delegation depth
93
+ INK already limits authorization-chain hop count. This extension adds explicit issuer and recipient policy signals for delegation depth.
94
+
95
+ Add the following optional Agent Card fields:
96
+
97
+ ```ts
98
+ interface InkGovernanceCapabilities {
99
+ maxIssuedDelegationDepth?: number
100
+ maxAcceptedDelegationDepth?: number
101
+ maxDelegationIssuancePerHour?: number
102
+ supportsCapabilityGatedDiscovery?: boolean
103
+ supportsFleetManagement?: boolean
104
+ supportedTransports?: InkTransport[]
105
+ }
106
+
107
+ type InkTransport =
108
+ | "ink_http"
109
+ | "ink_ws"
110
+ | "extension_api"
111
+ | "voice"
112
+ | "line_phone"
113
+ | "human_review_queue"
114
+ ```
115
+
116
+ Semantics:
117
+ - `maxIssuedDelegationDepth`: maximum downstream depth this agent will issue
118
+ - `maxAcceptedDelegationDepth`: deepest chain this agent will accept
119
+ - `maxDelegationIssuancePerHour`: optional self-advertised issuance budget
120
+
121
+ Recipients MUST apply the lower of:
122
+ - protocol global maximum
123
+ - local recipient policy
124
+ - sender-advertised accepted maximum when relevant
125
+
126
+ ### 4.2 Delegation issuance budgets
127
+ Delegation issuance SHOULD be rate-limited both locally and, when present, by fleet policy.
128
+
129
+ Recommended defaults:
130
+ - low-trust agents: 5 issuances/hour
131
+ - standard trusted agents: 30 issuances/hour
132
+ - reviewed enterprise agents: deployment-specific
133
+
134
+ These are not mere implementation hints. The protocol should support communicating budget exhaustion via typed rejection.
135
+
136
+ Add new rejection reason:
137
+ - `delegation_budget_exhausted`
138
+
139
+ ### 4.3 Child-agent containment
140
+ If an implementation allows an agent to provision or invoke a subordinate agent or service actor, that actor MUST NOT implicitly inherit the parent’s full authority.
141
+
142
+ Any spawned actor MUST receive:
143
+ - its own identity
144
+ - its own scoped authorization proof or token
145
+ - an explicit transport list
146
+ - its own expiry
147
+ - auditable linkage to the parent actor
148
+
149
+ Implicit credential copying or silent credential inheritance is prohibited.
150
+
151
+ ---
152
+
153
+ ## 5. Handshake Flood Resistance
154
+
155
+ ### 5.1 Rationale
156
+ The INK handshake is intentionally structured and predictable. That is desirable for interop, but it also means attackers can target deterministic flows.
157
+
158
+ INK should therefore define protocol-level flood resistance rather than leaving it entirely to per-implementation heuristics.
159
+
160
+ ### 5.2 Per-correlation budget
161
+ For a given `intentRef` or `correlationId`, recipients SHOULD enforce:
162
+ - maximum challenge count
163
+ - maximum rejection count
164
+ - maximum total state transitions
165
+ - expiry window after which no more handshake messages are accepted
166
+
167
+ Recommended defaults:
168
+ - max 3 challenges per `intentRef`
169
+ - max 1 rejection terminal event
170
+ - max 1 resolution terminal event
171
+ - handshake TTL no longer than the original intent expiry
172
+
173
+ ### 5.3 Retry-after signaling
174
+ Add optional rejection metadata:
175
+
176
+ ```ts
177
+ interface InkBackoffHint {
178
+ retryAfterSeconds?: number
179
+ cooldownUntil?: string
180
+ backoffClass?: "sender" | "intent_ref" | "counterparty"
181
+ }
182
+ ```
183
+
184
+ This metadata MAY appear in challenge or rejection responses where the recipient wants the sender to pause.
185
+
186
+ ### 5.4 New rejection reasons
187
+ Add the following standardized reasons:
188
+ - `handshake_budget_exhausted`
189
+ - `counterparty_cooldown`
190
+ - `sender_rate_limited`
191
+ - `proof_of_work_required`
192
+
193
+ ### 5.5 Proof-of-work
194
+ Proof-of-work MAY be supported as an optional extension in hostile or public-open deployments, but MUST NOT be mandatory for baseline INK interoperability.
195
+
196
+ Reason:
197
+ - it increases implementation complexity
198
+ - it complicates mobile and low-power clients
199
+ - it is unnecessary for many trusted-network deployments
200
+
201
+ The preferred baseline defenses are:
202
+ - stateful budgets
203
+ - cooldowns
204
+ - rate limits
205
+ - typed backoff
206
+ - trust-tier gating
207
+
208
+ ---
209
+
210
+ ## 6. Discovery Minimization
211
+
212
+ ### 6.1 Problem
213
+ Publicly discoverable Agent Cards are useful, but they also expand the probing surface.
214
+
215
+ INK should support more granular discoverability than simply public vs private.
216
+
217
+ ### 6.2 Agent Card visibility classes
218
+ Add optional Agent Card visibility states:
219
+
220
+ - `public`
221
+ - `network_only`
222
+ - `private`
223
+ - `capability_gated`
224
+
225
+ `capability_gated` means:
226
+ - the existence of the agent may be known
227
+ - detailed capabilities, endpoints, and accepted intents are only revealed to authenticated peers meeting local policy
228
+
229
+ ### 6.3 Redacted Agent Card
230
+ For capability-gated discovery, implementations SHOULD support a redacted card variant.
231
+
232
+ Example:
233
+
234
+ ```ts
235
+ interface RedactedAgentCard {
236
+ id: string
237
+ displayName?: string
238
+ visibility: "capability_gated"
239
+ publicHandle?: string
240
+ supportsInk: true
241
+ discoveryMode: "authenticate_for_details"
242
+ }
243
+ ```
244
+
245
+ Detailed fields such as:
246
+ - intents accepted
247
+ - transports
248
+ - scheduling endpoints
249
+ - delegation/gov capabilities
250
+ - extension hooks
251
+
252
+ SHOULD only be disclosed after authenticated discovery.
253
+
254
+ ### 6.4 Authenticated discovery
255
+ Capability-gated discovery SHOULD use a signed authenticated request.
256
+
257
+ Suggested endpoint:
258
+ - `POST /.well-known/ink/agent-card/query`
259
+
260
+ Request body:
261
+ - requester DID
262
+ - nonce
263
+ - timestamp
264
+ - requested fields or capabilities
265
+
266
+ The response MAY:
267
+ - deny
268
+ - return a redacted card
269
+ - return a scoped detailed card
270
+
271
+ ### 6.5 Privacy defaults
272
+ Recommended defaults:
273
+ - self-sovereign/public-network deployments: `network_only`
274
+ - enterprise-managed/internal deployments: `capability_gated`
275
+
276
+ ---
277
+
278
+ ## 7. Transport-Bound Authorization
279
+
280
+ ### 7.1 Problem
281
+ Delegation tokens and authorization proofs should not be reusable across arbitrary channels.
282
+
283
+ ### 7.2 Transport constraints
284
+ Extend authorization-chain hop constraints with `allowedTransports`.
285
+
286
+ ```ts
287
+ constraints: {
288
+ intentTypes?: string[]
289
+ targetAgents?: string[]
290
+ expiresAt: string
291
+ maxMessages?: number
292
+ allowedTransports?: InkTransport[]
293
+ }
294
+ ```
295
+
296
+ Verification rule:
297
+ - if the current invocation transport is not in `allowedTransports`, the message MUST be rejected
298
+
299
+ ### 7.3 Transport identifiers
300
+ The following transport identifiers are standardized:
301
+ - `ink_http`
302
+ - `ink_ws`
303
+ - `extension_api`
304
+ - `voice`
305
+ - `line_phone`
306
+ - `human_review_queue`
307
+
308
+ Future transports MUST define:
309
+ - a stable identifier
310
+ - invocation semantics
311
+ - audit expectations
312
+
313
+ ### 7.4 Defaults
314
+ If `allowedTransports` is omitted:
315
+ - the default MUST be `["ink_http"]` for INK-native delegation
316
+ - implementations MUST NOT interpret omission as “all transports allowed”
317
+
318
+ This is intentionally strict.
319
+
320
+ ### 7.5 Audit requirements
321
+ Audit records SHOULD include the invocation transport for delegated actions.
322
+
323
+ This helps distinguish:
324
+ - INK-native actions
325
+ - extension callbacks
326
+ - voice-triggered actions
327
+ - human-review-queue escalations
328
+
329
+ ---
330
+
331
+ ## 8. Fleet-Managed Enterprise Mode
332
+
333
+ ### 8.1 Purpose
334
+ Some deployments need a central lifecycle layer for:
335
+ - agent provisioning
336
+ - policy enforcement
337
+ - offboarding
338
+ - org-wide revocation
339
+
340
+ INK SHOULD support this without making self-sovereign mode second-class.
341
+
342
+ ### 8.2 Fleet management descriptor
343
+ Add optional Agent Card section:
344
+
345
+ ```ts
346
+ interface FleetManagementInfo {
347
+ mode: "self_sovereign" | "fleet_managed"
348
+ orgId?: string
349
+ brokerDid?: string
350
+ revocationEndpoint?: string
351
+ policyEndpoint?: string
352
+ }
353
+ ```
354
+
355
+ ### 8.3 Fleet broker responsibilities
356
+ A fleet broker MAY:
357
+ - issue managed agent cards
358
+ - publish org-level policies
359
+ - revoke agent participation
360
+ - publish org-scoped trust metadata
361
+ - require stricter transport/channel controls
362
+
363
+ A fleet broker MUST NOT silently rewrite historical signed artifacts.
364
+
365
+ ### 8.4 Offboarding
366
+ For fleet-managed mode, offboarding SHOULD support:
367
+ - immediate key revocation or retirement
368
+ - revocation of outstanding delegation grants
369
+ - publication of agent inactive state
370
+ - optional org-signed deprovision receipt
371
+
372
+ ### 8.5 Recipient policy
373
+ Recipients MAY treat fleet-managed peers differently, for example:
374
+ - requiring fleet metadata for enterprise-only workflows
375
+ - honoring org revocation feeds
376
+ - applying org-scoped trust rules
377
+
378
+ ---
379
+
380
+ ## 9. Wire and Schema Changes
381
+
382
+ ### 9.1 Agent Card
383
+ Extend Agent Card governance/capability sections with:
384
+ - `maxIssuedDelegationDepth`
385
+ - `maxAcceptedDelegationDepth`
386
+ - `maxDelegationIssuancePerHour`
387
+ - `supportedTransports`
388
+ - `visibility`
389
+ - `supportsCapabilityGatedDiscovery`
390
+ - `fleetManagement`
391
+
392
+ ### 9.2 Rejection schema
393
+ Extend typed rejections with:
394
+ - `delegation_budget_exhausted`
395
+ - `handshake_budget_exhausted`
396
+ - `counterparty_cooldown`
397
+ - `sender_rate_limited`
398
+ - `proof_of_work_required`
399
+
400
+ and optional:
401
+ - `retryAfterSeconds`
402
+ - `cooldownUntil`
403
+ - `backoffClass`
404
+
405
+ ### 9.3 Authorization chain constraints
406
+ Add:
407
+ - `allowedTransports`
408
+
409
+ ### 9.4 Audit events
410
+ Recommended new audit event types:
411
+ - `delegation_issued`
412
+ - `delegation_budget_exhausted`
413
+ - `handshake_rate_limited`
414
+ - `discovery_query_denied`
415
+ - `discovery_query_granted`
416
+ - `transport_scope_violation`
417
+ - `fleet_deprovisioned`
418
+
419
+ ---
420
+
421
+ ## 10. Verification Rules
422
+
423
+ Recipients implementing this extension SHOULD verify:
424
+
425
+ 1. delegation chain depth <= recipient policy
426
+ 2. delegation chain depth <= any sender-issued maximum if relevant
427
+ 3. issuance budget not exceeded for governed flows
428
+ 4. handshake per-correlation budgets not exceeded
429
+ 5. invocation transport is allowed by the delegation chain
430
+ 6. requested Agent Card details are allowed for the authenticated requester
431
+ 7. fleet metadata, if required by local policy, is present and valid
432
+
433
+ Failures SHOULD map to typed, auditable rejection reasons rather than silent drops when safe to do so.
434
+
435
+ ---
436
+
437
+ ## 11. Rollout Plan
438
+
439
+ ### 11.1 Phase 1: Advisory signals
440
+ - add Agent Card governance fields
441
+ - add transport constraint field
442
+ - add typed rejection reasons
443
+ - emit audit events
444
+
445
+ ### 11.2 Phase 2: Local enforcement
446
+ - enforce `allowedTransports`
447
+ - enforce handshake budgets
448
+ - enforce capability-gated discovery for opted-in agents
449
+
450
+ ### 11.3 Phase 3: Enterprise mode
451
+ - add fleet broker descriptors
452
+ - support org-wide deprovision and revocation feeds
453
+ - add enterprise policy docs and examples
454
+
455
+ ### 11.4 Phase 4: Interop hardening
456
+ - add test vectors
457
+ - add compliance checklist entries
458
+ - run self-sovereign vs fleet-managed interop tests
459
+
460
+ ---
461
+
462
+ ## 12. Security Considerations
463
+
464
+ ### 12.1 Delegation budgets are containment, not identity
465
+ These controls reduce blast radius but do not replace strong identity verification.
466
+
467
+ ### 12.2 Discovery minimization is not secrecy
468
+ Capability-gated discovery reduces unnecessary exposure, but a determined peer may still infer the existence of an agent through other means.
469
+
470
+ ### 12.3 Fleet management increases central leverage
471
+ Enterprise mode adds governance power, but also concentrates risk. Implementations SHOULD treat fleet brokers as high-value security boundaries.
472
+
473
+ ### 12.4 Rate limits must not create easy reflection attacks
474
+ Backoff hints SHOULD be modest and auditable. Implementations SHOULD avoid letting an attacker cause broad counterparty suppression through spoofed or unauthenticated messages.
475
+
476
+ ### 12.5 Transport scoping must be strict by default
477
+ If transport omission is interpreted loosely, this extension fails. Omission must resolve to narrow default scope, not broad scope.
478
+
479
+ ---
480
+
481
+ ## 13. Open Questions
482
+
483
+ - Should `capability_gated` discovery become the default for Agent Cards, or remain opt-in?
484
+ - Should proof-of-work ever be standardized beyond an optional extension?
485
+ - Should enterprise revocation feeds be pull-only, push-capable, or both?
486
+ - Should delegation issuance budgets be discoverable publicly, privately, or not at all?
487
+ - Should fleet-managed mode define an org-level Agent Card schema, or remain a per-agent add-on?
488
+
489
+ ---
490
+
491
+ ## Appendix A: Research Notes
492
+
493
+ The following external sources informed this extension:
494
+
495
+ - Techzine, “Securing agentic AI is still about getting the basics right”
496
+ Link: https://www.techzine.eu/blogs/security/140064/securing-agentic-ai-is-still-about-getting-the-basics-right
497
+ - Microsoft Security, Zero Trust strategy overview
498
+ Link: https://www.microsoft.com/en-us/security/business/zero-trust
499
+ - Microsoft Security Blog, “New tools and guidance: Announcing Zero Trust for AI”
500
+ Link: https://www.microsoft.com/en-us/security/blog/2026/03/19/new-tools-and-guidance-announcing-zero-trust-for-ai/
501
+ - Microsoft Security Blog, “Microsoft extends Zero Trust to secure the agentic workforce”
502
+ Link: https://www.microsoft.com/en-us/security/blog/2025/05/19/microsoft-extends-zero-trust-to-secure-the-agentic-workforce/
503
+
504
+ Summary:
505
+ - agentic systems still fail on ordinary access-control and containment mistakes
506
+ - identity and signing are necessary but not sufficient
507
+ - least privilege must include transport, lifecycle, and visibility controls
508
+ - enterprise deployments often need stronger lifecycle and offboarding governance than purely self-sovereign mode provides