@aporthq/aport-agent-guardrails 1.0.8

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 (237) hide show
  1. package/LICENSE +217 -0
  2. package/README.md +481 -0
  3. package/bin/agent-guardrails +133 -0
  4. package/bin/aport-create-passport.sh +444 -0
  5. package/bin/aport-cursor-hook.sh +90 -0
  6. package/bin/aport-guardrail-api.sh +108 -0
  7. package/bin/aport-guardrail-bash.sh +394 -0
  8. package/bin/aport-guardrail-v2.sh +5 -0
  9. package/bin/aport-guardrail.sh +5 -0
  10. package/bin/aport-resolve-paths.sh +71 -0
  11. package/bin/aport-status.sh +276 -0
  12. package/bin/frameworks/crewai.sh +49 -0
  13. package/bin/frameworks/cursor.sh +95 -0
  14. package/bin/frameworks/langchain.sh +48 -0
  15. package/bin/frameworks/n8n.sh +36 -0
  16. package/bin/frameworks/openclaw.sh +19 -0
  17. package/bin/lib/allowlist.sh +18 -0
  18. package/bin/lib/common.sh +28 -0
  19. package/bin/lib/config.sh +46 -0
  20. package/bin/lib/constants.sh +232 -0
  21. package/bin/lib/detect.sh +65 -0
  22. package/bin/lib/error.sh +269 -0
  23. package/bin/lib/passport.sh +19 -0
  24. package/bin/lib/templates/.gitkeep +1 -0
  25. package/bin/lib/templates/config.yaml +6 -0
  26. package/bin/lib/validation.sh +206 -0
  27. package/bin/openclaw +660 -0
  28. package/docs/ADDING_A_FRAMEWORK.md +87 -0
  29. package/docs/AGENTS.md.example +40 -0
  30. package/docs/CODE_REVIEW.md +192 -0
  31. package/docs/DEPLOYMENT_READINESS.md +81 -0
  32. package/docs/FAQ_SECURITY_SCANNERS.md +373 -0
  33. package/docs/FRAMEWORK_ROADMAP.md +41 -0
  34. package/docs/HOSTED_PASSPORT_SETUP.md +362 -0
  35. package/docs/IMPLEMENTING_YOUR_OWN_EVALUATOR.md +433 -0
  36. package/docs/OPENCLAW_COMPATIBILITY.md +73 -0
  37. package/docs/OPENCLAW_LOCAL_INTEGRATION.md +596 -0
  38. package/docs/OPENCLAW_TOOLS_AND_POLICIES.md +54 -0
  39. package/docs/QUICKSTART.md +470 -0
  40. package/docs/QUICKSTART_OPENCLAW_PLUGIN.md +470 -0
  41. package/docs/README.md +28 -0
  42. package/docs/RELEASE.md +87 -0
  43. package/docs/REPO_LAYOUT.md +47 -0
  44. package/docs/SKILLS_ECOSYSTEM_ANALYSIS_FEB17.md +1260 -0
  45. package/docs/TOOL_POLICY_MAPPING.md +46 -0
  46. package/docs/UPGRADE.md +46 -0
  47. package/docs/VERIFICATION_METHODS.md +97 -0
  48. package/docs/assets/README.md +8 -0
  49. package/docs/assets/porter.svg +54 -0
  50. package/docs/development/ERROR_CODES.md +616 -0
  51. package/docs/frameworks/GITHUB_ISSUE_PROPOSALS.md +1105 -0
  52. package/docs/frameworks/crewai.md +114 -0
  53. package/docs/frameworks/cursor.md +159 -0
  54. package/docs/frameworks/langchain.md +72 -0
  55. package/docs/frameworks/n8n.md +40 -0
  56. package/docs/frameworks/openclaw.md +40 -0
  57. package/docs/launch/ADD_APORT_AWESOME_LISTS_INSTRUCTIONS.md +146 -0
  58. package/docs/launch/ANNOUNCEMENT_GUIDE.md +266 -0
  59. package/docs/launch/AWESOME_REPOS.md +53 -0
  60. package/docs/launch/CURSOR_VSCODE_HOOKS_RESEARCH.md +77 -0
  61. package/docs/launch/DEMO_TERMINAL_OUTPUT.txt +48 -0
  62. package/docs/launch/DRY_AND_PLAN_CHECKLIST.md +47 -0
  63. package/docs/launch/EVIDENCE_README.md +61 -0
  64. package/docs/launch/EVIDENCE_TERMINAL_CAPTURE.txt +10 -0
  65. package/docs/launch/FRAMEWORK_SUPPORT_PLAN.md +1640 -0
  66. package/docs/launch/LAUNCH_READINESS_CHECKLIST.md +237 -0
  67. package/docs/launch/LAUNCH_STRATEGY_SUMMARY.md +464 -0
  68. package/docs/launch/OPENCLAW_FEEDBACK_AND_FIXES.md +85 -0
  69. package/docs/launch/POST_1_VALENTINE_IMPROVED.md +233 -0
  70. package/docs/launch/POST_2_GUARDRAIL_IMPROVED.md +369 -0
  71. package/docs/launch/PRE_LAUNCH_FIXES.md +766 -0
  72. package/docs/launch/QUICK_LAUNCH_CHECKLIST.md +400 -0
  73. package/docs/launch/READINESS_SUMMARY.md +262 -0
  74. package/docs/launch/README.md +68 -0
  75. package/docs/launch/USER_STORIES.md +327 -0
  76. package/docs/launch/scripts/add-aport-awesome-pr.sh +69 -0
  77. package/docs/operations/MONITORING.md +588 -0
  78. package/docs/reviews/2026-02-18-staff-review.md +268 -0
  79. package/extensions/openclaw-aport/README.md +415 -0
  80. package/extensions/openclaw-aport/index.js +625 -0
  81. package/extensions/openclaw-aport/openclaw-aport.js +7 -0
  82. package/extensions/openclaw-aport/openclaw.plugin.json +46 -0
  83. package/extensions/openclaw-aport/package.json +36 -0
  84. package/extensions/openclaw-aport/test.js +307 -0
  85. package/external/aport-policies/README.md +363 -0
  86. package/external/aport-policies/agent.session.create.v1/README.md +345 -0
  87. package/external/aport-policies/agent.session.create.v1/policy.json +162 -0
  88. package/external/aport-policies/agent.tool.register.v1/README.md +361 -0
  89. package/external/aport-policies/agent.tool.register.v1/policy.json +172 -0
  90. package/external/aport-policies/code.release.publish.v1/README.md +51 -0
  91. package/external/aport-policies/code.release.publish.v1/policy.json +121 -0
  92. package/external/aport-policies/code.repository.merge.v1/README.md +287 -0
  93. package/external/aport-policies/code.repository.merge.v1/express.example.js +332 -0
  94. package/external/aport-policies/code.repository.merge.v1/fastapi.example.py +370 -0
  95. package/external/aport-policies/code.repository.merge.v1/policy.json +162 -0
  96. package/external/aport-policies/data.export.create.v1/README.md +226 -0
  97. package/external/aport-policies/data.export.create.v1/express.example.js +172 -0
  98. package/external/aport-policies/data.export.create.v1/fastapi.example.py +165 -0
  99. package/external/aport-policies/data.export.create.v1/policy.json +133 -0
  100. package/external/aport-policies/data.report.ingest.v1/README.md +134 -0
  101. package/external/aport-policies/data.report.ingest.v1/express.example.js +105 -0
  102. package/external/aport-policies/data.report.ingest.v1/minimal-example.js +68 -0
  103. package/external/aport-policies/data.report.ingest.v1/policy.json +174 -0
  104. package/external/aport-policies/finance.crypto.trade.v1/README.md +146 -0
  105. package/external/aport-policies/finance.crypto.trade.v1/express.example.js +109 -0
  106. package/external/aport-policies/finance.crypto.trade.v1/minimal-example.js +65 -0
  107. package/external/aport-policies/finance.crypto.trade.v1/policy.json +176 -0
  108. package/external/aport-policies/finance.payment.charge.v1/README.md +326 -0
  109. package/external/aport-policies/finance.payment.charge.v1/express.example.js +250 -0
  110. package/external/aport-policies/finance.payment.charge.v1/fastapi.example.py +227 -0
  111. package/external/aport-policies/finance.payment.charge.v1/minimal-example.js +64 -0
  112. package/external/aport-policies/finance.payment.charge.v1/policy.json +224 -0
  113. package/external/aport-policies/finance.payment.charge.v1/tests/contexts.jsonl +12 -0
  114. package/external/aport-policies/finance.payment.charge.v1/tests/expected.jsonl +12 -0
  115. package/external/aport-policies/finance.payment.charge.v1/tests/passport.instance.json +42 -0
  116. package/external/aport-policies/finance.payment.charge.v1/tests/passport.template.json +40 -0
  117. package/external/aport-policies/finance.payment.charge.v1/tests/payments-charge-policy.test.js +817 -0
  118. package/external/aport-policies/finance.payment.charge.v1/tests/test_payments_charge_policy.py +486 -0
  119. package/external/aport-policies/finance.payment.payout.v1/README.md +78 -0
  120. package/external/aport-policies/finance.payment.payout.v1/policy.json +181 -0
  121. package/external/aport-policies/finance.payment.refund.v1/README.md +275 -0
  122. package/external/aport-policies/finance.payment.refund.v1/express.example.js +167 -0
  123. package/external/aport-policies/finance.payment.refund.v1/fastapi.example.py +136 -0
  124. package/external/aport-policies/finance.payment.refund.v1/minimal-example.js +183 -0
  125. package/external/aport-policies/finance.payment.refund.v1/policy.json +216 -0
  126. package/external/aport-policies/finance.payment.refund.v1/tests/refunds-policy.test.js +924 -0
  127. package/external/aport-policies/finance.payment.refund.v1/tests/test_refunds_policy.py +778 -0
  128. package/external/aport-policies/finance.transaction.execute.v1/README.md +309 -0
  129. package/external/aport-policies/finance.transaction.execute.v1/express.example.js +261 -0
  130. package/external/aport-policies/finance.transaction.execute.v1/fastapi.example.py +231 -0
  131. package/external/aport-policies/finance.transaction.execute.v1/minimal-example.js +78 -0
  132. package/external/aport-policies/finance.transaction.execute.v1/policy.json +189 -0
  133. package/external/aport-policies/finance.transaction.execute.v1/tests/contexts.jsonl +12 -0
  134. package/external/aport-policies/finance.transaction.execute.v1/tests/expected.jsonl +12 -0
  135. package/external/aport-policies/finance.transaction.execute.v1/tests/passport.instance.json +42 -0
  136. package/external/aport-policies/finance.transaction.execute.v1/tests/passport.template.json +42 -0
  137. package/external/aport-policies/finance.transaction.execute.v1/tests/test_transactions_policy.py +214 -0
  138. package/external/aport-policies/finance.transaction.execute.v1/tests/transactions-policy.test.js +306 -0
  139. package/external/aport-policies/governance.data.access.v1/README.md +292 -0
  140. package/external/aport-policies/governance.data.access.v1/express.example.js +321 -0
  141. package/external/aport-policies/governance.data.access.v1/fastapi.example.py +279 -0
  142. package/external/aport-policies/governance.data.access.v1/minimal-example.js +65 -0
  143. package/external/aport-policies/governance.data.access.v1/policy.json +208 -0
  144. package/external/aport-policies/governance.data.access.v1/tests/contexts.jsonl +12 -0
  145. package/external/aport-policies/governance.data.access.v1/tests/data-access-policy.test.js +308 -0
  146. package/external/aport-policies/governance.data.access.v1/tests/expected.jsonl +12 -0
  147. package/external/aport-policies/governance.data.access.v1/tests/passport.instance.json +56 -0
  148. package/external/aport-policies/governance.data.access.v1/tests/passport.template.json +56 -0
  149. package/external/aport-policies/governance.data.access.v1/tests/test_data_access_policy.py +214 -0
  150. package/external/aport-policies/legal.contract.review.v1/README.md +109 -0
  151. package/external/aport-policies/legal.contract.review.v1/policy.json +378 -0
  152. package/external/aport-policies/legal.contract.review.v1/tests/legal-contract-review-policy.test.js +609 -0
  153. package/external/aport-policies/legal.contract.review.v1/tests/passport.template.json +49 -0
  154. package/external/aport-policies/mcp.tool.execute.v1/README.md +301 -0
  155. package/external/aport-policies/mcp.tool.execute.v1/policy.json +141 -0
  156. package/external/aport-policies/messaging.message.send.v1/README.md +230 -0
  157. package/external/aport-policies/messaging.message.send.v1/express.example.js +183 -0
  158. package/external/aport-policies/messaging.message.send.v1/fastapi.example.py +193 -0
  159. package/external/aport-policies/messaging.message.send.v1/policy.json +144 -0
  160. package/external/aport-policies/policy-template.json +107 -0
  161. package/external/aport-policies/system.command.execute.v1/README.md +275 -0
  162. package/external/aport-policies/system.command.execute.v1/policy.json +146 -0
  163. package/external/aport-spec/CONTRIBUTING.md +273 -0
  164. package/external/aport-spec/LICENSE +21 -0
  165. package/external/aport-spec/README.md +168 -0
  166. package/external/aport-spec/conformance/README.md +294 -0
  167. package/external/aport-spec/conformance/cases/data.export.v1/contexts/allow_users.json +6 -0
  168. package/external/aport-spec/conformance/cases/data.export.v1/contexts/deny_pii.json +6 -0
  169. package/external/aport-spec/conformance/cases/data.export.v1/expected/allow_users.decision.json +19 -0
  170. package/external/aport-spec/conformance/cases/data.export.v1/expected/deny_pii.decision.json +19 -0
  171. package/external/aport-spec/conformance/cases/data.export.v1/passports/template.json +29 -0
  172. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/allow_50usd.json +9 -0
  173. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/deny_150usd.json +9 -0
  174. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/deny_currency.json +9 -0
  175. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/allow_50usd.decision.json +19 -0
  176. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/deny_150usd.decision.json +19 -0
  177. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/deny_currency.decision.json +19 -0
  178. package/external/aport-spec/conformance/cases/payments.refunds.v1/passports/template.json +42 -0
  179. package/external/aport-spec/conformance/package.json +44 -0
  180. package/external/aport-spec/conformance/pnpm-lock.yaml +642 -0
  181. package/external/aport-spec/conformance/src/cases.ts +371 -0
  182. package/external/aport-spec/conformance/src/ed25519.ts +167 -0
  183. package/external/aport-spec/conformance/src/jcs.ts +85 -0
  184. package/external/aport-spec/conformance/src/runner.ts +533 -0
  185. package/external/aport-spec/conformance/src/validators.ts +185 -0
  186. package/external/aport-spec/conformance/test-runner.js +315 -0
  187. package/external/aport-spec/conformance/tsconfig.json +21 -0
  188. package/external/aport-spec/error-schema.json +192 -0
  189. package/external/aport-spec/index.json +12 -0
  190. package/external/aport-spec/integrations/clawmoat/README.md +12 -0
  191. package/external/aport-spec/integrations/shield/README.md +245 -0
  192. package/external/aport-spec/integrations/shield/adapters/index.js +116 -0
  193. package/external/aport-spec/integrations/shield/adapters/system-command-execute.js +133 -0
  194. package/external/aport-spec/integrations/shield/test/README.md +58 -0
  195. package/external/aport-spec/integrations/shield/test/shield.md +40 -0
  196. package/external/aport-spec/integrations/shield/test/test-shield-to-verify.js +274 -0
  197. package/external/aport-spec/metrics-schema.json +504 -0
  198. package/external/aport-spec/oap/CHANGELOG.md +54 -0
  199. package/external/aport-spec/oap/VERSION.md +40 -0
  200. package/external/aport-spec/oap/capability-registry.md +229 -0
  201. package/external/aport-spec/oap/conformance.md +257 -0
  202. package/external/aport-spec/oap/decision-schema.json +114 -0
  203. package/external/aport-spec/oap/examples/context.refund.usd.50.json +9 -0
  204. package/external/aport-spec/oap/examples/decision.allow.sample.json +20 -0
  205. package/external/aport-spec/oap/examples/decision.deny.sample.json +23 -0
  206. package/external/aport-spec/oap/examples/passport.instance.v1.json +50 -0
  207. package/external/aport-spec/oap/examples/passport.template.v1.json +71 -0
  208. package/external/aport-spec/oap/oap-spec.md +426 -0
  209. package/external/aport-spec/oap/passport-schema.json +396 -0
  210. package/external/aport-spec/oap/security.md +213 -0
  211. package/external/aport-spec/oap/vc/context-oap-v1.jsonld +137 -0
  212. package/external/aport-spec/oap/vc/examples/oap-decision-vc.json +37 -0
  213. package/external/aport-spec/oap/vc/examples/oap-passport-vc.json +68 -0
  214. package/external/aport-spec/oap/vc/tools/INTEGRATION.md +375 -0
  215. package/external/aport-spec/oap/vc/tools/README.md +278 -0
  216. package/external/aport-spec/oap/vc/tools/examples/decision-to-vc.js +66 -0
  217. package/external/aport-spec/oap/vc/tools/examples/passport-to-vc.js +83 -0
  218. package/external/aport-spec/oap/vc/tools/examples/vc-to-decision.js +77 -0
  219. package/external/aport-spec/oap/vc/tools/examples/vc-to-passport.js +94 -0
  220. package/external/aport-spec/oap/vc/tools/package.json +38 -0
  221. package/external/aport-spec/oap/vc/tools/pnpm-lock.yaml +472 -0
  222. package/external/aport-spec/oap/vc/tools/src/cli.ts +226 -0
  223. package/external/aport-spec/oap/vc/tools/src/crypto-utils.ts +427 -0
  224. package/external/aport-spec/oap/vc/tools/src/index.ts +653 -0
  225. package/external/aport-spec/oap/vc/tools/src/test.ts +148 -0
  226. package/external/aport-spec/oap/vc/tools/src/vp.ts +382 -0
  227. package/external/aport-spec/oap/vc/tools/test-simple.js +214 -0
  228. package/external/aport-spec/oap/vc/tools/tsconfig.json +19 -0
  229. package/external/aport-spec/oap/vc/vc-mapping.md +443 -0
  230. package/external/aport-spec/passport-schema.json +586 -0
  231. package/external/aport-spec/rate-limiting.md +136 -0
  232. package/external/aport-spec/transport-profile.md +325 -0
  233. package/external/aport-spec/webhook-spec.md +314 -0
  234. package/package.json +70 -0
  235. package/skills/aport-agent-guardrail/SKILL.md +314 -0
  236. package/src/evaluator.js +252 -0
  237. package/src/server/index.js +72 -0
@@ -0,0 +1,229 @@
1
+ # Open Agent Passport Capability Registry
2
+
3
+ ## Overview
4
+
5
+ The Open Agent Passport (OAP) Capability Registry defines standardized capabilities that can be granted to AI agents. Each capability includes:
6
+
7
+ - **Context fields**: Required input data for policy evaluation
8
+ - **Limits**: Configurable operational constraints
9
+ - **Deny codes**: Standardized error codes for policy violations
10
+
11
+ ## Capability Naming Convention
12
+
13
+ ### Format
14
+
15
+ Capabilities use a hierarchical namespace format: `category.action`
16
+
17
+ Examples:
18
+ - `finance.payment.refund` - Financial refund operations
19
+ - `data.export` - Data export operations
20
+ - `repo.release.publish` - Repository release operations
21
+
22
+ ## Policy Packs
23
+
24
+ ### Structure
25
+
26
+ Policy packs define the complete policy logic for one or more capabilities. They include:
27
+
28
+ - **Policy ID**: Unique identifier (e.g., `finance.payment.refund.v1`)
29
+ - **Required capabilities**: List of capabilities this pack handles
30
+ - **Minimum assurance**: Required assurance level
31
+ - **Context schema**: Expected input data structure
32
+ - **Limit schema**: Configurable limits structure
33
+ - **Deny codes**: Standardized error codes
34
+
35
+ ## Standard Policy Packs
36
+
37
+ ### finance.payment.refund.v1
38
+
39
+ ### finance.payment.refund.v1
40
+
41
+ **Purpose**: Protects financial refund operations with amount limits, currency controls, and idempotency requirements.
42
+
43
+ **Required Capability**: `finance.payment.refund`
44
+
45
+ **Minimum Assurance**: L2 (GitHub Verified)
46
+
47
+ **Context Fields**:
48
+ - `amount` (integer): Refund amount in minor units
49
+ - `currency` (string): ISO 4217 currency code
50
+ - `order_id` (string): Original order identifier
51
+ - `customer_id` (string): Customer identifier
52
+ - `reason_code` (string): Refund reason code
53
+ - `region` (string): Geographic region
54
+ - `idempotency_key` (string): Idempotency key for duplicate prevention
55
+
56
+ **Limits Structure**:
57
+ ```json
58
+ {
59
+ "finance.payment.refund": {
60
+ "currency_limits": {
61
+ "USD": {
62
+ "max_per_tx": 5000,
63
+ "daily_cap": 50000
64
+ },
65
+ "EUR": {
66
+ "max_per_tx": 4500,
67
+ "daily_cap": 45000
68
+ }
69
+ },
70
+ "reason_codes": ["customer_request", "defective_product", "fraud"],
71
+ "regions": ["US", "CA", "EU"],
72
+ "idempotency_required": true
73
+ }
74
+ }
75
+ ```
76
+
77
+ **Deny Codes**:
78
+ - `oap.limit_exceeded` - Transaction or daily limit exceeded
79
+ - `oap.currency_unsupported` - Currency not supported
80
+ - `oap.region_blocked` - Operation not allowed in this region
81
+ - `oap.invalid_reason` - Invalid reason code
82
+ - `oap.idempotency_conflict` - Idempotency key already used
83
+
84
+ ### data.export.create.v1
85
+
86
+ **Purpose**: Protects data export operations with row limits, PII controls, and collection restrictions.
87
+
88
+ **Required Capability**: `data.export`
89
+
90
+ **Minimum Assurance**: L1 (Email Verified)
91
+
92
+ **Context Fields**:
93
+ - `collection` (string): Data collection name
94
+ - `estimated_rows` (integer): Estimated number of rows
95
+ - `include_pii` (boolean): Whether to include PII data
96
+ - `region` (string): Geographic region
97
+
98
+ **Limits Structure**:
99
+ ```json
100
+ {
101
+ "data.export": {
102
+ "allowed_collections": ["users", "orders", "products"],
103
+ "max_rows": 100000,
104
+ "allow_pii": false,
105
+ "regions": ["US", "CA", "EU"]
106
+ }
107
+ }
108
+ ```
109
+
110
+ **Deny Codes**:
111
+ - `oap.pii_blocked` - PII export not allowed
112
+ - `oap.collection_forbidden` - Collection not in allowlist
113
+ - `oap.limit_exceeded` - Row limit exceeded
114
+
115
+ ### repo.release.publish.v1
116
+
117
+ **Purpose**: Protects repository release operations with branch controls, artifact verification, and rate limiting.
118
+
119
+ **Required Capability**: `repo.release.publish`
120
+
121
+ **Minimum Assurance**: L2 (GitHub Verified)
122
+
123
+ **Context Fields**:
124
+ - `repo` (string): Repository identifier
125
+ - `branch` (string): Source branch
126
+ - `tag` (string): Release tag
127
+ - `artifact_sha` (string): Artifact SHA-256 hash
128
+ - `signer` (string): Artifact signer identifier
129
+
130
+ **Limits Structure**:
131
+ ```json
132
+ {
133
+ "repo.release.publish": {
134
+ "allowed_branches": ["main", "develop"],
135
+ "allowed_repos": ["org/project1", "org/project2"],
136
+ "max_releases_per_day": 10,
137
+ "require_signed_artifacts": true
138
+ }
139
+ }
140
+ ```
141
+
142
+ **Deny Codes**:
143
+ - `oap.branch_forbidden` - Branch not in allowlist
144
+ - `oap.repo_forbidden` - Repository not in allowlist
145
+ - `oap.unsigned_artifact` - Artifact signature required
146
+ - `oap.limit_exceeded` - Daily release limit exceeded
147
+
148
+ ## Custom Capabilities
149
+
150
+ ### Definition Process
151
+
152
+ Organizations can define custom capabilities by:
153
+
154
+ 1. **Choosing a namespace**: Use your organization domain (e.g., `acme.inventory.update`)
155
+ 2. **Defining context fields**: Specify required input data
156
+ 3. **Defining limits**: Specify configurable constraints
157
+ 4. **Defining deny codes**: Specify error conditions
158
+ 5. **Creating policy pack**: Implement the policy logic
159
+
160
+ ### Example Custom Capability
161
+
162
+ ```json
163
+ {
164
+ "acme.inventory.update": {
165
+ "context_fields": {
166
+ "product_id": "string",
167
+ "quantity_change": "integer",
168
+ "warehouse_id": "string",
169
+ "reason": "string"
170
+ },
171
+ "limits": {
172
+ "max_quantity_change": 1000,
173
+ "allowed_warehouses": ["warehouse_1", "warehouse_2"],
174
+ "require_approval": true
175
+ },
176
+ "deny_codes": [
177
+ "acme.quantity_exceeded",
178
+ "acme.warehouse_forbidden",
179
+ "acme.approval_required"
180
+ ]
181
+ }
182
+ }
183
+ ```
184
+
185
+ ## Capability Lifecycle
186
+
187
+ ### Registration
188
+
189
+ ### Registration
190
+
191
+ 1. **Define capability**: Specify context fields, limits, and deny codes
192
+ 2. **Create policy pack**: Implement policy evaluation logic
193
+ 3. **Submit for review**: Submit to OAP registry for standardization
194
+ 4. **Publish**: Once approved, capability is published in the registry
195
+
196
+ ### Deprecation
197
+
198
+ 1. **Announce deprecation**: 12-month notice period
199
+ 2. **Mark deprecated**: Update registry with deprecation notice
200
+ 3. **Remove support**: After notice period, remove from registry
201
+
202
+ ## Registry Access
203
+
204
+ ### Endpoints
205
+
206
+ The capability registry is available at:
207
+ - **Current version**: `https://github.com/aporthq/aport-spec/oap/capabilities.json`
208
+ - **Latest version**: `https://github.com/aporthq/aport-spec/oap/capabilities/latest.json`
209
+ - **Specific version**: `https://github.com/aporthq/aport-spec/oap/capabilities/v1.0.json`
210
+
211
+ ## Contributing
212
+
213
+ ### Process
214
+
215
+ To contribute new capabilities:
216
+
217
+ 1. **Fork the specification repository**
218
+ 2. **Create capability definition** following the standard format
219
+ 3. **Implement policy pack** with test cases
220
+ 4. **Submit pull request** with capability and policy pack
221
+ 5. **Address feedback** and iterate until approved
222
+ 6. **Merge and publish** once approved
223
+
224
+ ## References
225
+
226
+ - [OAP Specification](./oap-spec.md)
227
+ - [Passport Schema](./passport-schema.json)
228
+ - [Decision Schema](./decision-schema.json)
229
+ - [Security Guidelines](./security.md)
@@ -0,0 +1,257 @@
1
+ # Open Agent Passport Conformance
2
+
3
+ ## Overview
4
+
5
+ This document defines the conformance requirements for Open Agent Passport (OAP) implementations. Conformance ensures interoperability and security across different implementations.
6
+
7
+ ## Conformance Levels
8
+
9
+ ### Basic Conformance
10
+
11
+ Basic conformance requires:
12
+
13
+ 1. **Schema validation**: Validate passports against `passport-schema.json`
14
+ 2. **Decision generation**: Generate decisions matching `decision-schema.json`
15
+ 3. **Signature verification**: Verify Ed25519 signatures on decisions
16
+ 4. **Error handling**: Return standardized error codes
17
+
18
+ ### Full Conformance
19
+
20
+ Full conformance requires all basic conformance requirements plus:
21
+
22
+ 1. **Policy evaluation**: Implement policy pack evaluation logic
23
+ 2. **JCS canonicalization**: Use RFC 8785 for canonicalization
24
+ 3. **Key resolution**: Resolve keys via `/.well-known/oap/keys.json`
25
+ 4. **Suspend semantics**: Implement 30-second global invalidation
26
+ 5. **Performance**: Meet performance requirements (see below)
27
+
28
+ ## Implementation Requirements
29
+
30
+ ### Passport Validation
31
+
32
+ Implementations MUST:
33
+
34
+ 1. **Validate schema**: Ensure passport matches `passport-schema.json`
35
+ 2. **Check required fields**: Verify all required fields are present
36
+ 3. **Validate formats**: Check UUID, date-time, and enum formats
37
+ 4. **Verify assurance**: Ensure assurance level is valid
38
+ 5. **Check status**: Validate status transitions (draft → active → suspended/revoked)
39
+
40
+ #### Status State Machine
41
+
42
+ ```
43
+ draft → active → suspended → active
44
+ ↓ ↓ ↓
45
+ revoked revoked revoked
46
+ ```
47
+
48
+ ### Decision Generation
49
+
50
+ Implementations MUST:
51
+
52
+ 1. **Generate decision_id**: Create unique UUID v4 for each decision
53
+ 2. **Include all required fields**: Populate all required decision fields
54
+ 3. **Set expiration**: Set `expires_at` based on policy and context
55
+ 4. **Compute digest**: Calculate `passport_digest` using SHA-256(JCS(passport))
56
+ 5. **Sign decision**: Create Ed25519 signature over JCS-canonicalized decision
57
+ 6. **Set kid**: Include proper key identifier
58
+
59
+ ### Policy Evaluation
60
+
61
+ Implementations MUST:
62
+
63
+ 1. **Load policy pack**: Retrieve policy pack by ID
64
+ 2. **Validate context**: Check context against policy requirements
65
+ 3. **Check capabilities**: Verify passport has required capabilities
66
+ 4. **Validate limits**: Ensure operation within configured limits
67
+ 5. **Check assurance**: Verify assurance level meets minimum requirement
68
+ 6. **Check regions**: Validate operation is allowed in request region
69
+ 7. **Generate reasons**: Create appropriate reason codes and messages
70
+
71
+ ### Signature Verification
72
+
73
+ Implementations MUST:
74
+
75
+ 1. **Parse signature**: Extract Ed25519 signature from decision
76
+ 2. **Resolve key**: Fetch public key using `kid` and `/.well-known/oap/keys.json`
77
+ 3. **Canonicalize**: Apply JCS canonicalization to decision payload
78
+ 4. **Verify signature**: Use Ed25519 to verify signature
79
+ 5. **Check expiration**: Ensure decision hasn't expired
80
+ 6. **Validate digest**: Verify passport digest matches
81
+
82
+ ### Error Handling
83
+
84
+ Implementations MUST:
85
+
86
+ 1. **Return standard codes**: Use normative error codes from specification
87
+ 2. **Include context**: Provide relevant context in error messages
88
+ 3. **Log errors**: Log all errors for debugging and monitoring
89
+ 4. **Handle gracefully**: Don't expose internal implementation details
90
+
91
+ #### Standard Error Codes
92
+
93
+ - `oap.invalid_context` - Context data is invalid
94
+ - `oap.unknown_capability` - Capability not recognized
95
+ - `oap.limit_exceeded` - Operation exceeds limits
96
+ - `oap.currency_unsupported` - Currency not supported
97
+ - `oap.region_blocked` - Operation not allowed in region
98
+ - `oap.assurance_insufficient` - Assurance level too low
99
+ - `oap.passport_suspended` - Passport is suspended/revoked
100
+ - `oap.idempotency_conflict` - Idempotency key conflict
101
+ - `oap.policy_error` - Policy evaluation error
102
+
103
+ ## Performance Requirements
104
+
105
+ ### Response Times
106
+
107
+ Implementations SHOULD meet these performance targets:
108
+
109
+ - **Passport verification**: ≤ 100ms (95th percentile)
110
+ - **Policy evaluation**: ≤ 200ms (95th percentile)
111
+ - **Decision generation**: ≤ 300ms (95th percentile)
112
+ - **Signature verification**: ≤ 50ms (95th percentile)
113
+
114
+ ### Throughput
115
+
116
+ Implementations SHOULD support:
117
+
118
+ - **Decision rate**: ≥ 1000 decisions/second
119
+ - **Concurrent requests**: ≥ 100 concurrent requests
120
+ - **Cache hit rate**: ≥ 95% for passport lookups
121
+
122
+ ### Scalability
123
+
124
+ Implementations SHOULD:
125
+
126
+ 1. **Horizontal scaling**: Support multiple instances
127
+ 2. **Load balancing**: Distribute load across instances
128
+ 3. **Caching**: Implement multi-level caching
129
+ 4. **Database optimization**: Use appropriate indexes and queries
130
+
131
+ ## Test Requirements
132
+
133
+ ### Conformance Tests
134
+
135
+ Implementations MUST pass all conformance tests:
136
+
137
+ 1. **Schema validation tests**: Test valid and invalid passports
138
+ 2. **Decision generation tests**: Test decision creation and validation
139
+ 3. **Signature tests**: Test signature creation and verification
140
+ 4. **Policy tests**: Test policy pack evaluation
141
+ 5. **Error handling tests**: Test error conditions and responses
142
+ 6. **Performance tests**: Test response times and throughput
143
+
144
+ ### Test Vectors
145
+
146
+ Test vectors are provided in the `/conformance` directory:
147
+
148
+ - **Passport examples**: Valid and invalid passport samples
149
+ - **Context data**: Policy evaluation context samples
150
+ - **Expected decisions**: Expected decision outputs
151
+ - **Signature tests**: Signature creation and verification tests
152
+
153
+ ### Running Tests
154
+
155
+ ```bash
156
+
157
+ # Install dependencies
158
+ npm install
159
+
160
+ # Run all tests
161
+ npm test
162
+
163
+ # Run specific test suite
164
+ npm test -- --suite finance.payment.refund.v1
165
+
166
+ # Run performance tests
167
+ npm test -- --suite performance
168
+ ```
169
+
170
+ ## Security Requirements
171
+
172
+ ### Cryptographic Security
173
+
174
+ Implementations MUST:
175
+
176
+ 1. **Use Ed25519**: Use Ed25519 for all signatures
177
+ 2. **Secure random**: Use cryptographically secure random for UUIDs
178
+ 3. **Key management**: Implement secure key storage and rotation
179
+ 4. **HTTPS**: Use HTTPS for all network communication
180
+ 5. **Certificate validation**: Validate TLS certificates properly
181
+
182
+ ### Data Protection
183
+
184
+ Implementations MUST:
185
+
186
+ 1. **Encrypt sensitive data**: Encrypt passports and decisions at rest
187
+ 2. **Access controls**: Implement proper access controls
188
+ 3. **Audit logging**: Log all security-relevant events
189
+ 4. **Data retention**: Implement appropriate data retention policies
190
+
191
+ ## Interoperability
192
+
193
+ ### Standard Compliance
194
+
195
+ Implementations MUST:
196
+
197
+ 1. **Follow specifications**: Implement all normative requirements
198
+ 2. **Use standard formats**: Use standard JSON and UUID formats
199
+ 3. **Support standard capabilities**: Support all standard capabilities
200
+ 4. **Handle extensions**: Gracefully handle unknown fields and capabilities
201
+
202
+ ### Cross-Implementation Testing
203
+
204
+ Implementations SHOULD:
205
+
206
+ 1. **Test with other implementations**: Verify interoperability
207
+ 2. **Share test results**: Publish conformance test results
208
+ 3. **Report issues**: Report interoperability issues
209
+ 4. **Contribute tests**: Contribute additional test cases
210
+
211
+ ## Certification
212
+
213
+ ### Self-Certification
214
+
215
+ Implementations can self-certify by:
216
+
217
+ 1. **Running conformance tests**: Pass all required tests
218
+ 2. **Documenting compliance**: Document conformance to requirements
219
+ 3. **Publishing results**: Publish test results publicly
220
+ 4. **Maintaining compliance**: Keep implementation up to date
221
+
222
+ ### Third-Party Certification
223
+
224
+ For higher assurance, implementations can seek third-party certification:
225
+
226
+ 1. **Security audit**: Independent security review
227
+ 2. **Performance testing**: Independent performance validation
228
+ 3. **Compliance review**: Independent conformance verification
229
+ 4. **Certification mark**: Use official OAP certification mark
230
+
231
+ ## Compliance Monitoring
232
+
233
+ ### Continuous Monitoring
234
+
235
+ Implementations SHOULD:
236
+
237
+ 1. **Monitor performance**: Track response times and throughput
238
+ 2. **Monitor errors**: Track error rates and types
239
+ 3. **Monitor security**: Track security events and anomalies
240
+ 4. **Monitor compliance**: Track conformance to requirements
241
+
242
+ ### Reporting
243
+
244
+ Implementations SHOULD:
245
+
246
+ 1. **Regular reports**: Publish regular compliance reports
247
+ 2. **Incident reporting**: Report security incidents promptly
248
+ 3. **Update notifications**: Notify users of updates and changes
249
+ 4. **Deprecation notices**: Provide advance notice of deprecations
250
+
251
+ ## References
252
+
253
+ - [OAP Specification](./oap-spec.md)
254
+ - [Passport Schema](./passport-schema.json)
255
+ - [Decision Schema](./decision-schema.json)
256
+ - [Security Guidelines](./security.md)
257
+ - [Capability Registry](./capability-registry.md)
@@ -0,0 +1,114 @@
1
+ {
2
+ "$id": "https://github.com/aporthq/aport-spec/oap/decision-schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Open Agent Passport Decision",
5
+ "description": "Schema for Open Agent Passport (OAP) v1.0 decision objects",
6
+ "type": "object",
7
+ "required": [
8
+ "decision_id",
9
+ "passport_id",
10
+ "policy_id",
11
+ "owner_id",
12
+ "assurance_level",
13
+ "allow",
14
+ "reasons",
15
+ "issued_at",
16
+ "expires_at",
17
+ "passport_digest",
18
+ "signature",
19
+ "kid"
20
+ ],
21
+ "properties": {
22
+ "decision_id": {
23
+ "type": "string",
24
+ "format": "uuid",
25
+ "description": "Unique identifier for the decision (UUID v4)",
26
+ "example": "550e8400-e29b-41d4-a716-446655440000"
27
+ },
28
+ "policy_id": {
29
+ "type": "string",
30
+ "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*\\.v[0-9]+$",
31
+ "description": "Policy pack identifier",
32
+ "example": "finance.payment.refund.v1"
33
+ },
34
+ "agent_id": {
35
+ "type": "string",
36
+ "format": "uuid",
37
+ "description": "Agent ID that was evaluated",
38
+ "example": "550e8400-e29b-41d4-a716-446655440001"
39
+ },
40
+ "owner_id": {
41
+ "type": "string",
42
+ "description": "Owner ID from the passport",
43
+ "example": "org_12345678"
44
+ },
45
+ "assurance_level": {
46
+ "type": "string",
47
+ "enum": ["L0", "L1", "L2", "L3", "L4KYC", "L4FIN"],
48
+ "description": "Assurance level from the passport",
49
+ "example": "L2"
50
+ },
51
+ "allow": {
52
+ "type": "boolean",
53
+ "description": "Whether the action is allowed",
54
+ "example": true
55
+ },
56
+ "reasons": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "object",
60
+ "required": ["code"],
61
+ "properties": {
62
+ "code": {
63
+ "type": "string",
64
+ "description": "Error or success code",
65
+ "example": "oap.limit_exceeded"
66
+ },
67
+ "message": {
68
+ "type": "string",
69
+ "description": "Human-readable message",
70
+ "example": "Transaction amount exceeds daily limit"
71
+ }
72
+ }
73
+ },
74
+ "description": "Array of reasons for the decision",
75
+ "minItems": 1
76
+ },
77
+ "created_at": {
78
+ "type": "string",
79
+ "format": "date-time",
80
+ "description": "When the decision was created",
81
+ "example": "2024-01-15T10:30:00Z"
82
+ },
83
+ "expires_in": {
84
+ "type": "integer",
85
+ "minimum": 0,
86
+ "description": "Number of seconds until the decision expires",
87
+ "example": 3600
88
+ },
89
+ "passport_digest": {
90
+ "type": "string",
91
+ "pattern": "^sha256:[a-f0-9]{64}$",
92
+ "description": "SHA-256 hash of JCS-canonicalized passport view",
93
+ "example": "sha256:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef"
94
+ },
95
+ "signature": {
96
+ "type": "string",
97
+ "pattern": "^ed25519:[A-Za-z0-9+/=]+$",
98
+ "description": "Ed25519 signature over JCS-canonicalized decision payload",
99
+ "example": "ed25519:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef=="
100
+ },
101
+ "kid": {
102
+ "type": "string",
103
+ "pattern": "^oap:(registry|owner):[a-zA-Z0-9._-]+$",
104
+ "description": "Key identifier for signature verification",
105
+ "example": "oap:registry:key-2025-01"
106
+ },
107
+ "decision_token": {
108
+ "type": "string",
109
+ "description": "Optional compact JWT for sub-TTL caching",
110
+ "example": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9..."
111
+ }
112
+ },
113
+ "additionalProperties": false
114
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "amount": 5000,
3
+ "currency": "USD",
4
+ "order_id": "order_123456789",
5
+ "customer_id": "cust_987654321",
6
+ "reason_code": "customer_request",
7
+ "region": "US",
8
+ "idempotency_key": "refund_20240115_001"
9
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "decision_id": "550e8400-e29b-41d4-a716-446655440002",
3
+ "policy_id": "finance.payment.refund.v1",
4
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
5
+ "owner_id": "org_87654321",
6
+ "assurance_level": "L3",
7
+ "allow": true,
8
+ "reasons": [
9
+ {
10
+ "code": "oap.allowed",
11
+ "message": "Transaction within limits and policy requirements"
12
+ }
13
+ ],
14
+ "created_at": "2024-01-15T10:30:00Z",
15
+ "expires_in": 3600,
16
+ "passport_digest": "sha256:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef",
17
+ "signature": "ed25519:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef==",
18
+ "kid": "oap:registry:key-2025-01",
19
+ "decision_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZWNpc2lvbl9pZCI6IjU1MGU4NDAwLWUyOWItNDFkNC1hNzE2LTQ0NjY1NTQ0MDAwMiIsInBvbGljeV9pZCI6InBheW1lbnRzLnJlZnVuZC52MSIsInBhc3Nwb3J0X2lkIjoiNTUwZTg0MDAtZTI5Yi00MWQ0LWE3MTYtNDQ2NjU1NDQwMDAxIiwib3duZXJfaWQiOiJvcmdfODc2NTQzMjEiLCJhbGxvd190cnVlIiwiaXNzdWVkX2F0IjoiMjAyNC0wMS0xNVQxMDozMDowMFoiLCJleHBpcmVzX2F0IjoiMjAyNC0wMS0xNVQxMTozMDowMFoifQ.signature"
20
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "decision_id": "550e8400-e29b-41d4-a716-446655440003",
3
+ "policy_id": "finance.payment.refund.v1",
4
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
5
+ "owner_id": "org_87654321",
6
+ "assurance_level": "L3",
7
+ "allow": false,
8
+ "reasons": [
9
+ {
10
+ "code": "oap.limit_exceeded",
11
+ "message": "Transaction amount exceeds daily limit"
12
+ },
13
+ {
14
+ "code": "oap.currency_unsupported",
15
+ "message": "Currency JPY not supported for this passport"
16
+ }
17
+ ],
18
+ "created_at": "2024-01-15T10:30:00Z",
19
+ "expires_in": 3600,
20
+ "passport_digest": "sha256:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef",
21
+ "signature": "ed25519:efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdefabcd1234==",
22
+ "kid": "oap:registry:key-2025-01"
23
+ }