@stigmer/server 3.27.1 → 3.28.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 (245) hide show
  1. package/README.md +2 -0
  2. package/dist/authorization/authorizer.d.ts +7 -5
  3. package/dist/authorization/authorizer.d.ts.map +1 -1
  4. package/dist/authorization/authorizer.js +7 -5
  5. package/dist/authorization/authorizer.js.map +1 -1
  6. package/dist/authorization/derived-tuples.d.ts +3 -1
  7. package/dist/authorization/derived-tuples.d.ts.map +1 -1
  8. package/dist/authorization/derived-tuples.js +52 -2
  9. package/dist/authorization/derived-tuples.js.map +1 -1
  10. package/dist/authorization/evaluator.d.ts +9 -10
  11. package/dist/authorization/evaluator.d.ts.map +1 -1
  12. package/dist/authorization/evaluator.js.map +1 -1
  13. package/dist/authorization/list-read-scope.d.ts.map +1 -1
  14. package/dist/authorization/list-read-scope.js +29 -18
  15. package/dist/authorization/list-read-scope.js.map +1 -1
  16. package/dist/authorization/model/bindings.d.ts +41 -0
  17. package/dist/authorization/model/bindings.d.ts.map +1 -0
  18. package/dist/authorization/model/bindings.js +89 -0
  19. package/dist/authorization/model/bindings.js.map +1 -0
  20. package/dist/authorization/model/data/authorization-model.json +3114 -0
  21. package/dist/authorization/model/default-of.d.ts +2 -2
  22. package/dist/authorization/model/execution-viewer.d.ts +3 -0
  23. package/dist/authorization/model/execution-viewer.d.ts.map +1 -0
  24. package/dist/authorization/model/execution-viewer.js +50 -0
  25. package/dist/authorization/model/execution-viewer.js.map +1 -0
  26. package/dist/authorization/model/index.d.ts +33 -21
  27. package/dist/authorization/model/index.d.ts.map +1 -1
  28. package/dist/authorization/model/index.js +74 -52
  29. package/dist/authorization/model/index.js.map +1 -1
  30. package/dist/authorization/model/openfga-json.d.ts +18 -0
  31. package/dist/authorization/model/openfga-json.d.ts.map +1 -0
  32. package/dist/authorization/model/openfga-json.js +266 -0
  33. package/dist/authorization/model/openfga-json.js.map +1 -0
  34. package/dist/authorization/model/rewrite.d.ts +39 -67
  35. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  36. package/dist/authorization/model/rewrite.js +1 -117
  37. package/dist/authorization/model/rewrite.js.map +1 -1
  38. package/dist/authorization/strict-json.d.ts +20 -0
  39. package/dist/authorization/strict-json.d.ts.map +1 -0
  40. package/dist/authorization/strict-json.js +45 -0
  41. package/dist/authorization/strict-json.js.map +1 -0
  42. package/dist/boot/compose.d.ts.map +1 -1
  43. package/dist/boot/compose.js +9 -7
  44. package/dist/boot/compose.js.map +1 -1
  45. package/dist/boot/list-indexes.d.ts.map +1 -1
  46. package/dist/boot/list-indexes.js +6 -0
  47. package/dist/boot/list-indexes.js.map +1 -1
  48. package/dist/domain/iampolicy/list-index.d.ts +2 -0
  49. package/dist/domain/iampolicy/list-index.d.ts.map +1 -0
  50. package/dist/domain/iampolicy/list-index.js +32 -0
  51. package/dist/domain/iampolicy/list-index.js.map +1 -0
  52. package/dist/domain/iampolicy/resource-store.d.ts.map +1 -1
  53. package/dist/domain/iampolicy/resource-store.js +24 -11
  54. package/dist/domain/iampolicy/resource-store.js.map +1 -1
  55. package/dist/domain/workflowexecution/list-index.d.ts +1 -1
  56. package/dist/extensions/list-read-scope.d.ts +20 -3
  57. package/dist/extensions/list-read-scope.d.ts.map +1 -1
  58. package/dist/extensions/list-read-scope.js +22 -2
  59. package/dist/extensions/list-read-scope.js.map +1 -1
  60. package/dist/index.d.ts +8 -8
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +20 -5
  63. package/dist/index.js.map +1 -1
  64. package/package.json +7 -6
  65. package/src/authorization/README.md +48 -39
  66. package/src/authorization/__tests__/authorizer.test.ts +5 -14
  67. package/src/authorization/__tests__/derived-tuples.test.ts +192 -17
  68. package/src/authorization/__tests__/evaluator.test.ts +53 -160
  69. package/src/authorization/__tests__/facts.test.ts +5 -11
  70. package/src/authorization/__tests__/list-read-scope.measure.test.ts +424 -62
  71. package/src/authorization/__tests__/list-read-scope.test.ts +15 -14
  72. package/src/authorization/__tests__/organization-directory.test.ts +2 -2
  73. package/src/authorization/__tests__/store-test-kit.ts +246 -0
  74. package/src/authorization/__tests__/store-tests.test.ts +91 -223
  75. package/src/authorization/__tests__/support.ts +30 -2
  76. package/src/authorization/__tests__/throwaway-model.ts +75 -0
  77. package/src/authorization/__tests__/wire-permissions.test.ts +141 -107
  78. package/src/authorization/authorizer.ts +7 -5
  79. package/src/authorization/derived-tuples.ts +105 -16
  80. package/src/authorization/evaluator.ts +8 -10
  81. package/src/authorization/list-read-scope.ts +37 -22
  82. package/src/authorization/model/__tests__/openfga-json.test.ts +353 -0
  83. package/src/authorization/model/__tests__/registry.test.ts +102 -276
  84. package/src/authorization/model/bindings.ts +131 -0
  85. package/src/authorization/model/data/authorization-model.json +3114 -0
  86. package/src/authorization/model/default-of.ts +2 -2
  87. package/src/authorization/model/execution-viewer.ts +56 -0
  88. package/src/authorization/model/index.ts +81 -72
  89. package/src/authorization/model/openfga-json.ts +310 -0
  90. package/src/authorization/model/rewrite.ts +39 -188
  91. package/src/authorization/strict-json.ts +52 -0
  92. package/src/boot/__tests__/list-indexes.test.ts +4 -0
  93. package/src/boot/compose.ts +9 -7
  94. package/src/boot/list-indexes.ts +6 -0
  95. package/src/domain/iampolicy/__tests__/resource-store.test.ts +65 -5
  96. package/src/domain/iampolicy/list-index.ts +33 -0
  97. package/src/domain/iampolicy/resource-store.ts +24 -11
  98. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +3 -6
  99. package/src/extensions/list-read-scope.ts +32 -4
  100. package/src/index.ts +20 -44
  101. package/dist/authorization/model/agent.d.ts +0 -2
  102. package/dist/authorization/model/agent.d.ts.map +0 -1
  103. package/dist/authorization/model/agent.js +0 -43
  104. package/dist/authorization/model/agent.js.map +0 -1
  105. package/dist/authorization/model/agent_channel.d.ts +0 -2
  106. package/dist/authorization/model/agent_channel.d.ts.map +0 -1
  107. package/dist/authorization/model/agent_channel.js +0 -39
  108. package/dist/authorization/model/agent_channel.js.map +0 -1
  109. package/dist/authorization/model/agent_execution.d.ts +0 -2
  110. package/dist/authorization/model/agent_execution.d.ts.map +0 -1
  111. package/dist/authorization/model/agent_execution.js +0 -25
  112. package/dist/authorization/model/agent_execution.js.map +0 -1
  113. package/dist/authorization/model/agent_instance.d.ts +0 -2
  114. package/dist/authorization/model/agent_instance.d.ts.map +0 -1
  115. package/dist/authorization/model/agent_instance.js +0 -48
  116. package/dist/authorization/model/agent_instance.js.map +0 -1
  117. package/dist/authorization/model/agent_share.d.ts +0 -2
  118. package/dist/authorization/model/agent_share.d.ts.map +0 -1
  119. package/dist/authorization/model/agent_share.js +0 -29
  120. package/dist/authorization/model/agent_share.js.map +0 -1
  121. package/dist/authorization/model/api_key.d.ts +0 -2
  122. package/dist/authorization/model/api_key.d.ts.map +0 -1
  123. package/dist/authorization/model/api_key.js +0 -27
  124. package/dist/authorization/model/api_key.js.map +0 -1
  125. package/dist/authorization/model/artifact.d.ts +0 -2
  126. package/dist/authorization/model/artifact.d.ts.map +0 -1
  127. package/dist/authorization/model/artifact.js +0 -27
  128. package/dist/authorization/model/artifact.js.map +0 -1
  129. package/dist/authorization/model/channel_app.d.ts +0 -2
  130. package/dist/authorization/model/channel_app.d.ts.map +0 -1
  131. package/dist/authorization/model/channel_app.js +0 -28
  132. package/dist/authorization/model/channel_app.js.map +0 -1
  133. package/dist/authorization/model/environment.d.ts +0 -2
  134. package/dist/authorization/model/environment.d.ts.map +0 -1
  135. package/dist/authorization/model/environment.js +0 -33
  136. package/dist/authorization/model/environment.js.map +0 -1
  137. package/dist/authorization/model/execution_context.d.ts +0 -2
  138. package/dist/authorization/model/execution_context.d.ts.map +0 -1
  139. package/dist/authorization/model/execution_context.js +0 -19
  140. package/dist/authorization/model/execution_context.js.map +0 -1
  141. package/dist/authorization/model/iam_policy.d.ts +0 -2
  142. package/dist/authorization/model/iam_policy.d.ts.map +0 -1
  143. package/dist/authorization/model/iam_policy.js +0 -31
  144. package/dist/authorization/model/iam_policy.js.map +0 -1
  145. package/dist/authorization/model/identity_account.d.ts +0 -2
  146. package/dist/authorization/model/identity_account.d.ts.map +0 -1
  147. package/dist/authorization/model/identity_account.js +0 -25
  148. package/dist/authorization/model/identity_account.js.map +0 -1
  149. package/dist/authorization/model/mcp_server.d.ts +0 -2
  150. package/dist/authorization/model/mcp_server.d.ts.map +0 -1
  151. package/dist/authorization/model/mcp_server.js +0 -38
  152. package/dist/authorization/model/mcp_server.js.map +0 -1
  153. package/dist/authorization/model/memory.d.ts +0 -2
  154. package/dist/authorization/model/memory.d.ts.map +0 -1
  155. package/dist/authorization/model/memory.js +0 -26
  156. package/dist/authorization/model/memory.js.map +0 -1
  157. package/dist/authorization/model/oauth_app.d.ts +0 -2
  158. package/dist/authorization/model/oauth_app.d.ts.map +0 -1
  159. package/dist/authorization/model/oauth_app.js +0 -31
  160. package/dist/authorization/model/oauth_app.js.map +0 -1
  161. package/dist/authorization/model/organization.d.ts +0 -2
  162. package/dist/authorization/model/organization.d.ts.map +0 -1
  163. package/dist/authorization/model/organization.js +0 -58
  164. package/dist/authorization/model/organization.js.map +0 -1
  165. package/dist/authorization/model/platform_client.d.ts +0 -2
  166. package/dist/authorization/model/platform_client.d.ts.map +0 -1
  167. package/dist/authorization/model/platform_client.js +0 -31
  168. package/dist/authorization/model/platform_client.js.map +0 -1
  169. package/dist/authorization/model/plugin.d.ts +0 -2
  170. package/dist/authorization/model/plugin.d.ts.map +0 -1
  171. package/dist/authorization/model/plugin.js +0 -45
  172. package/dist/authorization/model/plugin.js.map +0 -1
  173. package/dist/authorization/model/schedule.d.ts +0 -2
  174. package/dist/authorization/model/schedule.d.ts.map +0 -1
  175. package/dist/authorization/model/schedule.js +0 -34
  176. package/dist/authorization/model/schedule.js.map +0 -1
  177. package/dist/authorization/model/session.d.ts +0 -2
  178. package/dist/authorization/model/session.d.ts.map +0 -1
  179. package/dist/authorization/model/session.js +0 -38
  180. package/dist/authorization/model/session.js.map +0 -1
  181. package/dist/authorization/model/skill.d.ts +0 -2
  182. package/dist/authorization/model/skill.d.ts.map +0 -1
  183. package/dist/authorization/model/skill.js +0 -39
  184. package/dist/authorization/model/skill.js.map +0 -1
  185. package/dist/authorization/model/workflow.d.ts +0 -2
  186. package/dist/authorization/model/workflow.d.ts.map +0 -1
  187. package/dist/authorization/model/workflow.js +0 -39
  188. package/dist/authorization/model/workflow.js.map +0 -1
  189. package/dist/authorization/model/workflow_execution.d.ts +0 -2
  190. package/dist/authorization/model/workflow_execution.d.ts.map +0 -1
  191. package/dist/authorization/model/workflow_execution.js +0 -33
  192. package/dist/authorization/model/workflow_execution.js.map +0 -1
  193. package/dist/authorization/model/workflow_instance.d.ts +0 -2
  194. package/dist/authorization/model/workflow_instance.d.ts.map +0 -1
  195. package/dist/authorization/model/workflow_instance.js +0 -96
  196. package/dist/authorization/model/workflow_instance.js.map +0 -1
  197. package/dist/authorization/store-test-kit.d.ts +0 -62
  198. package/dist/authorization/store-test-kit.d.ts.map +0 -1
  199. package/dist/authorization/store-test-kit.js +0 -265
  200. package/dist/authorization/store-test-kit.js.map +0 -1
  201. package/src/authorization/__tests__/fixtures/fga/agent-channel-owner.fga.yaml +0 -112
  202. package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +0 -177
  203. package/src/authorization/__tests__/fixtures/fga/agent-share-owner.fga.yaml +0 -109
  204. package/src/authorization/__tests__/fixtures/fga/artifact-org-and-owner.fga.yaml +0 -128
  205. package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +0 -318
  206. package/src/authorization/__tests__/fixtures/fga/channel-app-owner.fga.yaml +0 -125
  207. package/src/authorization/__tests__/fixtures/fga/channel-participation.fga.yaml +0 -201
  208. package/src/authorization/__tests__/fixtures/fga/channel-session-visibility.fga.yaml +0 -187
  209. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +0 -214
  210. package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +0 -129
  211. package/src/authorization/__tests__/fixtures/fga/memory-subject-only.fga.yaml +0 -72
  212. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +0 -308
  213. package/src/authorization/__tests__/fixtures/fga/org-shared-environment.fga.yaml +0 -144
  214. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +0 -199
  215. package/src/authorization/__tests__/fixtures/fga/provider-standing-viewer.fga.yaml +0 -40
  216. package/src/authorization/__tests__/fixtures/fga/reserved-label-writer.fga.yaml +0 -41
  217. package/src/authorization/__tests__/fixtures/fga/schedule-owner.fga.yaml +0 -113
  218. package/src/authorization/__tests__/fixtures/fga/schedule-session-visibility.fga.yaml +0 -214
  219. package/src/authorization/__tests__/fixtures/fga/session-personal-resource.fga.yaml +0 -117
  220. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +0 -190
  221. package/src/authorization/model/agent.ts +0 -64
  222. package/src/authorization/model/agent_channel.ts +0 -57
  223. package/src/authorization/model/agent_execution.ts +0 -33
  224. package/src/authorization/model/agent_instance.ts +0 -66
  225. package/src/authorization/model/agent_share.ts +0 -40
  226. package/src/authorization/model/api_key.ts +0 -28
  227. package/src/authorization/model/artifact.ts +0 -38
  228. package/src/authorization/model/channel_app.ts +0 -39
  229. package/src/authorization/model/environment.ts +0 -48
  230. package/src/authorization/model/execution_context.ts +0 -20
  231. package/src/authorization/model/iam_policy.ts +0 -42
  232. package/src/authorization/model/identity_account.ts +0 -26
  233. package/src/authorization/model/mcp_server.ts +0 -59
  234. package/src/authorization/model/memory.ts +0 -27
  235. package/src/authorization/model/oauth_app.ts +0 -43
  236. package/src/authorization/model/organization.ts +0 -59
  237. package/src/authorization/model/platform_client.ts +0 -43
  238. package/src/authorization/model/plugin.ts +0 -66
  239. package/src/authorization/model/schedule.ts +0 -49
  240. package/src/authorization/model/session.ts +0 -50
  241. package/src/authorization/model/skill.ts +0 -60
  242. package/src/authorization/model/workflow.ts +0 -60
  243. package/src/authorization/model/workflow_execution.ts +0 -46
  244. package/src/authorization/model/workflow_instance.ts +0 -125
  245. package/src/authorization/store-test-kit.ts +0 -395
@@ -1,318 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/blueprint-private-visibility.fga.yaml
2
- # as changed by stigmer-cloud#765 (the OpenFGA store test the cloud runs against its live model).
3
- # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
- # file against this evaluator at the re-pin, so a stale copy is caught there.
5
- # Store tests for real blueprint privacy (Phase 3 of the visibility model).
6
- #
7
- # Blueprint viewer relations no longer include the unconditional
8
- # `viewer from organization` grant: a PRIVATE blueprint is invisible to the
9
- # rest of its own org. Every broader level is an explicit tuple written by
10
- # VisibilityTupleReconciler:
11
- #
12
- # ORG viewer@organization:<org>#viewer (the org's FULL read audience —
13
- # every role satisfies organization#viewer, including read-only
14
- # viewers; pre-cloud#257 tuples carried #member, which excluded
15
- # viewer-role users — still honored until backfilled, see the
16
- # legacy-bot fixture)
17
- # PLATFORM platform_viewer@identity_provider:<idp>#platform_user + the ORG tuple
18
- #
19
- # Read vs spend: an org viewer-role user READS org-visible blueprints (and, at
20
- # the model level, satisfies can_execute — run-what-you-can-read), but every
21
- # spend path is gated in Java on the org-level can_create_session /
22
- # can_create_execution_in permissions, which require member-or-guest. The
23
- # vera assertions pin both halves of that contract.
24
- #
25
- # The ORG tuple rides along on PLATFORM (the "org floor") so a shared
26
- # blueprint stays listable in its own org.
27
- #
28
- # T08 exception: org ADMINS (and org owners, via the role hierarchy) are
29
- # composed into blueprint `owner` and therefore see, list, and manage
30
- # PRIVATE blueprints — the GitHub-org-admin model. "Private is real" now
31
- # means: invisible to plain members, never to org admins. Pinned by the
32
- # oscar (org admin) assertions below.
33
- #
34
- # Run with:
35
- # fga model test --tests blueprint-private-visibility.fga.yaml
36
- #
37
- # Scenario: org "acme" has owner-creator carol, org admin oscar, plain
38
- # member dave, and read-only viewer vera (the role SSO auto-provisioning
39
- # grants by default); mallory belongs to an unrelated org. Carol authors one
40
- # blueprint of each kind at PRIVATE, plus an ORG agent and a legacy ORG
41
- # agent whose tuple still carries the pre-cloud#257 shape.
42
- name: blueprint-private-visibility
43
- model_file: ../model/fga.mod
44
-
45
- tuples:
46
- # --- Org memberships ---
47
- - user: identity_account:carol
48
- relation: owner
49
- object: organization:acme
50
- - user: identity_account:oscar
51
- relation: admin
52
- object: organization:acme
53
- - user: identity_account:dave
54
- relation: member
55
- object: organization:acme
56
- - user: identity_account:vera
57
- relation: viewer
58
- object: organization:acme
59
- - user: identity_account:mallory
60
- relation: member
61
- object: organization:outsider
62
-
63
- # --- PRIVATE blueprints (no visibility tuples at all) ---
64
- - user: organization:acme
65
- relation: organization
66
- object: agent:secret-bot
67
- - user: identity_account:carol
68
- relation: owner
69
- object: agent:secret-bot
70
- - user: organization:acme
71
- relation: organization
72
- object: skill:secret-notes
73
- - user: identity_account:carol
74
- relation: owner
75
- object: skill:secret-notes
76
- - user: organization:acme
77
- relation: organization
78
- object: workflow:secret-flow
79
- - user: identity_account:carol
80
- relation: owner
81
- object: workflow:secret-flow
82
- - user: organization:acme
83
- relation: organization
84
- object: mcp_server:secret-tools
85
- - user: identity_account:carol
86
- relation: owner
87
- object: mcp_server:secret-tools
88
-
89
- # --- ORG-visible agent (explicit org viewer tuple, cloud#257 shape) ---
90
- - user: organization:acme
91
- relation: organization
92
- object: agent:team-bot
93
- - user: identity_account:carol
94
- relation: owner
95
- object: agent:team-bot
96
- - user: organization:acme#viewer
97
- relation: viewer
98
- object: agent:team-bot
99
-
100
- # --- ORG-visible agent with the LEGACY pre-cloud#257 tuple shape ---
101
- # Pins two transition facts until the boot backfill converges prod tuples:
102
- # members must keep their access through the old shape, and viewer-role
103
- # users are still refused by it (the cloud#257 defect, alive on legacy
104
- # tuples only).
105
- - user: organization:acme
106
- relation: organization
107
- object: agent:legacy-bot
108
- - user: identity_account:carol
109
- relation: owner
110
- object: agent:legacy-bot
111
- - user: organization:acme#member
112
- relation: viewer
113
- object: agent:legacy-bot
114
-
115
- # --- PRIVATE agent with an explicit individual viewer grant ---
116
- - user: organization:acme
117
- relation: organization
118
- object: agent:shared-secret
119
- - user: identity_account:carol
120
- relation: owner
121
- object: agent:shared-secret
122
- - user: identity_account:dave
123
- relation: viewer
124
- object: agent:shared-secret
125
-
126
- tests:
127
- - name: private blueprints are invisible to fellow org members (all four kinds)
128
- check:
129
- - user: identity_account:dave
130
- object: agent:secret-bot
131
- assertions:
132
- can_view: false
133
- can_execute: false
134
- can_create_instance: false
135
- can_clone: false
136
- - user: identity_account:dave
137
- object: skill:secret-notes
138
- assertions:
139
- can_view: false
140
- can_use: false
141
- - user: identity_account:dave
142
- object: workflow:secret-flow
143
- assertions:
144
- can_view: false
145
- can_execute: false
146
- - user: identity_account:dave
147
- object: mcp_server:secret-tools
148
- assertions:
149
- can_view: false
150
- can_use: false
151
- can_connect: false
152
-
153
- - name: org admin sees and manages private blueprints of every kind (T08)
154
- check:
155
- - user: identity_account:oscar
156
- object: agent:secret-bot
157
- assertions:
158
- can_view: true
159
- can_edit: true
160
- can_delete: true
161
- can_execute: true
162
- - user: identity_account:oscar
163
- object: skill:secret-notes
164
- assertions:
165
- can_view: true
166
- can_edit: true
167
- - user: identity_account:oscar
168
- object: workflow:secret-flow
169
- assertions:
170
- can_view: true
171
- can_edit: true
172
- # mcp_server had admin inheritance before T08 — asserted here so all
173
- # four private-blueprint kinds are pinned to the same rule.
174
- - user: identity_account:oscar
175
- object: mcp_server:secret-tools
176
- assertions:
177
- can_view: true
178
- can_edit: true
179
-
180
- - name: org admin's listable agents include private ones (T08)
181
- list_objects:
182
- - user: identity_account:oscar
183
- type: agent
184
- assertions:
185
- can_view:
186
- - agent:secret-bot
187
- - agent:team-bot
188
- - agent:legacy-bot
189
- - agent:shared-secret
190
-
191
- - name: owner retains full access to private blueprints
192
- check:
193
- - user: identity_account:carol
194
- object: agent:secret-bot
195
- assertions:
196
- can_view: true
197
- can_execute: true
198
- can_create_instance: true
199
- can_edit: true
200
- can_delete: true
201
- - user: identity_account:carol
202
- object: workflow:secret-flow
203
- assertions:
204
- can_view: true
205
- can_execute: true
206
- can_edit: true
207
-
208
- - name: org-visible agent is viewable and runnable by org members, not outsiders
209
- check:
210
- - user: identity_account:dave
211
- object: agent:team-bot
212
- assertions:
213
- can_view: true
214
- can_execute: true
215
- can_create_instance: true
216
- can_edit: false
217
- can_delete: false
218
- - user: identity_account:mallory
219
- object: agent:team-bot
220
- assertions:
221
- can_view: false
222
- can_execute: false
223
-
224
- - name: explicit individual viewer grant on a private agent conveys view and run
225
- check:
226
- # Run-what-you-can-read: can_execute derives from viewer, so an
227
- # explicit viewer grant is enough to run (matches the execution gate,
228
- # which checks can_view).
229
- - user: identity_account:dave
230
- object: agent:shared-secret
231
- assertions:
232
- can_view: true
233
- can_execute: true
234
- can_edit: false
235
-
236
- - name: org member's listable agents exclude private ones
237
- list_objects:
238
- - user: identity_account:dave
239
- type: agent
240
- assertions:
241
- can_view:
242
- - agent:team-bot
243
- - agent:legacy-bot
244
- - agent:shared-secret
245
-
246
- - name: owner's listable agents include everything they authored
247
- list_objects:
248
- - user: identity_account:carol
249
- type: agent
250
- assertions:
251
- can_view:
252
- - agent:secret-bot
253
- - agent:team-bot
254
- - agent:legacy-bot
255
- - agent:shared-secret
256
-
257
- # ── cloud#257: the viewer-role cell (previously untested) ──────────────
258
-
259
- - name: org viewer reads org-visible blueprints — the cloud#257 contract
260
- check:
261
- # View, clone and (model-level) execute all derive from viewer; the
262
- # spend refusal is pinned separately on the org permissions below.
263
- - user: identity_account:vera
264
- object: agent:team-bot
265
- assertions:
266
- can_view: true
267
- can_clone: true
268
- can_execute: true
269
- can_edit: false
270
- can_delete: false
271
- # Private stays private — the viewer role grants nothing beyond the
272
- # explicit visibility tuples.
273
- - user: identity_account:vera
274
- object: agent:secret-bot
275
- assertions:
276
- can_view: false
277
- can_execute: false
278
-
279
- - name: org viewer holds no spend authority on the org (the cost gate)
280
- check:
281
- # Java execution lanes (session create, agent-execution create,
282
- # workflow-execution create, EC create) all check these org-level
283
- # permissions — this is why widening read to viewers exposes no cost.
284
- - user: identity_account:vera
285
- object: organization:acme
286
- assertions:
287
- can_view: true
288
- can_create_session: false
289
- can_create_execution_in: false
290
- - user: identity_account:dave
291
- object: organization:acme
292
- assertions:
293
- can_create_session: true
294
- can_create_execution_in: true
295
-
296
- - name: legacy member-shaped tuple keeps members but still excludes viewers (until backfilled)
297
- check:
298
- - user: identity_account:dave
299
- object: agent:legacy-bot
300
- assertions:
301
- can_view: true
302
- can_execute: true
303
- # The original cloud#257 defect, pinned on the legacy shape: the org
304
- # role hierarchy flows downward, so a viewer-role user never satisfies
305
- # organization#member. The boot backfill converges these tuples.
306
- - user: identity_account:vera
307
- object: agent:legacy-bot
308
- assertions:
309
- can_view: false
310
- can_execute: false
311
-
312
- - name: org viewer's listable agents are exactly the viewer-shaped org-visible ones
313
- list_objects:
314
- - user: identity_account:vera
315
- type: agent
316
- assertions:
317
- can_view:
318
- - agent:team-bot
@@ -1,125 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/channel-app-owner.fga.yaml
2
- # at commit b87dd1170 (the OpenFGA store test the cloud runs against its live model).
3
- # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
- # file against this evaluator at the re-pin, so a stale copy is caught there.
5
- # Channel apps are owner-scoped provider credentials (T04 item 2, the
6
- # oauth_app RESTRICTED posture with T08 admin inheritance): the creator
7
- # owns the app; view/edit/delete require ownership or an explicit grant.
8
- # Plain org members get NO implicit access — the resource carries the
9
- # org's webhook signing secret and OAuth client secret.
10
- #
11
- # Org ADMINS inherit owner (T08): a credential holder needs an operator
12
- # of last resort more than any blueprint does — an ex-employee owner must
13
- # never strand secret rotation. The narrowness these tests pin: owner +
14
- # admins have control, granted viewers read, plain members have nothing,
15
- # and only admins can create.
16
- #
17
- # Run: fga model test --tests channel-app-owner.fga.yaml
18
-
19
- name: channel-app-owner
20
- model_file: ../model/fga.mod
21
-
22
- tuples:
23
- # Org membership for both accounts — proving membership grants nothing.
24
- # alice created the app while she was an admin and was later demoted to
25
- # member (creation is admin-gated; the owner tuple survives demotion) —
26
- # this keeps the direct-owner path distinct from admin inheritance.
27
- - user: identity_account:alice
28
- relation: member
29
- object: organization:acme
30
- - user: identity_account:mallory
31
- relation: member
32
- object: organization:acme
33
-
34
- # Org admin — proving T08 inheritance reaches channel apps.
35
- - user: identity_account:ana
36
- relation: admin
37
- object: organization:acme
38
-
39
- # The channel app, created by alice (the config-driven create tuples).
40
- - user: organization:acme
41
- relation: organization
42
- object: channel_app:acme-support-bot
43
- - user: identity_account:alice
44
- relation: owner
45
- object: channel_app:acme-support-bot
46
-
47
- # An explicit viewer grant to carol (not even an org member).
48
- - user: identity_account:carol
49
- relation: viewer
50
- object: channel_app:acme-support-bot
51
-
52
- tests:
53
- - name: owner has full control including grant management
54
- check:
55
- - user: identity_account:alice
56
- object: channel_app:acme-support-bot
57
- assertions:
58
- can_view: true
59
- can_edit: true
60
- can_delete: true
61
- can_grant_access: true
62
- can_view_access: true
63
-
64
- - name: explicitly granted viewer can read but not mutate
65
- check:
66
- - user: identity_account:carol
67
- object: channel_app:acme-support-bot
68
- assertions:
69
- can_view: true
70
- can_edit: false
71
- can_delete: false
72
- can_grant_access: false
73
- can_view_access: true
74
-
75
- - name: fellow org member has no implicit access
76
- check:
77
- - user: identity_account:mallory
78
- object: channel_app:acme-support-bot
79
- assertions:
80
- can_view: false
81
- can_edit: false
82
- can_delete: false
83
- can_grant_access: false
84
- can_view_access: false
85
-
86
- - name: org admin inherits channel app management (T08)
87
- check:
88
- - user: identity_account:ana
89
- object: channel_app:acme-support-bot
90
- assertions:
91
- can_view: true
92
- can_edit: true
93
- can_delete: true
94
- can_grant_access: true
95
-
96
- - name: creation is admin-gated on the organization
97
- check:
98
- - user: identity_account:ana
99
- object: organization:acme
100
- assertions:
101
- can_create_channel_app: true
102
- - user: identity_account:mallory
103
- object: organization:acme
104
- assertions:
105
- can_create_channel_app: false
106
-
107
- - name: listing channel apps reflects ownership and grants, not membership
108
- list_objects:
109
- - user: identity_account:alice
110
- type: channel_app
111
- assertions:
112
- can_view:
113
- - channel_app:acme-support-bot
114
- can_edit:
115
- - channel_app:acme-support-bot
116
- - user: identity_account:carol
117
- type: channel_app
118
- assertions:
119
- can_view:
120
- - channel_app:acme-support-bot
121
- can_edit: []
122
- - user: identity_account:mallory
123
- type: channel_app
124
- assertions:
125
- can_view: []
@@ -1,201 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/channel-participation.fga.yaml
2
- # at commit b87dd1170 (the OpenFGA store test the cloud runs against its live model).
3
- # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
- # file against this evaluator at the re-pin, so a stale copy is caught there.
5
- # Store tests for conversation participation on agent channels (the
6
- # `participant` relation and `can_participate` permission,
7
- # channel-conversations DD-010).
8
- #
9
- # The model change under test, in one line each:
10
- # participant: [identity_account] or owner (owner participates free)
11
- # viewer: [identity_account] or participant (widened from `or owner`)
12
- # can_participate: participant (the reply/takeover bar)
13
- #
14
- # The invariants this suite pins:
15
- # 1. Read and speak are DIFFERENT powers: a granted viewer can see
16
- # conversations but cannot participate (the DD-010 rejected
17
- # alternative "widen viewer alone" stays rejected).
18
- # 2. Participation is NOT configuration: a participant can never
19
- # edit/delete/grant on the channel.
20
- # 3. The viewer widening is behavior-preserving for existing grants:
21
- # owner ⊆ participant ⊆ viewer, so every pre-DD-010 owner/admin
22
- # read keeps working (asserted below, byte-identical semantics).
23
- # 4. Conversation READ rides the existing session.can_view composition
24
- # (`viewer from channel`) unchanged, still read-only — participants
25
- # inherit view on channel sessions but never
26
- # can_create_execution_in (DD-012's read-only-by-construction).
27
- # 5. The personal-session invariant is untouched: a participant sees
28
- # nothing of anyone's console sessions.
29
- #
30
- # Run with:
31
- # fga model test --tests channel-participation.fga.yaml
32
- #
33
- # Scenario: org "acme" has admin alice, member bob (who connected the
34
- # WhatsApp channel and owns it), member trina (an ISC trainer granted
35
- # participant — the DD-010 launch persona), member carol (granted plain
36
- # viewer), and member dave (no relation to the channel). "rival" is
37
- # another org whose admin eve must see nothing. The channel session is
38
- # owned by acme's system-channel account; bob also has a personal
39
- # console session to prove invariant 5.
40
- name: channel-participation
41
- model_file: ../model/fga.mod
42
-
43
- tuples:
44
- # --- Org roles ---
45
- - user: identity_account:alice
46
- relation: admin
47
- object: organization:acme
48
- - user: identity_account:bob
49
- relation: member
50
- object: organization:acme
51
- - user: identity_account:trina
52
- relation: member
53
- object: organization:acme
54
- - user: identity_account:carol
55
- relation: member
56
- object: organization:acme
57
- - user: identity_account:dave
58
- relation: member
59
- object: organization:acme
60
- - user: identity_account:eve
61
- relation: admin
62
- object: organization:rival
63
-
64
- # --- The AgentChannel (tuples written on create: org link + creator owner) ---
65
- - user: organization:acme
66
- relation: organization
67
- object: agent_channel:wa-line
68
- - user: identity_account:bob
69
- relation: owner
70
- object: agent_channel:wa-line
71
-
72
- # --- The DD-010 grants (IamPolicy-written: participant vs plain viewer) ---
73
- - user: identity_account:trina
74
- relation: participant
75
- object: agent_channel:wa-line
76
- - user: identity_account:carol
77
- relation: viewer
78
- object: agent_channel:wa-line
79
-
80
- # --- A channel session (owned by the org's system-channel account) ---
81
- - user: organization:acme
82
- relation: organization
83
- object: session:member-chat
84
- - user: identity_account:sys-channel-acme
85
- relation: owner
86
- object: session:member-chat
87
- # The structural link written by ChannelSessionLinkStep:
88
- - user: agent_channel:wa-line
89
- relation: channel
90
- object: session:member-chat
91
-
92
- # --- Bob's personal console session (invariant 5's control subject) ---
93
- - user: organization:acme
94
- relation: organization
95
- object: session:bobs-chat
96
- - user: identity_account:bob
97
- relation: owner
98
- object: session:bobs-chat
99
-
100
- tests:
101
- - name: a granted participant may read and speak but never configure
102
- check:
103
- - user: identity_account:trina
104
- object: agent_channel:wa-line
105
- assertions:
106
- can_view: true
107
- can_participate: true
108
- can_edit: false
109
- can_delete: false
110
- can_grant_access: false
111
- can_view_access: true
112
-
113
- - name: a granted viewer may read but never speak — read and speak are different powers
114
- check:
115
- - user: identity_account:carol
116
- object: agent_channel:wa-line
117
- assertions:
118
- can_view: true
119
- can_participate: false
120
- can_edit: false
121
-
122
- - name: the channel owner participates without an explicit tuple
123
- check:
124
- - user: identity_account:bob
125
- object: agent_channel:wa-line
126
- assertions:
127
- can_view: true
128
- can_participate: true
129
- can_edit: true
130
- can_delete: true
131
- can_grant_access: true
132
-
133
- - name: an org admin participates through owner inheritance, no tuple needed
134
- check:
135
- - user: identity_account:alice
136
- object: agent_channel:wa-line
137
- assertions:
138
- can_view: true
139
- can_participate: true
140
- can_edit: true
141
-
142
- - name: a plain org member has no access of any kind
143
- check:
144
- - user: identity_account:dave
145
- object: agent_channel:wa-line
146
- assertions:
147
- can_view: false
148
- can_participate: false
149
- can_edit: false
150
- can_delete: false
151
- can_grant_access: false
152
- can_view_access: false
153
-
154
- - name: a foreign org admin has no access of any kind
155
- check:
156
- - user: identity_account:eve
157
- object: agent_channel:wa-line
158
- assertions:
159
- can_view: false
160
- can_participate: false
161
- can_edit: false
162
-
163
- - name: participants inherit channel-session read through the existing composition, read-only
164
- check:
165
- - user: identity_account:trina
166
- object: session:member-chat
167
- assertions:
168
- can_view: true
169
- can_create_execution_in: false
170
- can_edit: false
171
- can_delete: false
172
- can_grant_access: false
173
-
174
- - name: the personal-session invariant is untouched — a participant sees no console sessions
175
- check:
176
- - user: identity_account:trina
177
- object: session:bobs-chat
178
- assertions:
179
- can_view: false
180
- can_create_execution_in: false
181
-
182
- - name: list viewable and participable channels resolve per grant (drives listConversations)
183
- list_objects:
184
- - user: identity_account:trina
185
- type: agent_channel
186
- assertions:
187
- can_view:
188
- - agent_channel:wa-line
189
- can_participate:
190
- - agent_channel:wa-line
191
- - user: identity_account:carol
192
- type: agent_channel
193
- assertions:
194
- can_view:
195
- - agent_channel:wa-line
196
- can_participate: []
197
- - user: identity_account:dave
198
- type: agent_channel
199
- assertions:
200
- can_view: []
201
- can_participate: []