@stigmer/server 3.27.2 → 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 (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 +3114 -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 +18 -2
  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 +91 -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 +102 -276
  70. package/src/authorization/model/bindings.ts +131 -0
  71. package/src/authorization/model/data/authorization-model.json +3114 -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 +30 -3
  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,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: []
@@ -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