@stigmer/server 3.27.2 → 3.29.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 (227) hide show
  1. package/README.md +2 -0
  2. package/dist/authorization/authorizer.d.ts +3 -3
  3. package/dist/authorization/authorizer.js +3 -3
  4. package/dist/authorization/derived-tuples.js +6 -1
  5. package/dist/authorization/derived-tuples.js.map +1 -1
  6. package/dist/authorization/evaluator.d.ts +9 -10
  7. package/dist/authorization/evaluator.d.ts.map +1 -1
  8. package/dist/authorization/evaluator.js.map +1 -1
  9. package/dist/authorization/list-read-scope.d.ts.map +1 -1
  10. package/dist/authorization/list-read-scope.js +29 -18
  11. package/dist/authorization/list-read-scope.js.map +1 -1
  12. package/dist/authorization/model/bindings.d.ts +41 -0
  13. package/dist/authorization/model/bindings.d.ts.map +1 -0
  14. package/dist/authorization/model/bindings.js +89 -0
  15. package/dist/authorization/model/bindings.js.map +1 -0
  16. package/dist/authorization/model/data/authorization-model.json +3141 -0
  17. package/dist/authorization/model/default-of.d.ts +2 -2
  18. package/dist/authorization/model/execution-viewer.d.ts +3 -0
  19. package/dist/authorization/model/execution-viewer.d.ts.map +1 -0
  20. package/dist/authorization/model/execution-viewer.js +50 -0
  21. package/dist/authorization/model/execution-viewer.js.map +1 -0
  22. package/dist/authorization/model/index.d.ts +33 -21
  23. package/dist/authorization/model/index.d.ts.map +1 -1
  24. package/dist/authorization/model/index.js +74 -52
  25. package/dist/authorization/model/index.js.map +1 -1
  26. package/dist/authorization/model/openfga-json.d.ts +18 -0
  27. package/dist/authorization/model/openfga-json.d.ts.map +1 -0
  28. package/dist/authorization/model/openfga-json.js +266 -0
  29. package/dist/authorization/model/openfga-json.js.map +1 -0
  30. package/dist/authorization/model/rewrite.d.ts +39 -67
  31. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  32. package/dist/authorization/model/rewrite.js +1 -117
  33. package/dist/authorization/model/rewrite.js.map +1 -1
  34. package/dist/authorization/strict-json.d.ts +20 -0
  35. package/dist/authorization/strict-json.d.ts.map +1 -0
  36. package/dist/authorization/strict-json.js +45 -0
  37. package/dist/authorization/strict-json.js.map +1 -0
  38. package/dist/boot/compose.d.ts.map +1 -1
  39. package/dist/boot/compose.js +9 -7
  40. package/dist/boot/compose.js.map +1 -1
  41. package/dist/domain/workflowexecution/list-index.d.ts +1 -1
  42. package/dist/extensions/list-read-scope.d.ts +20 -3
  43. package/dist/extensions/list-read-scope.d.ts.map +1 -1
  44. package/dist/extensions/list-read-scope.js +20 -1
  45. package/dist/extensions/list-read-scope.js.map +1 -1
  46. package/dist/index.d.ts +7 -8
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +15 -5
  49. package/dist/index.js.map +1 -1
  50. package/package.json +7 -6
  51. package/src/authorization/README.md +41 -34
  52. package/src/authorization/__tests__/authorizer.test.ts +5 -14
  53. package/src/authorization/__tests__/derived-tuples.test.ts +29 -27
  54. package/src/authorization/__tests__/evaluator.test.ts +53 -160
  55. package/src/authorization/__tests__/facts.test.ts +5 -11
  56. package/src/authorization/__tests__/list-read-scope.measure.test.ts +12 -20
  57. package/src/authorization/__tests__/list-read-scope.test.ts +15 -14
  58. package/src/authorization/__tests__/organization-directory.test.ts +2 -2
  59. package/src/authorization/__tests__/store-test-kit.ts +246 -0
  60. package/src/authorization/__tests__/store-tests.test.ts +92 -223
  61. package/src/authorization/__tests__/support.ts +30 -2
  62. package/src/authorization/__tests__/throwaway-model.ts +75 -0
  63. package/src/authorization/__tests__/wire-permissions.test.ts +141 -107
  64. package/src/authorization/authorizer.ts +3 -3
  65. package/src/authorization/derived-tuples.ts +7 -2
  66. package/src/authorization/evaluator.ts +8 -10
  67. package/src/authorization/list-read-scope.ts +37 -22
  68. package/src/authorization/model/__tests__/openfga-json.test.ts +353 -0
  69. package/src/authorization/model/__tests__/registry.test.ts +345 -277
  70. package/src/authorization/model/bindings.ts +131 -0
  71. package/src/authorization/model/data/authorization-model.json +3141 -0
  72. package/src/authorization/model/default-of.ts +2 -2
  73. package/src/authorization/model/execution-viewer.ts +56 -0
  74. package/src/authorization/model/index.ts +81 -72
  75. package/src/authorization/model/openfga-json.ts +310 -0
  76. package/src/authorization/model/rewrite.ts +39 -188
  77. package/src/authorization/strict-json.ts +52 -0
  78. package/src/boot/compose.ts +9 -7
  79. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +3 -6
  80. package/src/extensions/list-read-scope.ts +32 -4
  81. package/src/index.ts +15 -44
  82. package/dist/authorization/model/agent.d.ts +0 -2
  83. package/dist/authorization/model/agent.d.ts.map +0 -1
  84. package/dist/authorization/model/agent.js +0 -43
  85. package/dist/authorization/model/agent.js.map +0 -1
  86. package/dist/authorization/model/agent_channel.d.ts +0 -2
  87. package/dist/authorization/model/agent_channel.d.ts.map +0 -1
  88. package/dist/authorization/model/agent_channel.js +0 -39
  89. package/dist/authorization/model/agent_channel.js.map +0 -1
  90. package/dist/authorization/model/agent_execution.d.ts +0 -2
  91. package/dist/authorization/model/agent_execution.d.ts.map +0 -1
  92. package/dist/authorization/model/agent_execution.js +0 -25
  93. package/dist/authorization/model/agent_execution.js.map +0 -1
  94. package/dist/authorization/model/agent_instance.d.ts +0 -2
  95. package/dist/authorization/model/agent_instance.d.ts.map +0 -1
  96. package/dist/authorization/model/agent_instance.js +0 -48
  97. package/dist/authorization/model/agent_instance.js.map +0 -1
  98. package/dist/authorization/model/agent_share.d.ts +0 -2
  99. package/dist/authorization/model/agent_share.d.ts.map +0 -1
  100. package/dist/authorization/model/agent_share.js +0 -29
  101. package/dist/authorization/model/agent_share.js.map +0 -1
  102. package/dist/authorization/model/api_key.d.ts +0 -2
  103. package/dist/authorization/model/api_key.d.ts.map +0 -1
  104. package/dist/authorization/model/api_key.js +0 -27
  105. package/dist/authorization/model/api_key.js.map +0 -1
  106. package/dist/authorization/model/artifact.d.ts +0 -2
  107. package/dist/authorization/model/artifact.d.ts.map +0 -1
  108. package/dist/authorization/model/artifact.js +0 -27
  109. package/dist/authorization/model/artifact.js.map +0 -1
  110. package/dist/authorization/model/channel_app.d.ts +0 -2
  111. package/dist/authorization/model/channel_app.d.ts.map +0 -1
  112. package/dist/authorization/model/channel_app.js +0 -28
  113. package/dist/authorization/model/channel_app.js.map +0 -1
  114. package/dist/authorization/model/environment.d.ts +0 -2
  115. package/dist/authorization/model/environment.d.ts.map +0 -1
  116. package/dist/authorization/model/environment.js +0 -33
  117. package/dist/authorization/model/environment.js.map +0 -1
  118. package/dist/authorization/model/execution_context.d.ts +0 -2
  119. package/dist/authorization/model/execution_context.d.ts.map +0 -1
  120. package/dist/authorization/model/execution_context.js +0 -19
  121. package/dist/authorization/model/execution_context.js.map +0 -1
  122. package/dist/authorization/model/iam_policy.d.ts +0 -2
  123. package/dist/authorization/model/iam_policy.d.ts.map +0 -1
  124. package/dist/authorization/model/iam_policy.js +0 -31
  125. package/dist/authorization/model/iam_policy.js.map +0 -1
  126. package/dist/authorization/model/identity_account.d.ts +0 -2
  127. package/dist/authorization/model/identity_account.d.ts.map +0 -1
  128. package/dist/authorization/model/identity_account.js +0 -25
  129. package/dist/authorization/model/identity_account.js.map +0 -1
  130. package/dist/authorization/model/mcp_server.d.ts +0 -2
  131. package/dist/authorization/model/mcp_server.d.ts.map +0 -1
  132. package/dist/authorization/model/mcp_server.js +0 -38
  133. package/dist/authorization/model/mcp_server.js.map +0 -1
  134. package/dist/authorization/model/memory.d.ts +0 -2
  135. package/dist/authorization/model/memory.d.ts.map +0 -1
  136. package/dist/authorization/model/memory.js +0 -26
  137. package/dist/authorization/model/memory.js.map +0 -1
  138. package/dist/authorization/model/oauth_app.d.ts +0 -2
  139. package/dist/authorization/model/oauth_app.d.ts.map +0 -1
  140. package/dist/authorization/model/oauth_app.js +0 -31
  141. package/dist/authorization/model/oauth_app.js.map +0 -1
  142. package/dist/authorization/model/organization.d.ts +0 -2
  143. package/dist/authorization/model/organization.d.ts.map +0 -1
  144. package/dist/authorization/model/organization.js +0 -58
  145. package/dist/authorization/model/organization.js.map +0 -1
  146. package/dist/authorization/model/platform_client.d.ts +0 -2
  147. package/dist/authorization/model/platform_client.d.ts.map +0 -1
  148. package/dist/authorization/model/platform_client.js +0 -31
  149. package/dist/authorization/model/platform_client.js.map +0 -1
  150. package/dist/authorization/model/plugin.d.ts +0 -2
  151. package/dist/authorization/model/plugin.d.ts.map +0 -1
  152. package/dist/authorization/model/plugin.js +0 -45
  153. package/dist/authorization/model/plugin.js.map +0 -1
  154. package/dist/authorization/model/schedule.d.ts +0 -2
  155. package/dist/authorization/model/schedule.d.ts.map +0 -1
  156. package/dist/authorization/model/schedule.js +0 -34
  157. package/dist/authorization/model/schedule.js.map +0 -1
  158. package/dist/authorization/model/session.d.ts +0 -2
  159. package/dist/authorization/model/session.d.ts.map +0 -1
  160. package/dist/authorization/model/session.js +0 -38
  161. package/dist/authorization/model/session.js.map +0 -1
  162. package/dist/authorization/model/skill.d.ts +0 -2
  163. package/dist/authorization/model/skill.d.ts.map +0 -1
  164. package/dist/authorization/model/skill.js +0 -39
  165. package/dist/authorization/model/skill.js.map +0 -1
  166. package/dist/authorization/model/workflow.d.ts +0 -2
  167. package/dist/authorization/model/workflow.d.ts.map +0 -1
  168. package/dist/authorization/model/workflow.js +0 -39
  169. package/dist/authorization/model/workflow.js.map +0 -1
  170. package/dist/authorization/model/workflow_execution.d.ts +0 -2
  171. package/dist/authorization/model/workflow_execution.d.ts.map +0 -1
  172. package/dist/authorization/model/workflow_execution.js +0 -33
  173. package/dist/authorization/model/workflow_execution.js.map +0 -1
  174. package/dist/authorization/model/workflow_instance.d.ts +0 -2
  175. package/dist/authorization/model/workflow_instance.d.ts.map +0 -1
  176. package/dist/authorization/model/workflow_instance.js +0 -96
  177. package/dist/authorization/model/workflow_instance.js.map +0 -1
  178. package/dist/authorization/store-test-kit.d.ts +0 -62
  179. package/dist/authorization/store-test-kit.d.ts.map +0 -1
  180. package/dist/authorization/store-test-kit.js +0 -265
  181. package/dist/authorization/store-test-kit.js.map +0 -1
  182. package/src/authorization/__tests__/enterprise-model.ts +0 -59
  183. package/src/authorization/__tests__/fixtures/fga/agent-channel-owner.fga.yaml +0 -112
  184. package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +0 -177
  185. package/src/authorization/__tests__/fixtures/fga/agent-share-owner.fga.yaml +0 -109
  186. package/src/authorization/__tests__/fixtures/fga/artifact-org-and-owner.fga.yaml +0 -128
  187. package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +0 -318
  188. package/src/authorization/__tests__/fixtures/fga/channel-app-owner.fga.yaml +0 -125
  189. package/src/authorization/__tests__/fixtures/fga/channel-participation.fga.yaml +0 -201
  190. package/src/authorization/__tests__/fixtures/fga/channel-session-visibility.fga.yaml +0 -187
  191. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +0 -214
  192. package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +0 -129
  193. package/src/authorization/__tests__/fixtures/fga/memory-subject-only.fga.yaml +0 -72
  194. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +0 -308
  195. package/src/authorization/__tests__/fixtures/fga/org-shared-environment.fga.yaml +0 -144
  196. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +0 -199
  197. package/src/authorization/__tests__/fixtures/fga/provider-standing-viewer.fga.yaml +0 -40
  198. package/src/authorization/__tests__/fixtures/fga/reserved-label-writer.fga.yaml +0 -41
  199. package/src/authorization/__tests__/fixtures/fga/schedule-owner.fga.yaml +0 -113
  200. package/src/authorization/__tests__/fixtures/fga/schedule-session-visibility.fga.yaml +0 -214
  201. package/src/authorization/__tests__/fixtures/fga/session-personal-resource.fga.yaml +0 -117
  202. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +0 -190
  203. package/src/authorization/model/agent.ts +0 -64
  204. package/src/authorization/model/agent_channel.ts +0 -57
  205. package/src/authorization/model/agent_execution.ts +0 -33
  206. package/src/authorization/model/agent_instance.ts +0 -66
  207. package/src/authorization/model/agent_share.ts +0 -40
  208. package/src/authorization/model/api_key.ts +0 -28
  209. package/src/authorization/model/artifact.ts +0 -38
  210. package/src/authorization/model/channel_app.ts +0 -39
  211. package/src/authorization/model/environment.ts +0 -48
  212. package/src/authorization/model/execution_context.ts +0 -20
  213. package/src/authorization/model/iam_policy.ts +0 -42
  214. package/src/authorization/model/identity_account.ts +0 -26
  215. package/src/authorization/model/mcp_server.ts +0 -59
  216. package/src/authorization/model/memory.ts +0 -27
  217. package/src/authorization/model/oauth_app.ts +0 -43
  218. package/src/authorization/model/organization.ts +0 -59
  219. package/src/authorization/model/platform_client.ts +0 -43
  220. package/src/authorization/model/plugin.ts +0 -66
  221. package/src/authorization/model/schedule.ts +0 -49
  222. package/src/authorization/model/session.ts +0 -50
  223. package/src/authorization/model/skill.ts +0 -60
  224. package/src/authorization/model/workflow.ts +0 -60
  225. package/src/authorization/model/workflow_execution.ts +0 -46
  226. package/src/authorization/model/workflow_instance.ts +0 -125
  227. package/src/authorization/store-test-kit.ts +0 -395
@@ -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
@@ -1,41 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/reserved-label-writer.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 reserved-label write permission (cloud#320).
6
- #
7
- # can_write_reserved_labels gates who may introduce or change labels in
8
- # the reserved stigmer.ai/* namespace at client-facing write boundaries
9
- # (GuardReservedLabelsStep). It derives from the platform operator role
10
- # — the seeding machine account holds it, ordinary tenants (even org
11
- # owners) never do, regardless of what they own.
12
- #
13
- # Run with:
14
- # fga model test --tests reserved-label-writer.fga.yaml
15
- name: reserved-label-writer
16
- model_file: ../model/fga.mod
17
-
18
- tuples:
19
- # The bootstrap machine account is the platform operator
20
- # (BootstrapIdentitySeeder re-asserts this tuple on every boot).
21
- - user: identity_account:machine
22
- relation: operator
23
- object: platform:stigmer
24
-
25
- # A tenant org owner — owns everything in their org, nothing on the
26
- # platform.
27
- - user: identity_account:mallory
28
- relation: owner
29
- object: organization:acme
30
-
31
- tests:
32
- - name: operator may write reserved labels, tenants may not
33
- check:
34
- - user: identity_account:machine
35
- object: platform:stigmer
36
- assertions:
37
- can_write_reserved_labels: true
38
- - user: identity_account:mallory
39
- object: platform:stigmer
40
- assertions:
41
- can_write_reserved_labels: false
@@ -1,113 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/schedule-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
- # Schedules are owner-scoped operational config (whatsapp-proactive-
6
- # messaging DD-008/DD-009, cloned from the agent_channel model): the
7
- # creator owns the schedule; view/edit/delete require ownership or an
8
- # explicit grant. Plain org members get NO implicit access — a schedule's
9
- # levers are billing-affecting (every fire spends the owning org's
10
- # credits, unattended). Creation is target-gated (can_edit on the
11
- # referenced agent, checked in-handler), so no organization-level
12
- # can_create_schedule relation exists to test.
13
- #
14
- # Org ADMINS inherit owner (T08, consistent with agents and channels — an
15
- # admin who can edit the agent can manage its schedules). The narrowness
16
- # these tests pin: owner + admins have control, granted viewers read,
17
- # plain members have nothing.
18
- #
19
- # Run: fga model test --tests schedule-owner.fga.yaml
20
-
21
- name: schedule-owner
22
- model_file: ../model/fga.mod
23
-
24
- tuples:
25
- # Org membership for both accounts — proving membership grants nothing.
26
- - user: identity_account:alice
27
- relation: member
28
- object: organization:acme
29
- - user: identity_account:mallory
30
- relation: member
31
- object: organization:acme
32
-
33
- # Org admin — proving T08 inheritance reaches schedules.
34
- - user: identity_account:ana
35
- relation: admin
36
- object: organization:acme
37
-
38
- # The schedule, created by alice (the config-driven create tuples).
39
- - user: organization:acme
40
- relation: organization
41
- object: schedule:daily-fee-reminders
42
- - user: identity_account:alice
43
- relation: owner
44
- object: schedule:daily-fee-reminders
45
-
46
- # An explicit viewer grant to carol (not even an org member).
47
- - user: identity_account:carol
48
- relation: viewer
49
- object: schedule:daily-fee-reminders
50
-
51
- tests:
52
- - name: owner has full control including grant management
53
- check:
54
- - user: identity_account:alice
55
- object: schedule:daily-fee-reminders
56
- assertions:
57
- can_view: true
58
- can_edit: true
59
- can_delete: true
60
- can_grant_access: true
61
- can_view_access: true
62
-
63
- - name: explicitly granted viewer can read but not mutate
64
- check:
65
- - user: identity_account:carol
66
- object: schedule:daily-fee-reminders
67
- assertions:
68
- can_view: true
69
- can_edit: false
70
- can_delete: false
71
- can_grant_access: false
72
- can_view_access: true
73
-
74
- - name: fellow org member has no implicit access
75
- check:
76
- - user: identity_account:mallory
77
- object: schedule:daily-fee-reminders
78
- assertions:
79
- can_view: false
80
- can_edit: false
81
- can_delete: false
82
- can_grant_access: false
83
- can_view_access: false
84
-
85
- - name: org admin inherits schedule management (T08)
86
- check:
87
- - user: identity_account:ana
88
- object: schedule:daily-fee-reminders
89
- assertions:
90
- can_view: true
91
- can_edit: true
92
- can_delete: true
93
- can_grant_access: true
94
-
95
- - name: listing schedules reflects ownership and grants, not membership
96
- list_objects:
97
- - user: identity_account:alice
98
- type: schedule
99
- assertions:
100
- can_view:
101
- - schedule:daily-fee-reminders
102
- can_edit:
103
- - schedule:daily-fee-reminders
104
- - user: identity_account:carol
105
- type: schedule
106
- assertions:
107
- can_view:
108
- - schedule:daily-fee-reminders
109
- can_edit: []
110
- - user: identity_account:mallory
111
- type: schedule
112
- assertions:
113
- can_view: []
@@ -1,214 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/schedule-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 schedule-session read-only observability (the session
6
- # `schedule` structural link — project DD-012 D-E, the channel-session
7
- # idiom's second application).
8
- #
9
- # A session created by the schedule runtime carries a single
10
- # session#schedule@schedule:<id>
11
- # tuple and inherits the schedule's viewer set (creator owner + org admins
12
- # via `admin from organization` on schedule + explicit grantees) into
13
- # can_view ONLY — `viewer from schedule` is composed into session.can_view,
14
- # deliberately NOT into session.viewer, so schedule observers never gain
15
- # can_create_execution_in / can_edit / can_delete / can_grant_access
16
- # (injecting a console message into an unattended run is not
17
- # observability). Executions follow through agent_execution's
18
- # `can_view: viewer or can_view from session`.
19
- #
20
- # The personal-session invariant is untouched: console sessions never carry
21
- # a schedule tuple, so `viewer from schedule` resolves to nothing for them
22
- # (pinned below and by session-personal-resource.fga.yaml).
23
- #
24
- # Run with:
25
- # fga model test --tests schedule-session-visibility.fga.yaml
26
- #
27
- # Scenario: org "acme" has admin alice, member bob (who created the
28
- # fee-reminder schedule and owns it), member carol (no relation to the
29
- # schedule), and member dave (an explicit schedule viewer grant — the
30
- # console "share this schedule" affordance). "rival" is another org whose
31
- # admin eve must see nothing. The schedule session is owned by acme's
32
- # system-schedule account; bob also has a normal personal console session
33
- # to prove the invariant.
34
- name: schedule-session-visibility
35
- model_file: ../model/fga.mod
36
-
37
- tuples:
38
- # --- Org roles ---
39
- - user: identity_account:alice
40
- relation: admin
41
- object: organization:acme
42
- - user: identity_account:bob
43
- relation: member
44
- object: organization:acme
45
- - user: identity_account:carol
46
- relation: member
47
- object: organization:acme
48
- - user: identity_account:dave
49
- relation: member
50
- object: organization:acme
51
- - user: identity_account:eve
52
- relation: admin
53
- object: organization:rival
54
-
55
- # --- The Schedule (tuples written on create: org link + creator owner) ---
56
- - user: organization:acme
57
- relation: organization
58
- object: schedule:fee-reminder
59
- - user: identity_account:bob
60
- relation: owner
61
- object: schedule:fee-reminder
62
- # dave's explicit viewer grant on the schedule (never on the session):
63
- - user: identity_account:dave
64
- relation: viewer
65
- object: schedule:fee-reminder
66
-
67
- # --- The schedule session (owned by the org's system-schedule account) ---
68
- - user: organization:acme
69
- relation: organization
70
- object: session:scheduled-run
71
- - user: identity_account:sys-schedule-acme
72
- relation: owner
73
- object: session:scheduled-run
74
- # The structural link written by ScheduleSessionLinkStep:
75
- - user: schedule:fee-reminder
76
- relation: schedule
77
- object: session:scheduled-run
78
-
79
- # --- An execution inside the schedule session ---
80
- - user: session:scheduled-run
81
- relation: session
82
- object: agent_execution:scheduled-run-1
83
-
84
- # --- bob's ordinary personal console session (NO schedule tuple) ---
85
- - user: organization:acme
86
- relation: organization
87
- object: session:bobs-chat
88
- - user: identity_account:bob
89
- relation: owner
90
- object: session:bobs-chat
91
- - user: session:bobs-chat
92
- relation: session
93
- object: agent_execution:bobs-run-1
94
-
95
- tests:
96
- - name: schedule creator can view the run but only view it
97
- check:
98
- - user: identity_account:bob
99
- object: session:scheduled-run
100
- assertions:
101
- can_view: true
102
- can_create_execution_in: false
103
- can_edit: false
104
- can_delete: false
105
- can_grant_access: false
106
- can_view_access: false
107
-
108
- - name: org admin inherits view through the schedule, read-only
109
- check:
110
- - user: identity_account:alice
111
- object: session:scheduled-run
112
- assertions:
113
- can_view: true
114
- can_create_execution_in: false
115
- can_edit: false
116
- can_delete: false
117
- can_grant_access: false
118
-
119
- - name: plain org member without schedule access sees nothing
120
- check:
121
- - user: identity_account:carol
122
- object: session:scheduled-run
123
- assertions:
124
- can_view: false
125
- can_create_execution_in: false
126
-
127
- - name: another org's admin sees nothing
128
- check:
129
- - user: identity_account:eve
130
- object: session:scheduled-run
131
- assertions:
132
- can_view: false
133
-
134
- - name: the system-schedule account keeps full session ownership
135
- check:
136
- - user: identity_account:sys-schedule-acme
137
- object: session:scheduled-run
138
- assertions:
139
- can_view: true
140
- can_create_execution_in: true
141
- can_edit: true
142
- can_delete: true
143
-
144
- - name: executions inherit read-only schedule observability
145
- check:
146
- - user: identity_account:bob
147
- object: agent_execution:scheduled-run-1
148
- assertions:
149
- can_view: true
150
- can_edit: false
151
- - user: identity_account:alice
152
- object: agent_execution:scheduled-run-1
153
- assertions:
154
- can_view: true
155
- can_edit: false
156
- - user: identity_account:carol
157
- object: agent_execution:scheduled-run-1
158
- assertions:
159
- can_view: false
160
-
161
- - name: an explicit schedule viewer grant reaches the run read-only
162
- check:
163
- # dave holds schedule viewer only — he can open the runs, still
164
- # read-only, and gains nothing on the schedule's management levers.
165
- - user: identity_account:dave
166
- object: session:scheduled-run
167
- assertions:
168
- can_view: true
169
- can_create_execution_in: false
170
- can_edit: false
171
- - user: identity_account:dave
172
- object: agent_execution:scheduled-run-1
173
- assertions:
174
- can_view: true
175
- can_edit: false
176
-
177
- - name: personal-session invariant is untouched by the schedule model
178
- check:
179
- # Admin still has no path into a console session (no schedule tuple).
180
- - user: identity_account:alice
181
- object: session:bobs-chat
182
- assertions:
183
- can_view: false
184
- can_edit: false
185
- can_delete: false
186
- - user: identity_account:alice
187
- object: agent_execution:bobs-run-1
188
- assertions:
189
- can_view: false
190
- # And the owner's own access is unchanged.
191
- - user: identity_account:bob
192
- object: session:bobs-chat
193
- assertions:
194
- can_view: true
195
- can_edit: true
196
- can_create_execution_in: true
197
-
198
- - name: list viewable sessions resolves the schedule chain
199
- list_objects:
200
- - user: identity_account:alice
201
- type: session
202
- assertions:
203
- can_view:
204
- - session:scheduled-run
205
- - user: identity_account:bob
206
- type: session
207
- assertions:
208
- can_view:
209
- - session:scheduled-run
210
- - session:bobs-chat
211
- - user: identity_account:carol
212
- type: session
213
- assertions:
214
- can_view: []