@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,396 @@
1
+ {
2
+ "$id": "https://github.com/aporthq/aport-spec/oap/passport-schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Open Agent Passport",
5
+ "description": "Schema for Open Agent Passport (OAP) v1.0 passport objects",
6
+ "type": "object",
7
+ "required": [
8
+ "passport_id",
9
+ "kind",
10
+ "spec_version",
11
+ "owner_id",
12
+ "owner_type",
13
+ "status",
14
+ "assurance_level",
15
+ "capabilities",
16
+ "limits",
17
+ "regions",
18
+ "created_at",
19
+ "updated_at",
20
+ "version"
21
+ ],
22
+ "properties": {
23
+ "passport_id": {
24
+ "type": "string",
25
+ "format": "uuid",
26
+ "description": "Unique identifier for the passport (UUID v4)",
27
+ "example": "550e8400-e29b-41d4-a716-446655440000"
28
+ },
29
+ "kind": {
30
+ "type": "string",
31
+ "enum": ["template", "instance"],
32
+ "description": "Type of passport - template (canonical identity) or instance (tenant-specific)",
33
+ "example": "template"
34
+ },
35
+ "spec_version": {
36
+ "type": "string",
37
+ "const": "oap/1.0",
38
+ "description": "OAP specification version",
39
+ "example": "oap/1.0"
40
+ },
41
+ "template_id": {
42
+ "type": "string",
43
+ "format": "uuid",
44
+ "description": "Template passport ID (required for instances)",
45
+ "example": "550e8400-e29b-41d4-a716-446655440001"
46
+ },
47
+ "owner_id": {
48
+ "type": "string",
49
+ "description": "Unique identifier for the owner (organization or user)",
50
+ "example": "org_12345678"
51
+ },
52
+ "owner_type": {
53
+ "type": "string",
54
+ "enum": ["org", "user"],
55
+ "description": "Type of owner (organization or user)",
56
+ "example": "org"
57
+ },
58
+ "assurance_level": {
59
+ "type": "string",
60
+ "enum": ["L0", "L1", "L2", "L3", "L4KYC", "L4FIN"],
61
+ "description": "Assurance level of the passport owner",
62
+ "example": "L2"
63
+ },
64
+ "status": {
65
+ "type": "string",
66
+ "enum": ["draft", "active", "suspended", "revoked"],
67
+ "description": "Current status of the passport",
68
+ "example": "active"
69
+ },
70
+ "capabilities": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "object",
74
+ "required": ["id"],
75
+ "properties": {
76
+ "id": {
77
+ "type": "string",
78
+ "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
79
+ "description": "Capability identifier",
80
+ "example": "finance.payment.refund"
81
+ },
82
+ "params": {
83
+ "type": "object",
84
+ "description": "Optional parameters for the capability",
85
+ "additionalProperties": true,
86
+ "example": {
87
+ "max_amount": 5000,
88
+ "currency": "USD"
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "description": "List of capabilities granted to the agent",
94
+ "example": [
95
+ {
96
+ "id": "finance.payment.refund",
97
+ "params": {
98
+ "max_amount": 5000,
99
+ "currency": "USD"
100
+ }
101
+ },
102
+ {
103
+ "id": "data.export"
104
+ }
105
+ ]
106
+ },
107
+ "limits": {
108
+ "type": "object",
109
+ "description": "Operational limits for the agent",
110
+ "properties": {
111
+ "finance.payment.refund": {
112
+ "type": "object",
113
+ "properties": {
114
+ "currency_limits": {
115
+ "type": "object",
116
+ "patternProperties": {
117
+ "^[A-Z]{3}$": {
118
+ "type": "object",
119
+ "properties": {
120
+ "max_per_tx": {
121
+ "type": "integer",
122
+ "minimum": 0,
123
+ "description": "Maximum amount per transaction in minor units"
124
+ },
125
+ "daily_cap": {
126
+ "type": "integer",
127
+ "minimum": 0,
128
+ "description": "Maximum daily total in minor units"
129
+ }
130
+ }
131
+ }
132
+ }
133
+ },
134
+ "reason_codes": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ },
139
+ "description": "Allowed reason codes for refunds"
140
+ },
141
+ "idempotency_required": {
142
+ "type": "boolean",
143
+ "description": "Whether idempotency keys are required"
144
+ }
145
+ }
146
+ },
147
+ "data.export": {
148
+ "type": "object",
149
+ "properties": {
150
+ "max_rows": {
151
+ "type": "integer",
152
+ "minimum": 1,
153
+ "description": "Maximum number of rows per export"
154
+ },
155
+ "allow_pii": {
156
+ "type": "boolean",
157
+ "description": "Whether PII can be included in exports"
158
+ },
159
+ "allowed_collections": {
160
+ "type": "array",
161
+ "items": {
162
+ "type": "string"
163
+ },
164
+ "description": "Allowed data collections for export"
165
+ }
166
+ }
167
+ },
168
+ "messaging.send": {
169
+ "type": "object",
170
+ "properties": {
171
+ "msgs_per_min": {
172
+ "type": "integer",
173
+ "minimum": 1,
174
+ "description": "Maximum messages per minute"
175
+ },
176
+ "msgs_per_day": {
177
+ "type": "integer",
178
+ "minimum": 1,
179
+ "description": "Maximum messages per day"
180
+ },
181
+ "allowed_recipients": {
182
+ "oneOf": [
183
+ {
184
+ "type": "array",
185
+ "items": {
186
+ "type": "string"
187
+ },
188
+ "description": "Simple list of allowed recipient IDs"
189
+ },
190
+ {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "object",
194
+ "required": ["id"],
195
+ "properties": {
196
+ "id": {
197
+ "type": "string",
198
+ "description": "Recipient identifier (username, email, account ID, etc.)"
199
+ },
200
+ "limits": {
201
+ "type": "object",
202
+ "properties": {
203
+ "currency": {
204
+ "type": "string",
205
+ "pattern": "^[A-Z]{3}$",
206
+ "description": "ISO 4217 currency code"
207
+ },
208
+ "max_amount": {
209
+ "type": "integer",
210
+ "minimum": 0,
211
+ "description": "Maximum amount per transaction in minor units"
212
+ },
213
+ "daily_cap": {
214
+ "type": "integer",
215
+ "minimum": 0,
216
+ "description": "Daily spending cap in minor units"
217
+ }
218
+ }
219
+ }
220
+ }
221
+ },
222
+ "description": "List of recipients with per-recipient limits"
223
+ }
224
+ ]
225
+ },
226
+ "approval_required": {
227
+ "type": "boolean",
228
+ "description": "Whether messages require manual approval before sending"
229
+ }
230
+ }
231
+ },
232
+ "payments.payout": {
233
+ "type": "object",
234
+ "properties": {
235
+ "supported_currencies": {
236
+ "type": "array",
237
+ "items": {
238
+ "type": "string",
239
+ "pattern": "^[A-Z]{3}$"
240
+ },
241
+ "description": "Supported currencies for payouts"
242
+ },
243
+ "currency_limits": {
244
+ "type": "object",
245
+ "patternProperties": {
246
+ "^[A-Z]{3}$": {
247
+ "type": "object",
248
+ "properties": {
249
+ "max_per_tx": {
250
+ "type": "integer",
251
+ "minimum": 0,
252
+ "description": "Maximum amount per transaction in minor units"
253
+ },
254
+ "max_daily_amount": {
255
+ "type": "integer",
256
+ "minimum": 0,
257
+ "description": "Maximum daily total in minor units"
258
+ }
259
+ }
260
+ }
261
+ }
262
+ },
263
+ "allowed_destination_types": {
264
+ "type": "array",
265
+ "items": {
266
+ "type": "string"
267
+ },
268
+ "description": "Allowed destination account types"
269
+ },
270
+ "allowed_recipients": {
271
+ "oneOf": [
272
+ {
273
+ "type": "array",
274
+ "items": {
275
+ "type": "string"
276
+ },
277
+ "description": "Simple list of allowed recipient IDs"
278
+ },
279
+ {
280
+ "type": "array",
281
+ "items": {
282
+ "type": "object",
283
+ "required": ["id"],
284
+ "properties": {
285
+ "id": {
286
+ "type": "string",
287
+ "description": "Recipient identifier"
288
+ },
289
+ "limits": {
290
+ "type": "object",
291
+ "properties": {
292
+ "currency": {
293
+ "type": "string",
294
+ "pattern": "^[A-Z]{3}$"
295
+ },
296
+ "max_amount": {
297
+ "type": "integer",
298
+ "minimum": 0
299
+ },
300
+ "daily_cap": {
301
+ "type": "integer",
302
+ "minimum": 0
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ ]
310
+ },
311
+ "approval_required": {
312
+ "type": "boolean",
313
+ "description": "Whether payouts require manual approval"
314
+ },
315
+ "max_payouts_per_day": {
316
+ "type": "integer",
317
+ "minimum": 1,
318
+ "description": "Maximum number of payouts per day"
319
+ },
320
+ "compliance_checks_required": {
321
+ "type": "boolean",
322
+ "description": "Whether compliance checks are required"
323
+ }
324
+ }
325
+ },
326
+ "repo.release.publish": {
327
+ "type": "object",
328
+ "properties": {
329
+ "allowed_branches": {
330
+ "type": "array",
331
+ "items": {
332
+ "type": "string"
333
+ },
334
+ "description": "Allowed branches for releases"
335
+ },
336
+ "max_releases_per_day": {
337
+ "type": "integer",
338
+ "minimum": 1,
339
+ "description": "Maximum releases per day"
340
+ },
341
+ "require_signed_artifacts": {
342
+ "type": "boolean",
343
+ "description": "Whether artifacts must be signed"
344
+ }
345
+ }
346
+ }
347
+ },
348
+ "additionalProperties": true
349
+ },
350
+ "regions": {
351
+ "type": "array",
352
+ "items": {
353
+ "type": "string",
354
+ "pattern": "^[A-Z]{2}(-[A-Z]{2})?$"
355
+ },
356
+ "description": "Geographic regions where the agent is authorized to operate",
357
+ "example": ["US", "EU", "CA"]
358
+ },
359
+ "metadata": {
360
+ "type": "object",
361
+ "description": "Additional metadata for the passport",
362
+ "additionalProperties": true
363
+ },
364
+ "created_at": {
365
+ "type": "string",
366
+ "format": "date-time",
367
+ "description": "ISO 8601 timestamp of creation",
368
+ "example": "2024-01-01T00:00:00Z"
369
+ },
370
+ "updated_at": {
371
+ "type": "string",
372
+ "format": "date-time",
373
+ "description": "ISO 8601 timestamp of last update",
374
+ "example": "2024-01-15T10:30:00Z"
375
+ },
376
+ "version": {
377
+ "type": "string",
378
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
379
+ "description": "Version of the passport schema",
380
+ "example": "1.0.0"
381
+ },
382
+ "spec_version": {
383
+ "type": "string",
384
+ "const": "oap/1.0",
385
+ "description": "OAP specification version",
386
+ "example": "oap/1.0"
387
+ },
388
+ "parent_agent_id": {
389
+ "type": "string",
390
+ "format": "uuid",
391
+ "description": "Parent template passport ID (required for instances)",
392
+ "example": "550e8400-e29b-41d4-a716-446655440001"
393
+ }
394
+ },
395
+ "additionalProperties": false
396
+ }
@@ -0,0 +1,213 @@
1
+ # Open Agent Passport Security Model
2
+
3
+ ## Overview
4
+
5
+ The Open Agent Passport (OAP) security model ensures the integrity, authenticity, and confidentiality of agent credentials and policy decisions through cryptographic verification and secure key management.
6
+
7
+ ## Cryptographic Primitives
8
+
9
+ ### Ed25519 Signatures
10
+
11
+ All OAP objects use Ed25519 for digital signatures:
12
+
13
+ - **Algorithm**: Edwards Curve Digital Signature Algorithm (EdDSA)
14
+ - **Curve**: Curve25519
15
+ - **Key Size**: 256 bits (32 bytes)
16
+ - **Signature Size**: 512 bits (64 bytes)
17
+ - **Performance**: Fast signing and verification, suitable for edge computing
18
+
19
+ ### SHA-256 Hashing
20
+
21
+ Passport digests use SHA-256:
22
+
23
+ - **Algorithm**: SHA-256
24
+ - **Input**: JCS-canonicalized passport view
25
+ - **Output**: 256-bit (32-byte) hash
26
+ - **Format**: `sha256:<base64-encoded-hash>`
27
+
28
+ ### JCS Canonicalization
29
+
30
+ All objects are canonicalized using RFC 8785 JCS before signing:
31
+
32
+ - **Standard**: RFC 8785 JSON Canonicalization Scheme
33
+ - **Purpose**: Deterministic JSON representation for consistent hashing
34
+ - **Implementation**: Must follow RFC 8785 exactly
35
+
36
+ ## Key Management
37
+
38
+ ### Key Types
39
+
40
+ #### Registry Keys
41
+
42
+ Registry keys are used by the OAP registry to sign decisions:
43
+
44
+ - **Format**: `oap:registry:<keyid>`
45
+ - **Location**: `https://api.yourdomain/.well-known/oap/keys.json`
46
+ - **Rotation**: Regular rotation schedule (e.g., quarterly)
47
+ - **Backup**: Multiple keys for high availability
48
+
49
+ #### Owner Keys
50
+
51
+ Owner keys are used by passport owners for additional verification:
52
+
53
+ - **Format**: `oap:owner:<domain>:<keyid>`
54
+ - **Location**: `https://<domain>/.well-known/oap/keys.json`
55
+ - **Optional**: Not required for basic OAP compliance
56
+ - **Use Case**: Additional verification layers
57
+
58
+ ### Key Resolution
59
+
60
+ Keys are resolved using the following process:
61
+
62
+ 1. **Parse kid**: Extract key type and identifier
63
+ 2. **Resolve URL**: Construct key resolution URL
64
+ 3. **Fetch key**: Retrieve public key from URL
65
+ 4. **Validate**: Verify key format and expiration
66
+ 5. **Cache**: Cache key for performance
67
+
68
+ #### Key Resolution URLs
69
+
70
+ ```
71
+ Registry keys: https://api.yourdomain/.well-known/oap/keys.json
72
+ Owner keys: https://<domain>/.well-known/oap/keys.json
73
+ ```
74
+
75
+ #### Key Format
76
+
77
+ ```json
78
+
79
+ {
80
+ "keys": [
81
+ {
82
+ "kid": "oap:registry:key-2025-01",
83
+ "kty": "OKP",
84
+ "crv": "Ed25519",
85
+ "x": "base64url-encoded-public-key",
86
+ "use": "sig",
87
+ "alg": "EdDSA",
88
+ "exp": 1735689600
89
+ }
90
+ ]
91
+ }
92
+ ```
93
+
94
+ ## Signature Verification
95
+
96
+ ### Decision Verification
97
+
98
+ All decisions MUST be verified before acceptance:
99
+
100
+ 1. **Parse signature**: Extract Ed25519 signature from `signature` field
101
+ 2. **Resolve key**: Use `kid` to fetch public key
102
+ 3. **Canonicalize**: Apply JCS canonicalization to decision payload
103
+ 4. **Verify signature**: Use Ed25519 to verify signature
104
+ 5. **Check expiration**: Ensure `expires_at` is in the future
105
+ 6. **Validate digest**: Verify `passport_digest` matches evaluated passport
106
+
107
+ ### Passport Verification
108
+
109
+ Passport integrity is verified through digests:
110
+
111
+ 1. **Canonicalize passport**: Apply JCS canonicalization
112
+ 2. **Compute digest**: SHA-256 of canonicalized passport
113
+ 3. **Compare**: Ensure computed digest matches `passport_digest`
114
+
115
+ ## Security Properties
116
+
117
+ ### Integrity
118
+
119
+ - **Passport integrity**: SHA-256 digest ensures passport hasn't been tampered with
120
+ - **Decision integrity**: Ed25519 signature ensures decision hasn't been modified
121
+ - **Canonicalization**: JCS ensures consistent representation across implementations
122
+
123
+ ### Authenticity
124
+
125
+ - **Decision authenticity**: Ed25519 signature proves decision came from registry
126
+ - **Key authenticity**: HTTPS and certificate validation for key resolution
127
+ - **Passport authenticity**: Registry signature on active passports
128
+
129
+ ### Non-repudiation
130
+
131
+ - **Decision non-repudiation**: Ed25519 signature provides cryptographic proof
132
+ - **Audit trail**: All decisions are logged with signatures
133
+ - **Key rotation**: Old keys remain valid for historical verification
134
+
135
+ ## Threat Model
136
+
137
+ ### Threats Addressed
138
+
139
+ 1. **Passport tampering**: Prevented by SHA-256 digests
140
+ 2. **Decision forgery**: Prevented by Ed25519 signatures
141
+ 3. **Replay attacks**: Prevented by expiration times and idempotency keys
142
+ 4. **Key compromise**: Mitigated by key rotation and revocation
143
+ 5. **Man-in-the-middle**: Prevented by HTTPS and certificate validation
144
+
145
+ ### Threats Not Addressed
146
+
147
+ 1. **Key theft**: Physical security of private keys
148
+ 2. **Insider attacks**: Malicious registry operators
149
+ 3. **Side-channel attacks**: Implementation-specific vulnerabilities
150
+ 4. **Quantum attacks**: Future quantum computing threats
151
+
152
+ ## Security Best Practices
153
+
154
+ ### For Implementers
155
+
156
+ 1. **Use secure random**: Generate UUIDs and keys with cryptographically secure random
157
+ 2. **Validate inputs**: Strictly validate all input data
158
+ 3. **Check expiration**: Always verify decision expiration times
159
+ 4. **Cache securely**: Store decisions securely with proper access controls
160
+ 5. **Rotate keys**: Implement regular key rotation schedule
161
+ 6. **Monitor logs**: Monitor for suspicious activity and key usage
162
+
163
+ ### For Deployers
164
+
165
+ 1. **HTTPS only**: Use HTTPS for all key resolution and API calls
166
+ 2. **Certificate validation**: Validate TLS certificates properly
167
+ 3. **Key storage**: Store private keys securely (HSM recommended)
168
+ 4. **Access controls**: Implement proper access controls for key management
169
+ 5. **Monitoring**: Monitor key usage and decision patterns
170
+ 6. **Incident response**: Have procedures for key compromise
171
+
172
+ ## Suspend Semantics
173
+
174
+ ### Global Invalidation
175
+
176
+ When a passport is suspended or revoked:
177
+
178
+ 1. **Immediate effect**: Status change takes effect immediately
179
+ 2. **Cache invalidation**: All caches MUST be purged within 30 seconds
180
+ 3. **Decision invalidation**: All cached decisions become invalid
181
+ 4. **Notification**: Relying parties SHOULD be notified via webhooks
182
+
183
+ ### Implementation Requirements
184
+
185
+ - **Registry**: Must invalidate all cached decisions within 30 seconds
186
+ - **Relying parties**: Must treat cached decisions as invalid after suspend
187
+ - **Monitoring**: Must detect and alert on suspend/revoke events
188
+ - **Recovery**: Must support passport reactivation with new decisions
189
+
190
+ ## Compliance
191
+
192
+ ### Security Standards
193
+
194
+ OAP implementations should comply with:
195
+
196
+ - **FIPS 140-2**: For cryptographic modules (if applicable)
197
+ - **Common Criteria**: For high-assurance implementations
198
+ - **SOC 2**: For service providers
199
+ - **ISO 27001**: For information security management
200
+
201
+ ### Audit Requirements
202
+
203
+ - **Key usage**: Log all key usage and signature operations
204
+ - **Decision audit**: Log all policy decisions with full context
205
+ - **Access audit**: Log all administrative access to keys and passports
206
+ - **Retention**: Retain audit logs for required period (e.g., 7 years)
207
+
208
+ ## References
209
+
210
+ - [RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)](https://tools.ietf.org/html/rfc8032)
211
+ - [RFC 8785: JSON Canonicalization Scheme (JCS)](https://tools.ietf.org/html/rfc8785)
212
+ - [NIST SP 800-57: Key Management Guidelines](https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final)
213
+ - [OWASP Cryptographic Storage Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)