@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,187 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/channel-session-visibility.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 channel-session read-only observability (the session
6
- # `channel` structural link).
7
- #
8
- # A session created by the channel runtime carries a single
9
- # session#channel@agent_channel:<id>
10
- # tuple and inherits the channel's viewer set (connector owner + org admins
11
- # via `admin from organization` on agent_channel) into can_view ONLY —
12
- # `viewer from channel` is composed into session.can_view, deliberately NOT
13
- # into session.viewer, so channel observers never gain
14
- # can_create_execution_in / can_edit / can_delete / can_grant_access.
15
- # Executions follow through agent_execution's
16
- # `can_view: viewer or can_view from session`.
17
- #
18
- # The personal-session invariant is untouched: console sessions never carry
19
- # a channel tuple, so `viewer from channel` resolves to nothing for them
20
- # (pinned below and by session-personal-resource.fga.yaml).
21
- #
22
- # Run with:
23
- # fga model test --tests channel-session-visibility.fga.yaml
24
- #
25
- # Scenario: org "acme" has admin alice, member bob (who connected the Slack
26
- # channel and owns it), and member carol (no relation to the channel).
27
- # "rival" is another org whose admin eve must see nothing. The channel
28
- # session is owned by acme's system-channel account; bob also has a normal
29
- # personal console session to prove the invariant.
30
- name: channel-session-visibility
31
- model_file: ../model/fga.mod
32
-
33
- tuples:
34
- # --- Org roles ---
35
- - user: identity_account:alice
36
- relation: admin
37
- object: organization:acme
38
- - user: identity_account:bob
39
- relation: member
40
- object: organization:acme
41
- - user: identity_account:carol
42
- relation: member
43
- object: organization:acme
44
- - user: identity_account:eve
45
- relation: admin
46
- object: organization:rival
47
-
48
- # --- The AgentChannel (tuples written on create: org link + creator owner) ---
49
- - user: organization:acme
50
- relation: organization
51
- object: agent_channel:slack-conn
52
- - user: identity_account:bob
53
- relation: owner
54
- object: agent_channel:slack-conn
55
-
56
- # --- The channel session (owned by the org's system-channel account) ---
57
- - user: organization:acme
58
- relation: organization
59
- object: session:channel-chat
60
- - user: identity_account:sys-channel-acme
61
- relation: owner
62
- object: session:channel-chat
63
- # The structural link written by ChannelSessionLinkStep:
64
- - user: agent_channel:slack-conn
65
- relation: channel
66
- object: session:channel-chat
67
-
68
- # --- An execution inside the channel session ---
69
- - user: session:channel-chat
70
- relation: session
71
- object: agent_execution:channel-run-1
72
-
73
- # --- bob's ordinary personal console session (NO channel tuple) ---
74
- - user: organization:acme
75
- relation: organization
76
- object: session:bobs-chat
77
- - user: identity_account:bob
78
- relation: owner
79
- object: session:bobs-chat
80
- - user: session:bobs-chat
81
- relation: session
82
- object: agent_execution:bobs-run-1
83
-
84
- tests:
85
- - name: channel connector can view the conversation but only view it
86
- check:
87
- - user: identity_account:bob
88
- object: session:channel-chat
89
- assertions:
90
- can_view: true
91
- can_create_execution_in: false
92
- can_edit: false
93
- can_delete: false
94
- can_grant_access: false
95
- can_view_access: false
96
-
97
- - name: org admin inherits view through the channel, read-only
98
- check:
99
- - user: identity_account:alice
100
- object: session:channel-chat
101
- assertions:
102
- can_view: true
103
- can_create_execution_in: false
104
- can_edit: false
105
- can_delete: false
106
- can_grant_access: false
107
-
108
- - name: plain org member without channel access sees nothing
109
- check:
110
- - user: identity_account:carol
111
- object: session:channel-chat
112
- assertions:
113
- can_view: false
114
- can_create_execution_in: false
115
-
116
- - name: another org's admin sees nothing
117
- check:
118
- - user: identity_account:eve
119
- object: session:channel-chat
120
- assertions:
121
- can_view: false
122
-
123
- - name: the system-channel account keeps full session ownership
124
- check:
125
- - user: identity_account:sys-channel-acme
126
- object: session:channel-chat
127
- assertions:
128
- can_view: true
129
- can_create_execution_in: true
130
- can_edit: true
131
- can_delete: true
132
-
133
- - name: executions inherit read-only channel observability
134
- check:
135
- - user: identity_account:bob
136
- object: agent_execution:channel-run-1
137
- assertions:
138
- can_view: true
139
- can_edit: false
140
- - user: identity_account:alice
141
- object: agent_execution:channel-run-1
142
- assertions:
143
- can_view: true
144
- can_edit: false
145
- - user: identity_account:carol
146
- object: agent_execution:channel-run-1
147
- assertions:
148
- can_view: false
149
-
150
- - name: personal-session invariant is untouched by the channel model
151
- check:
152
- # Admin still has no path into a console session (no channel tuple).
153
- - user: identity_account:alice
154
- object: session:bobs-chat
155
- assertions:
156
- can_view: false
157
- can_edit: false
158
- can_delete: false
159
- - user: identity_account:alice
160
- object: agent_execution:bobs-run-1
161
- assertions:
162
- can_view: false
163
- # And the owner's own access is unchanged.
164
- - user: identity_account:bob
165
- object: session:bobs-chat
166
- assertions:
167
- can_view: true
168
- can_edit: true
169
- can_create_execution_in: true
170
-
171
- - name: list viewable sessions resolves the channel chain (drives listByChannel)
172
- list_objects:
173
- - user: identity_account:alice
174
- type: session
175
- assertions:
176
- can_view:
177
- - session:channel-chat
178
- - user: identity_account:bob
179
- type: session
180
- assertions:
181
- can_view:
182
- - session:channel-chat
183
- - session:bobs-chat
184
- - user: identity_account:carol
185
- type: session
186
- assertions:
187
- can_view: []
@@ -1,214 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/default-instance-inheritance.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 default-instance structural inheritance (default_of).
6
- #
7
- # A blueprint's system-managed default instance carries a single
8
- # instance#default_of@<blueprint>:<id>
9
- # tuple and inherits the blueprint's ENTIRE viewer set through
10
- # `viewer from default_of` — org members and platform users
11
- # (identity_provider#platform_user). No enum-derived
12
- # visibility tuples are ever written on default instances, so their access
13
- # can never drift from the template's.
14
- #
15
- # Run with:
16
- # fga model test --tests default-instance-inheritance.fga.yaml
17
- #
18
- # Scenario: "planton" is a platform org owning identity_provider:idp1 which
19
- # manages customer org "acme". Planton authors agents/workflows at every
20
- # visibility level; each has a default instance linked via default_of.
21
- # Alice (acme member) reaches default instances of platform-shared
22
- # blueprints; planton members reach default instances of org-visible ones;
23
- # personal instances never leak.
24
- name: default-instance-inheritance
25
- model_file: ../model/fga.mod
26
-
27
- tuples:
28
- # --- Platform tenancy: idp1 is owned by planton and manages acme ---
29
- - user: organization:planton
30
- relation: organization
31
- object: identity_provider:idp1
32
- - user: organization:acme
33
- relation: managed_org
34
- object: identity_provider:idp1
35
-
36
- # --- Org memberships ---
37
- - user: identity_account:swarup
38
- relation: owner
39
- object: organization:planton
40
- - user: identity_account:priya
41
- relation: member
42
- object: organization:planton
43
- - user: identity_account:veda
44
- relation: viewer
45
- object: organization:planton
46
- - user: identity_account:alice
47
- relation: member
48
- object: organization:acme
49
- - user: identity_account:mallory
50
- relation: member
51
- object: organization:outsider
52
-
53
- # --- Platform-shared agent + its default instance ---
54
- # PLATFORM carries the org floor tuple too (viewer@org#viewer — the org's
55
- # full read audience), exactly as VisibilityTupleReconciler writes it.
56
- - user: organization:planton
57
- relation: organization
58
- object: agent:sara
59
- - user: identity_account:swarup
60
- relation: owner
61
- object: agent:sara
62
- - user: identity_provider:idp1#platform_user
63
- relation: platform_viewer
64
- object: agent:sara
65
- - user: organization:planton#viewer
66
- relation: viewer
67
- object: agent:sara
68
- - user: organization:planton
69
- relation: organization
70
- object: agent_instance:sara-default
71
- - user: agent:sara
72
- relation: agent
73
- object: agent_instance:sara-default
74
- - user: identity_account:swarup
75
- relation: owner
76
- object: agent_instance:sara-default
77
- - user: agent:sara
78
- relation: default_of
79
- object: agent_instance:sara-default
80
-
81
- # --- Alice's personal instance of the shared agent (NO default_of) ---
82
- - user: organization:acme
83
- relation: organization
84
- object: agent_instance:alice-personal
85
- - user: agent:sara
86
- relation: agent
87
- object: agent_instance:alice-personal
88
- - user: identity_account:alice
89
- relation: owner
90
- object: agent_instance:alice-personal
91
-
92
- # --- Org-visible agent + its default instance ---
93
- # ORG visibility is an explicit viewer tuple (viewer@org#viewer) — the
94
- # unconditional `viewer from organization` grant is gone (private is real).
95
- - user: organization:planton
96
- relation: organization
97
- object: agent:internal-bot
98
- - user: identity_account:swarup
99
- relation: owner
100
- object: agent:internal-bot
101
- - user: organization:planton#viewer
102
- relation: viewer
103
- object: agent:internal-bot
104
- - user: organization:planton
105
- relation: organization
106
- object: agent_instance:internal-default
107
- - user: agent:internal-bot
108
- relation: agent
109
- object: agent_instance:internal-default
110
- - user: identity_account:swarup
111
- relation: owner
112
- object: agent_instance:internal-default
113
- - user: agent:internal-bot
114
- relation: default_of
115
- object: agent_instance:internal-default
116
-
117
- # --- Platform-shared workflow + its default instance ---
118
- - user: organization:planton
119
- relation: organization
120
- object: workflow:onboarding
121
- - user: identity_account:swarup
122
- relation: owner
123
- object: workflow:onboarding
124
- - user: identity_provider:idp1#platform_user
125
- relation: platform_viewer
126
- object: workflow:onboarding
127
- - user: organization:planton#viewer
128
- relation: viewer
129
- object: workflow:onboarding
130
- - user: organization:planton
131
- relation: organization
132
- object: workflow_instance:onboarding-default
133
- - user: workflow:onboarding
134
- relation: workflow
135
- object: workflow_instance:onboarding-default
136
- - user: identity_account:swarup
137
- relation: owner
138
- object: workflow_instance:onboarding-default
139
- - user: workflow:onboarding
140
- relation: default_of
141
- object: workflow_instance:onboarding-default
142
-
143
- tests:
144
- - name: managed-org member reaches the default instance of a platform-shared agent
145
- check:
146
- - user: identity_account:alice
147
- object: agent_instance:sara-default
148
- assertions:
149
- can_view: true
150
- can_execute: true
151
- can_edit: false
152
- can_delete: false
153
-
154
- - name: outsiders get nothing from the default_of link
155
- check:
156
- - user: identity_account:mallory
157
- object: agent_instance:sara-default
158
- assertions:
159
- can_view: false
160
- can_execute: false
161
-
162
- - name: personal instances never leak through the parent agent
163
- check:
164
- # Swarup owns the agent itself, but alice's personal instance has no
165
- # default_of tuple — only she (its owner) can reach it.
166
- - user: identity_account:swarup
167
- object: agent_instance:alice-personal
168
- assertions:
169
- can_view: false
170
- - user: identity_account:alice
171
- object: agent_instance:alice-personal
172
- assertions:
173
- can_view: true
174
- can_edit: true
175
-
176
- - name: org members reach the default instance of an org-visible agent
177
- check:
178
- - user: identity_account:priya
179
- object: agent_instance:internal-default
180
- assertions:
181
- can_view: true
182
- can_execute: true
183
- can_edit: false
184
- # cloud#257: the default_of chain reaches org viewer-role users too —
185
- # the viewer-shaped org tuple on the parent agent is the org's full
186
- # read audience, and the default instance inherits it structurally.
187
- - user: identity_account:veda
188
- object: agent_instance:internal-default
189
- assertions:
190
- can_view: true
191
- can_edit: false
192
- # Managed-org membership grants nothing on non-platform-shared agents.
193
- - user: identity_account:alice
194
- object: agent_instance:internal-default
195
- assertions:
196
- can_view: false
197
-
198
- - name: managed-org member reaches the default instance of a platform-shared workflow
199
- check:
200
- - user: identity_account:alice
201
- object: workflow_instance:onboarding-default
202
- assertions:
203
- can_view: true
204
- can_execute: true
205
- can_edit: false
206
-
207
- - name: list managed-org member's viewable agent instances resolves the default_of chain
208
- list_objects:
209
- - user: identity_account:alice
210
- type: agent_instance
211
- assertions:
212
- can_view:
213
- - agent_instance:sara-default
214
- - agent_instance:alice-personal
@@ -1,129 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/mcp-server-authoring.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 MCP-server authoring: an MCP server is an organization's
6
- # blueprint, so creating one takes the organization's admin bar
7
- # (can_create_mcp_server: admin), the bar agents, workflows and skills
8
- # already take. Until stigmer#1209 (v3.22.0) the create ran no check in
9
- # either edition and any member could author one; these pin the bar and
10
- # the story it leaves for members: an admin authors the server org-visible
11
- # and a member connects it (can_connect) with their own credentials, while
12
- # a private server stays the owner's and the admins'.
13
- #
14
- # Run: fga model test --tests mcp-server-authoring.fga.yaml
15
-
16
- name: mcp-server-authoring
17
- model_file: ../model/fga.mod
18
-
19
- tuples:
20
- # Org acme: olivia owns it, oscar administers, dave is a plain member,
21
- # vera a read-only viewer; mallory belongs to an unrelated org.
22
- - user: identity_account:olivia
23
- relation: owner
24
- object: organization:acme
25
- - user: identity_account:oscar
26
- relation: admin
27
- object: organization:acme
28
- - user: identity_account:dave
29
- relation: member
30
- object: organization:acme
31
- - user: identity_account:vera
32
- relation: viewer
33
- object: organization:acme
34
- - user: identity_account:mallory
35
- relation: member
36
- object: organization:other
37
-
38
- # An ORG-visible server oscar authored (the org viewer tuple the
39
- # visibility writer emits).
40
- - user: organization:acme
41
- relation: organization
42
- object: mcp_server:github
43
- - user: identity_account:oscar
44
- relation: owner
45
- object: mcp_server:github
46
- - user: organization:acme#viewer
47
- relation: viewer
48
- object: mcp_server:github
49
-
50
- # A PRIVATE server oscar authored (no visibility tuple).
51
- - user: organization:acme
52
- relation: organization
53
- object: mcp_server:vault
54
- - user: identity_account:oscar
55
- relation: owner
56
- object: mcp_server:vault
57
-
58
- tests:
59
- - name: authoring an MCP server is an admin act, the blueprint bar
60
- check:
61
- - user: identity_account:olivia
62
- object: organization:acme
63
- assertions:
64
- can_create_mcp_server: true
65
- can_create_agent: true
66
- - user: identity_account:oscar
67
- object: organization:acme
68
- assertions:
69
- can_create_mcp_server: true
70
- can_create_agent: true
71
-
72
- - name: a member, a viewer and an outsider cannot author one
73
- check:
74
- - user: identity_account:dave
75
- object: organization:acme
76
- assertions:
77
- can_create_mcp_server: false
78
- - user: identity_account:vera
79
- object: organization:acme
80
- assertions:
81
- can_create_mcp_server: false
82
- - user: identity_account:mallory
83
- object: organization:acme
84
- assertions:
85
- can_create_mcp_server: false
86
-
87
- - name: a member connects an admin-authored org-visible server with their own credentials
88
- check:
89
- - user: identity_account:dave
90
- object: mcp_server:github
91
- assertions:
92
- can_view: true
93
- can_connect: true
94
- can_edit: false
95
- - user: identity_account:vera
96
- object: mcp_server:github
97
- assertions:
98
- can_view: true
99
- can_connect: true
100
- can_edit: false
101
- - user: identity_account:mallory
102
- object: mcp_server:github
103
- assertions:
104
- can_view: false
105
- can_connect: false
106
-
107
- - name: a private server stays with its author and the org admins
108
- check:
109
- - user: identity_account:oscar
110
- object: mcp_server:vault
111
- assertions:
112
- can_view: true
113
- can_connect: true
114
- can_edit: true
115
- - user: identity_account:olivia
116
- object: mcp_server:vault
117
- assertions:
118
- can_view: true
119
- can_edit: true
120
- - user: identity_account:dave
121
- object: mcp_server:vault
122
- assertions:
123
- can_view: false
124
- can_connect: false
125
- - user: identity_account:vera
126
- object: mcp_server:vault
127
- assertions:
128
- can_view: false
129
- can_connect: false
@@ -1,72 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/memory-subject-only.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
- # Memory is subject-only (DD-004 as ratified): the identity account the
6
- # memory is ABOUT is its only principal. These tests pin the platform's
7
- # strictest model — org membership grants nothing, org ADMINSHIP grants
8
- # nothing (admins govern the memory_enabled switch, never the content),
9
- # and nothing is grantable.
10
-
11
- name: memory-subject-only
12
- model_file: ../model/fga.mod
13
-
14
- tuples:
15
- # Org membership and adminship — proving both grant nothing on memories.
16
- - user: identity_account:alice
17
- relation: member
18
- object: organization:acme
19
- - user: identity_account:mallory
20
- relation: member
21
- object: organization:acme
22
- - user: identity_account:ana
23
- relation: admin
24
- object: organization:acme
25
-
26
- # Alice's memory (the config-driven create tuples: org + subject).
27
- - user: organization:acme
28
- relation: organization
29
- object: memory:mem-alice-terse
30
- - user: identity_account:alice
31
- relation: subject
32
- object: memory:mem-alice-terse
33
-
34
- tests:
35
- - name: the subject has full control over their own memory
36
- check:
37
- - user: identity_account:alice
38
- object: memory:mem-alice-terse
39
- assertions:
40
- can_view: true
41
- can_edit: true
42
- can_delete: true
43
-
44
- - name: a fellow org member sees and touches nothing
45
- check:
46
- - user: identity_account:mallory
47
- object: memory:mem-alice-terse
48
- assertions:
49
- can_view: false
50
- can_edit: false
51
- can_delete: false
52
-
53
- - name: an org ADMIN sees and touches nothing — the setting, never the entries
54
- check:
55
- - user: identity_account:ana
56
- object: memory:mem-alice-terse
57
- assertions:
58
- can_view: false
59
- can_edit: false
60
- can_delete: false
61
-
62
- - name: list-objects returns only the subject's own records
63
- list_objects:
64
- - user: identity_account:alice
65
- type: memory
66
- assertions:
67
- can_view:
68
- - memory:mem-alice-terse
69
- - user: identity_account:mallory
70
- type: memory
71
- assertions:
72
- can_view: []