@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,308 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/org-admin-owner-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 org-admin owner inheritance (T08).
6
- #
7
- # Blueprint kinds — agent, agent_share, agent_channel, channel_app,
8
- # schedule, skill, workflow, plugin — compose org admins into `owner`:
9
- #
10
- # define owner: [identity_account] or admin from organization
11
- #
12
- # This is the GitHub-org-admin model (precedent: mcp_server, iam_policy,
13
- # invitation): every org asset has an operator of last resort, so
14
- # machine-provisioned and ex-employee resources stay manageable. Because
15
- # owner feeds viewer (and can_execute on agents), admins also see, list,
16
- # and run PRIVATE blueprints — a deliberate, accepted trade recorded in the
17
- # T08 design decision.
18
- #
19
- # The four personal/secret kinds — agent_instance, environment, session,
20
- # workflow_instance — deliberately do NOT inherit. Their fixtures below
21
- # carry the organization tuple, so these tests would fail loudly if
22
- # inheritance were ever wrongly added to them.
23
- #
24
- # Run with:
25
- # fga model test --tests org-admin-owner-inheritance.fga.yaml
26
- #
27
- # Scenario: org "acme" has org owner root, org admin ana, and plain member
28
- # dave. carol (a plain member) created one PRIVATE resource of each
29
- # inherited kind, plus one of each excluded kind. zara is an admin of the
30
- # unrelated org "other".
31
- name: org-admin-owner-inheritance
32
- model_file: ../model/fga.mod
33
-
34
- tuples:
35
- # --- Org roles ---
36
- - user: identity_account:root
37
- relation: owner
38
- object: organization:acme
39
- - user: identity_account:ana
40
- relation: admin
41
- object: organization:acme
42
- - user: identity_account:dave
43
- relation: member
44
- object: organization:acme
45
- - user: identity_account:carol
46
- relation: member
47
- object: organization:acme
48
- - user: identity_account:zara
49
- relation: admin
50
- object: organization:other
51
-
52
- # --- carol's PRIVATE blueprints (creation tuples only) ---
53
- - user: organization:acme
54
- relation: organization
55
- object: agent:carols-bot
56
- - user: identity_account:carol
57
- relation: owner
58
- object: agent:carols-bot
59
- - user: organization:acme
60
- relation: organization
61
- object: agent_share:carols-bot-share
62
- - user: identity_account:carol
63
- relation: owner
64
- object: agent_share:carols-bot-share
65
- - user: organization:acme
66
- relation: organization
67
- object: agent_channel:carols-bot-slack
68
- - user: identity_account:carol
69
- relation: owner
70
- object: agent_channel:carols-bot-slack
71
- - user: organization:acme
72
- relation: organization
73
- object: channel_app:carols-slack-app
74
- - user: identity_account:carol
75
- relation: owner
76
- object: channel_app:carols-slack-app
77
- - user: organization:acme
78
- relation: organization
79
- object: schedule:carols-reminders
80
- - user: identity_account:carol
81
- relation: owner
82
- object: schedule:carols-reminders
83
- - user: organization:acme
84
- relation: organization
85
- object: skill:carols-notes
86
- - user: identity_account:carol
87
- relation: owner
88
- object: skill:carols-notes
89
- - user: organization:acme
90
- relation: organization
91
- object: workflow:carols-flow
92
- - user: identity_account:carol
93
- relation: owner
94
- object: workflow:carols-flow
95
- - user: organization:acme
96
- relation: organization
97
- object: plugin:carols-plugin
98
- - user: identity_account:carol
99
- relation: owner
100
- object: plugin:carols-plugin
101
-
102
- # --- carol's personal resources (organization tuple present, so a
103
- # wrongly-added inheritance WOULD resolve — these must stay denied) ---
104
- - user: organization:acme
105
- relation: organization
106
- object: agent_instance:carols-instance
107
- - user: agent:carols-bot
108
- relation: agent
109
- object: agent_instance:carols-instance
110
- - user: identity_account:carol
111
- relation: owner
112
- object: agent_instance:carols-instance
113
- - user: organization:acme
114
- relation: organization
115
- object: environment:carols-secrets
116
- - user: identity_account:carol
117
- relation: owner
118
- object: environment:carols-secrets
119
- - user: identity_account:carol
120
- relation: creator
121
- object: environment:carols-secrets
122
- - user: organization:acme
123
- relation: organization
124
- object: session:carols-chat
125
- - user: identity_account:carol
126
- relation: owner
127
- object: session:carols-chat
128
-
129
- tests:
130
- - name: org admin inherits full management of every blueprint kind
131
- check:
132
- - user: identity_account:ana
133
- object: agent:carols-bot
134
- assertions:
135
- can_view: true
136
- can_edit: true
137
- can_delete: true
138
- can_grant_access: true
139
- can_execute: true
140
- - user: identity_account:ana
141
- object: agent_share:carols-bot-share
142
- assertions:
143
- can_view: true
144
- can_edit: true
145
- can_delete: true
146
- can_grant_access: true
147
- - user: identity_account:ana
148
- object: agent_channel:carols-bot-slack
149
- assertions:
150
- can_view: true
151
- can_edit: true
152
- can_delete: true
153
- can_grant_access: true
154
- - user: identity_account:ana
155
- object: channel_app:carols-slack-app
156
- assertions:
157
- can_view: true
158
- can_edit: true
159
- can_delete: true
160
- can_grant_access: true
161
- - user: identity_account:ana
162
- object: schedule:carols-reminders
163
- assertions:
164
- can_view: true
165
- can_edit: true
166
- can_delete: true
167
- can_grant_access: true
168
- - user: identity_account:ana
169
- object: skill:carols-notes
170
- assertions:
171
- can_view: true
172
- can_edit: true
173
- can_delete: true
174
- can_grant_access: true
175
- - user: identity_account:ana
176
- object: workflow:carols-flow
177
- assertions:
178
- can_view: true
179
- can_edit: true
180
- can_delete: true
181
- can_grant_access: true
182
- - user: identity_account:ana
183
- object: plugin:carols-plugin
184
- assertions:
185
- can_view: true
186
- can_edit: true
187
- can_delete: true
188
- can_grant_access: true
189
-
190
- - name: org owner inherits through the admin hierarchy
191
- check:
192
- - user: identity_account:root
193
- object: agent:carols-bot
194
- assertions:
195
- can_edit: true
196
- can_delete: true
197
- can_grant_access: true
198
- - user: identity_account:root
199
- object: agent_share:carols-bot-share
200
- assertions:
201
- can_edit: true
202
- can_delete: true
203
- - user: identity_account:root
204
- object: agent_channel:carols-bot-slack
205
- assertions:
206
- can_edit: true
207
- can_delete: true
208
-
209
- - name: plain org member still has nothing on private blueprints
210
- check:
211
- - user: identity_account:dave
212
- object: agent:carols-bot
213
- assertions:
214
- can_view: false
215
- can_edit: false
216
- can_delete: false
217
- can_grant_access: false
218
- - user: identity_account:dave
219
- object: agent_share:carols-bot-share
220
- assertions:
221
- can_view: false
222
- can_edit: false
223
- - user: identity_account:dave
224
- object: agent_channel:carols-bot-slack
225
- assertions:
226
- can_view: false
227
- can_edit: false
228
- - user: identity_account:dave
229
- object: channel_app:carols-slack-app
230
- assertions:
231
- can_view: false
232
- can_edit: false
233
- - user: identity_account:dave
234
- object: schedule:carols-reminders
235
- assertions:
236
- can_view: false
237
- can_edit: false
238
-
239
- - name: admin of an unrelated org has nothing
240
- check:
241
- - user: identity_account:zara
242
- object: agent:carols-bot
243
- assertions:
244
- can_view: false
245
- can_edit: false
246
- can_delete: false
247
- - user: identity_account:zara
248
- object: plugin:carols-plugin
249
- assertions:
250
- can_view: false
251
- can_edit: false
252
-
253
- - name: personal kinds stay admin-excluded (privacy invariant)
254
- check:
255
- - user: identity_account:ana
256
- object: agent_instance:carols-instance
257
- assertions:
258
- can_view: false
259
- can_edit: false
260
- can_delete: false
261
- - user: identity_account:ana
262
- object: environment:carols-secrets
263
- assertions:
264
- can_view: false
265
- can_edit: false
266
- can_delete: false
267
- can_read_secrets: false
268
- - user: identity_account:ana
269
- object: session:carols-chat
270
- assertions:
271
- can_view: false
272
- can_edit: false
273
- can_delete: false
274
- # The org OWNER is admin-and-above — the exclusion must hold for
275
- # them too.
276
- - user: identity_account:root
277
- object: environment:carols-secrets
278
- assertions:
279
- can_view: false
280
- can_read_secrets: false
281
-
282
- - name: creator keeps everything (inheritance adds, never subtracts)
283
- check:
284
- - user: identity_account:carol
285
- object: agent:carols-bot
286
- assertions:
287
- can_view: true
288
- can_edit: true
289
- can_delete: true
290
- can_grant_access: true
291
-
292
- - name: admin's listable resources include private blueprints, never personal kinds
293
- list_objects:
294
- - user: identity_account:ana
295
- type: agent
296
- assertions:
297
- can_view:
298
- - agent:carols-bot
299
- can_edit:
300
- - agent:carols-bot
301
- - user: identity_account:ana
302
- type: agent_instance
303
- assertions:
304
- can_view: []
305
- - user: identity_account:ana
306
- type: session
307
- assertions:
308
- can_view: []
@@ -1,144 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/org-shared-environment.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 org-shared environments (T06).
6
- #
7
- # Environments are personal resources with opt-in org sharing. Setting
8
- # visibility_org writes one tuple (viewer@organization:<org>#viewer — the
9
- # org's full read audience, cloud#257) that grants everyone in the org
10
- # REDACTED view only. The creator-only secret-reveal
11
- # invariant holds at every level: can_read_secrets never widens with
12
- # sharing. Runtime resolution for executions is app-level (server-side
13
- # policy on metadata.visibility), deliberately NOT modeled here — no FGA
14
- # relation could allow a member's execution to use a secret while denying
15
- # the same member's reveal.
16
- #
17
- # Run with:
18
- # fga model test --tests org-shared-environment.fga.yaml
19
- #
20
- # Scenario: org "acme" has creator carol, plain member dave, read-only
21
- # viewer vera, and an explicit viewer grant for frank on the private
22
- # environment; mallory belongs to an unrelated org. Carol owns a PRIVATE environment and an
23
- # ORG-shared environment.
24
- name: org-shared-environment
25
- model_file: ../model/fga.mod
26
-
27
- tuples:
28
- # --- Org memberships ---
29
- - user: identity_account:carol
30
- relation: member
31
- object: organization:acme
32
- - user: identity_account:dave
33
- relation: member
34
- object: organization:acme
35
- - user: identity_account:frank
36
- relation: member
37
- object: organization:acme
38
- - user: identity_account:vera
39
- relation: viewer
40
- object: organization:acme
41
- - user: identity_account:mallory
42
- relation: member
43
- object: organization:outsider
44
-
45
- # --- PRIVATE environment (creation tuples only) ---
46
- - user: organization:acme
47
- relation: organization
48
- object: environment:private-creds
49
- - user: identity_account:carol
50
- relation: owner
51
- object: environment:private-creds
52
- - user: identity_account:carol
53
- relation: creator
54
- object: environment:private-creds
55
- # Explicit viewer grant to frank (redacted view, no secret reveal).
56
- - user: identity_account:frank
57
- relation: viewer
58
- object: environment:private-creds
59
-
60
- # --- ORG-shared environment (creation tuples + the org viewer tuple) ---
61
- - user: organization:acme
62
- relation: organization
63
- object: environment:team-creds
64
- - user: identity_account:carol
65
- relation: owner
66
- object: environment:team-creds
67
- - user: identity_account:carol
68
- relation: creator
69
- object: environment:team-creds
70
- - user: organization:acme#viewer
71
- relation: viewer
72
- object: environment:team-creds
73
-
74
- tests:
75
- - name: private-environment-invisible-to-org-members
76
- check:
77
- - user: identity_account:dave
78
- object: environment:private-creds
79
- assertions:
80
- can_view: false
81
- can_edit: false
82
- can_read_secrets: false
83
-
84
- - name: explicit-viewer-grant-is-redacted-view-only
85
- check:
86
- - user: identity_account:frank
87
- object: environment:private-creds
88
- assertions:
89
- can_view: true
90
- can_edit: false
91
- can_read_secrets: false
92
-
93
- - name: org-sharing-grants-members-redacted-view-only
94
- check:
95
- - user: identity_account:dave
96
- object: environment:team-creds
97
- assertions:
98
- can_view: true
99
- can_edit: false
100
- can_delete: false
101
- can_grant_access: false
102
- # THE invariant: org sharing never widens secret reveal.
103
- can_read_secrets: false
104
-
105
- - name: org-sharing-reaches-read-only-viewers-redacted-too
106
- check:
107
- # cloud#257: the org viewer role is read-only by definition — an
108
- # org-shared environment is readable (REDACTED) to vera, secrets never.
109
- - user: identity_account:vera
110
- object: environment:team-creds
111
- assertions:
112
- can_view: true
113
- can_edit: false
114
- can_read_secrets: false
115
- - user: identity_account:vera
116
- object: environment:private-creds
117
- assertions:
118
- can_view: false
119
-
120
- - name: creator-keeps-full-access-on-shared-environment
121
- check:
122
- - user: identity_account:carol
123
- object: environment:team-creds
124
- assertions:
125
- can_view: true
126
- can_edit: true
127
- can_delete: true
128
- can_read_secrets: true
129
-
130
- - name: org-sharing-does-not-leak-across-orgs
131
- check:
132
- - user: identity_account:mallory
133
- object: environment:team-creds
134
- assertions:
135
- can_view: false
136
- can_read_secrets: false
137
-
138
- - name: org-members-can-list-shared-environments-only
139
- list_objects:
140
- - user: identity_account:dave
141
- type: environment
142
- assertions:
143
- can_view:
144
- - environment:team-creds
@@ -1,199 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/platform-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 platform visibility (visibility_platform).
6
- #
7
- # Verifies the userset chain end-to-end against the authorization model:
8
- #
9
- # blueprint#platform_viewer -> identity_provider#platform_user
10
- # -> member from managed_org -> organization#member
11
- #
12
- # Run with:
13
- # fga model test --tests platform-visibility.fga.yaml
14
- #
15
- # Scenario: "planton" is a platform org owning identity_provider:idp1, which
16
- # manages two customer orgs (acme, beta). Blueprints owned by planton and
17
- # shared with visibility_platform must be viewable/executable by acme and
18
- # beta members, invisible to members of an unrelated org, and never editable
19
- # by managed-org members.
20
- name: platform-visibility
21
- model_file: ../model/fga.mod
22
-
23
- tuples:
24
- # --- Platform tenancy: idp1 is owned by planton and manages acme + beta ---
25
- - user: organization:planton
26
- relation: organization
27
- object: identity_provider:idp1
28
- - user: organization:acme
29
- relation: managed_org
30
- object: identity_provider:idp1
31
- - user: organization:beta
32
- relation: managed_org
33
- object: identity_provider:idp1
34
-
35
- # --- Org memberships ---
36
- - user: identity_account:swarup
37
- relation: owner
38
- object: organization:planton
39
- - user: identity_account:priya
40
- relation: member
41
- object: organization:planton
42
- - user: identity_account:veda
43
- relation: viewer
44
- object: organization:planton
45
- - user: identity_account:alice
46
- relation: member
47
- object: organization:acme
48
- - user: identity_account:bob
49
- relation: member
50
- object: organization:beta
51
- - user: identity_account:mallory
52
- relation: member
53
- object: organization:outsider
54
-
55
- # --- Platform-shared agent (visibility_platform) owned by planton ---
56
- # PLATFORM carries the org floor tuple too (viewer@org#viewer — the org's
57
- # full read audience, cloud#257), exactly as VisibilityTupleReconciler
58
- # writes it, so everyone in the platform org keeps access.
59
- - user: organization:planton
60
- relation: organization
61
- object: agent:sara
62
- - user: identity_account:swarup
63
- relation: owner
64
- object: agent:sara
65
- - user: identity_provider:idp1#platform_user
66
- relation: platform_viewer
67
- object: agent:sara
68
- - user: organization:planton#viewer
69
- relation: viewer
70
- object: agent:sara
71
-
72
- # --- Private agent owned by planton (no platform_viewer tuple) ---
73
- - user: organization:planton
74
- relation: organization
75
- object: agent:internal-bot
76
- - user: identity_account:swarup
77
- relation: owner
78
- object: agent:internal-bot
79
-
80
- # --- Platform-shared blueprints of the other three kinds ---
81
- - user: organization:planton
82
- relation: organization
83
- object: skill:research
84
- - user: identity_provider:idp1#platform_user
85
- relation: platform_viewer
86
- object: skill:research
87
- - user: organization:planton
88
- relation: organization
89
- object: workflow:onboarding
90
- - user: identity_provider:idp1#platform_user
91
- relation: platform_viewer
92
- object: workflow:onboarding
93
- - user: organization:planton
94
- relation: organization
95
- object: mcp_server:github
96
- - user: identity_provider:idp1#platform_user
97
- relation: platform_viewer
98
- object: mcp_server:github
99
-
100
- tests:
101
- - name: managed-org members can view and execute a platform-shared agent
102
- check:
103
- - user: identity_account:alice
104
- object: agent:sara
105
- assertions:
106
- can_view: true
107
- can_execute: true
108
- can_create_instance: true
109
- can_edit: false
110
- can_delete: false
111
- - user: identity_account:bob
112
- object: agent:sara
113
- assertions:
114
- can_view: true
115
- can_execute: true
116
-
117
- - name: outsiders and unrelated orgs get nothing from platform visibility
118
- check:
119
- - user: identity_account:mallory
120
- object: agent:sara
121
- assertions:
122
- can_view: false
123
- can_execute: false
124
- can_create_instance: false
125
-
126
- - name: platform org's own members keep access via the org floor tuple
127
- check:
128
- - user: identity_account:priya
129
- object: agent:sara
130
- assertions:
131
- can_view: true
132
- can_execute: true
133
- can_edit: false
134
- # cloud#257: the viewer-shaped org floor reaches the platform org's own
135
- # read-only viewers too. (Managed-org audiences are deliberately
136
- # narrower: platform_user resolves member-from-managed_org.)
137
- - user: identity_account:veda
138
- object: agent:sara
139
- assertions:
140
- can_view: true
141
- can_edit: false
142
-
143
- - name: platform visibility does not leak the platform org's private agents
144
- check:
145
- - user: identity_account:alice
146
- object: agent:internal-bot
147
- assertions:
148
- can_view: false
149
- can_execute: false
150
- # Private is real: even the platform org's own members see nothing
151
- # without an explicit visibility tuple.
152
- - user: identity_account:priya
153
- object: agent:internal-bot
154
- assertions:
155
- can_view: false
156
- can_execute: false
157
-
158
- - name: platform-shared skill is usable by managed-org members
159
- check:
160
- - user: identity_account:alice
161
- object: skill:research
162
- assertions:
163
- can_view: true
164
- can_use: true
165
- can_edit: false
166
-
167
- - name: platform-shared workflow is viewable and executable by managed-org members
168
- check:
169
- - user: identity_account:alice
170
- object: workflow:onboarding
171
- assertions:
172
- can_view: true
173
- can_execute: true
174
-
175
- - name: platform-shared mcp_server is usable by managed-org members
176
- check:
177
- - user: identity_account:alice
178
- object: mcp_server:github
179
- assertions:
180
- can_view: true
181
- can_use: true
182
- can_connect: true
183
-
184
- - name: platform owner retains full control of shared blueprints
185
- check:
186
- - user: identity_account:swarup
187
- object: agent:sara
188
- assertions:
189
- can_view: true
190
- can_edit: true
191
- can_delete: true
192
-
193
- - name: list managed-org member's viewable agents includes only the shared one
194
- list_objects:
195
- - user: identity_account:alice
196
- type: agent
197
- assertions:
198
- can_view:
199
- - agent:sara
@@ -1,40 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/provider-standing-viewer.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 the provider-standing view permission (cloud#447).
6
- #
7
- # can_view_provider_standing gates the read-only operator console view of
8
- # platform provider standing (the canary-probe verdicts the cloud#370
9
- # probe records). It derives from the platform operator role — provider
10
- # account health is platform-internal, so ordinary tenants (even org
11
- # owners) never see it, regardless of what they own.
12
- #
13
- # Run with:
14
- # fga model test --tests provider-standing-viewer.fga.yaml
15
- name: provider-standing-viewer
16
- model_file: ../model/fga.mod
17
-
18
- tuples:
19
- # A platform operator.
20
- - user: identity_account:opal
21
- relation: operator
22
- object: platform:stigmer
23
-
24
- # A tenant org owner — owns everything in their org, nothing on the
25
- # platform.
26
- - user: identity_account:mallory
27
- relation: owner
28
- object: organization:acme
29
-
30
- tests:
31
- - name: operator may view provider standing, tenants may not
32
- check:
33
- - user: identity_account:opal
34
- object: platform:stigmer
35
- assertions:
36
- can_view_provider_standing: true
37
- - user: identity_account:mallory
38
- object: platform:stigmer
39
- assertions:
40
- can_view_provider_standing: false