@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.
- package/README.md +2 -0
- package/dist/authorization/authorizer.d.ts +3 -3
- package/dist/authorization/authorizer.js +3 -3
- package/dist/authorization/derived-tuples.js +6 -1
- package/dist/authorization/derived-tuples.js.map +1 -1
- package/dist/authorization/evaluator.d.ts +9 -10
- package/dist/authorization/evaluator.d.ts.map +1 -1
- package/dist/authorization/evaluator.js.map +1 -1
- package/dist/authorization/list-read-scope.d.ts.map +1 -1
- package/dist/authorization/list-read-scope.js +29 -18
- package/dist/authorization/list-read-scope.js.map +1 -1
- package/dist/authorization/model/bindings.d.ts +41 -0
- package/dist/authorization/model/bindings.d.ts.map +1 -0
- package/dist/authorization/model/bindings.js +89 -0
- package/dist/authorization/model/bindings.js.map +1 -0
- package/dist/authorization/model/data/authorization-model.json +3114 -0
- package/dist/authorization/model/default-of.d.ts +2 -2
- package/dist/authorization/model/execution-viewer.d.ts +3 -0
- package/dist/authorization/model/execution-viewer.d.ts.map +1 -0
- package/dist/authorization/model/execution-viewer.js +50 -0
- package/dist/authorization/model/execution-viewer.js.map +1 -0
- package/dist/authorization/model/index.d.ts +33 -21
- package/dist/authorization/model/index.d.ts.map +1 -1
- package/dist/authorization/model/index.js +74 -52
- package/dist/authorization/model/index.js.map +1 -1
- package/dist/authorization/model/openfga-json.d.ts +18 -0
- package/dist/authorization/model/openfga-json.d.ts.map +1 -0
- package/dist/authorization/model/openfga-json.js +266 -0
- package/dist/authorization/model/openfga-json.js.map +1 -0
- package/dist/authorization/model/rewrite.d.ts +39 -67
- package/dist/authorization/model/rewrite.d.ts.map +1 -1
- package/dist/authorization/model/rewrite.js +1 -117
- package/dist/authorization/model/rewrite.js.map +1 -1
- package/dist/authorization/strict-json.d.ts +20 -0
- package/dist/authorization/strict-json.d.ts.map +1 -0
- package/dist/authorization/strict-json.js +45 -0
- package/dist/authorization/strict-json.js.map +1 -0
- package/dist/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +9 -7
- package/dist/boot/compose.js.map +1 -1
- package/dist/domain/workflowexecution/list-index.d.ts +1 -1
- package/dist/extensions/list-read-scope.d.ts +18 -2
- package/dist/extensions/list-read-scope.d.ts.map +1 -1
- package/dist/extensions/list-read-scope.js +20 -1
- package/dist/extensions/list-read-scope.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/authorization/README.md +41 -34
- package/src/authorization/__tests__/authorizer.test.ts +5 -14
- package/src/authorization/__tests__/derived-tuples.test.ts +29 -27
- package/src/authorization/__tests__/evaluator.test.ts +53 -160
- package/src/authorization/__tests__/facts.test.ts +5 -11
- package/src/authorization/__tests__/list-read-scope.measure.test.ts +12 -20
- package/src/authorization/__tests__/list-read-scope.test.ts +15 -14
- package/src/authorization/__tests__/organization-directory.test.ts +2 -2
- package/src/authorization/__tests__/store-test-kit.ts +246 -0
- package/src/authorization/__tests__/store-tests.test.ts +91 -223
- package/src/authorization/__tests__/support.ts +30 -2
- package/src/authorization/__tests__/throwaway-model.ts +75 -0
- package/src/authorization/__tests__/wire-permissions.test.ts +141 -107
- package/src/authorization/authorizer.ts +3 -3
- package/src/authorization/derived-tuples.ts +7 -2
- package/src/authorization/evaluator.ts +8 -10
- package/src/authorization/list-read-scope.ts +37 -22
- package/src/authorization/model/__tests__/openfga-json.test.ts +353 -0
- package/src/authorization/model/__tests__/registry.test.ts +102 -276
- package/src/authorization/model/bindings.ts +131 -0
- package/src/authorization/model/data/authorization-model.json +3114 -0
- package/src/authorization/model/default-of.ts +2 -2
- package/src/authorization/model/execution-viewer.ts +56 -0
- package/src/authorization/model/index.ts +81 -72
- package/src/authorization/model/openfga-json.ts +310 -0
- package/src/authorization/model/rewrite.ts +39 -188
- package/src/authorization/strict-json.ts +52 -0
- package/src/boot/compose.ts +9 -7
- package/src/extensions/__tests__/built-in-authorization-composed.test.ts +3 -6
- package/src/extensions/list-read-scope.ts +30 -3
- package/src/index.ts +15 -44
- package/dist/authorization/model/agent.d.ts +0 -2
- package/dist/authorization/model/agent.d.ts.map +0 -1
- package/dist/authorization/model/agent.js +0 -43
- package/dist/authorization/model/agent.js.map +0 -1
- package/dist/authorization/model/agent_channel.d.ts +0 -2
- package/dist/authorization/model/agent_channel.d.ts.map +0 -1
- package/dist/authorization/model/agent_channel.js +0 -39
- package/dist/authorization/model/agent_channel.js.map +0 -1
- package/dist/authorization/model/agent_execution.d.ts +0 -2
- package/dist/authorization/model/agent_execution.d.ts.map +0 -1
- package/dist/authorization/model/agent_execution.js +0 -25
- package/dist/authorization/model/agent_execution.js.map +0 -1
- package/dist/authorization/model/agent_instance.d.ts +0 -2
- package/dist/authorization/model/agent_instance.d.ts.map +0 -1
- package/dist/authorization/model/agent_instance.js +0 -48
- package/dist/authorization/model/agent_instance.js.map +0 -1
- package/dist/authorization/model/agent_share.d.ts +0 -2
- package/dist/authorization/model/agent_share.d.ts.map +0 -1
- package/dist/authorization/model/agent_share.js +0 -29
- package/dist/authorization/model/agent_share.js.map +0 -1
- package/dist/authorization/model/api_key.d.ts +0 -2
- package/dist/authorization/model/api_key.d.ts.map +0 -1
- package/dist/authorization/model/api_key.js +0 -27
- package/dist/authorization/model/api_key.js.map +0 -1
- package/dist/authorization/model/artifact.d.ts +0 -2
- package/dist/authorization/model/artifact.d.ts.map +0 -1
- package/dist/authorization/model/artifact.js +0 -27
- package/dist/authorization/model/artifact.js.map +0 -1
- package/dist/authorization/model/channel_app.d.ts +0 -2
- package/dist/authorization/model/channel_app.d.ts.map +0 -1
- package/dist/authorization/model/channel_app.js +0 -28
- package/dist/authorization/model/channel_app.js.map +0 -1
- package/dist/authorization/model/environment.d.ts +0 -2
- package/dist/authorization/model/environment.d.ts.map +0 -1
- package/dist/authorization/model/environment.js +0 -33
- package/dist/authorization/model/environment.js.map +0 -1
- package/dist/authorization/model/execution_context.d.ts +0 -2
- package/dist/authorization/model/execution_context.d.ts.map +0 -1
- package/dist/authorization/model/execution_context.js +0 -19
- package/dist/authorization/model/execution_context.js.map +0 -1
- package/dist/authorization/model/iam_policy.d.ts +0 -2
- package/dist/authorization/model/iam_policy.d.ts.map +0 -1
- package/dist/authorization/model/iam_policy.js +0 -31
- package/dist/authorization/model/iam_policy.js.map +0 -1
- package/dist/authorization/model/identity_account.d.ts +0 -2
- package/dist/authorization/model/identity_account.d.ts.map +0 -1
- package/dist/authorization/model/identity_account.js +0 -25
- package/dist/authorization/model/identity_account.js.map +0 -1
- package/dist/authorization/model/mcp_server.d.ts +0 -2
- package/dist/authorization/model/mcp_server.d.ts.map +0 -1
- package/dist/authorization/model/mcp_server.js +0 -38
- package/dist/authorization/model/mcp_server.js.map +0 -1
- package/dist/authorization/model/memory.d.ts +0 -2
- package/dist/authorization/model/memory.d.ts.map +0 -1
- package/dist/authorization/model/memory.js +0 -26
- package/dist/authorization/model/memory.js.map +0 -1
- package/dist/authorization/model/oauth_app.d.ts +0 -2
- package/dist/authorization/model/oauth_app.d.ts.map +0 -1
- package/dist/authorization/model/oauth_app.js +0 -31
- package/dist/authorization/model/oauth_app.js.map +0 -1
- package/dist/authorization/model/organization.d.ts +0 -2
- package/dist/authorization/model/organization.d.ts.map +0 -1
- package/dist/authorization/model/organization.js +0 -58
- package/dist/authorization/model/organization.js.map +0 -1
- package/dist/authorization/model/platform_client.d.ts +0 -2
- package/dist/authorization/model/platform_client.d.ts.map +0 -1
- package/dist/authorization/model/platform_client.js +0 -31
- package/dist/authorization/model/platform_client.js.map +0 -1
- package/dist/authorization/model/plugin.d.ts +0 -2
- package/dist/authorization/model/plugin.d.ts.map +0 -1
- package/dist/authorization/model/plugin.js +0 -45
- package/dist/authorization/model/plugin.js.map +0 -1
- package/dist/authorization/model/schedule.d.ts +0 -2
- package/dist/authorization/model/schedule.d.ts.map +0 -1
- package/dist/authorization/model/schedule.js +0 -34
- package/dist/authorization/model/schedule.js.map +0 -1
- package/dist/authorization/model/session.d.ts +0 -2
- package/dist/authorization/model/session.d.ts.map +0 -1
- package/dist/authorization/model/session.js +0 -38
- package/dist/authorization/model/session.js.map +0 -1
- package/dist/authorization/model/skill.d.ts +0 -2
- package/dist/authorization/model/skill.d.ts.map +0 -1
- package/dist/authorization/model/skill.js +0 -39
- package/dist/authorization/model/skill.js.map +0 -1
- package/dist/authorization/model/workflow.d.ts +0 -2
- package/dist/authorization/model/workflow.d.ts.map +0 -1
- package/dist/authorization/model/workflow.js +0 -39
- package/dist/authorization/model/workflow.js.map +0 -1
- package/dist/authorization/model/workflow_execution.d.ts +0 -2
- package/dist/authorization/model/workflow_execution.d.ts.map +0 -1
- package/dist/authorization/model/workflow_execution.js +0 -33
- package/dist/authorization/model/workflow_execution.js.map +0 -1
- package/dist/authorization/model/workflow_instance.d.ts +0 -2
- package/dist/authorization/model/workflow_instance.d.ts.map +0 -1
- package/dist/authorization/model/workflow_instance.js +0 -96
- package/dist/authorization/model/workflow_instance.js.map +0 -1
- package/dist/authorization/store-test-kit.d.ts +0 -62
- package/dist/authorization/store-test-kit.d.ts.map +0 -1
- package/dist/authorization/store-test-kit.js +0 -265
- package/dist/authorization/store-test-kit.js.map +0 -1
- package/src/authorization/__tests__/enterprise-model.ts +0 -59
- package/src/authorization/__tests__/fixtures/fga/agent-channel-owner.fga.yaml +0 -112
- package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +0 -177
- package/src/authorization/__tests__/fixtures/fga/agent-share-owner.fga.yaml +0 -109
- package/src/authorization/__tests__/fixtures/fga/artifact-org-and-owner.fga.yaml +0 -128
- package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +0 -318
- package/src/authorization/__tests__/fixtures/fga/channel-app-owner.fga.yaml +0 -125
- package/src/authorization/__tests__/fixtures/fga/channel-participation.fga.yaml +0 -201
- package/src/authorization/__tests__/fixtures/fga/channel-session-visibility.fga.yaml +0 -187
- package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +0 -214
- package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +0 -129
- package/src/authorization/__tests__/fixtures/fga/memory-subject-only.fga.yaml +0 -72
- package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +0 -308
- package/src/authorization/__tests__/fixtures/fga/org-shared-environment.fga.yaml +0 -144
- package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +0 -199
- package/src/authorization/__tests__/fixtures/fga/provider-standing-viewer.fga.yaml +0 -40
- package/src/authorization/__tests__/fixtures/fga/reserved-label-writer.fga.yaml +0 -41
- package/src/authorization/__tests__/fixtures/fga/schedule-owner.fga.yaml +0 -113
- package/src/authorization/__tests__/fixtures/fga/schedule-session-visibility.fga.yaml +0 -214
- package/src/authorization/__tests__/fixtures/fga/session-personal-resource.fga.yaml +0 -117
- package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +0 -190
- package/src/authorization/model/agent.ts +0 -64
- package/src/authorization/model/agent_channel.ts +0 -57
- package/src/authorization/model/agent_execution.ts +0 -33
- package/src/authorization/model/agent_instance.ts +0 -66
- package/src/authorization/model/agent_share.ts +0 -40
- package/src/authorization/model/api_key.ts +0 -28
- package/src/authorization/model/artifact.ts +0 -38
- package/src/authorization/model/channel_app.ts +0 -39
- package/src/authorization/model/environment.ts +0 -48
- package/src/authorization/model/execution_context.ts +0 -20
- package/src/authorization/model/iam_policy.ts +0 -42
- package/src/authorization/model/identity_account.ts +0 -26
- package/src/authorization/model/mcp_server.ts +0 -59
- package/src/authorization/model/memory.ts +0 -27
- package/src/authorization/model/oauth_app.ts +0 -43
- package/src/authorization/model/organization.ts +0 -59
- package/src/authorization/model/platform_client.ts +0 -43
- package/src/authorization/model/plugin.ts +0 -66
- package/src/authorization/model/schedule.ts +0 -49
- package/src/authorization/model/session.ts +0 -50
- package/src/authorization/model/skill.ts +0 -60
- package/src/authorization/model/workflow.ts +0 -60
- package/src/authorization/model/workflow_execution.ts +0 -46
- package/src/authorization/model/workflow_instance.ts +0 -125
- package/src/authorization/store-test-kit.ts +0 -395
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
# Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/channel-participation.fga.yaml
|
|
2
|
-
# at commit b87dd1170 (the OpenFGA store test the cloud runs against its live model).
|
|
3
|
-
# The body below is byte-identical to the source; the cloud re-runs the LIVE
|
|
4
|
-
# file against this evaluator at the re-pin, so a stale copy is caught there.
|
|
5
|
-
# Store tests for conversation participation on agent channels (the
|
|
6
|
-
# `participant` relation and `can_participate` permission,
|
|
7
|
-
# channel-conversations DD-010).
|
|
8
|
-
#
|
|
9
|
-
# The model change under test, in one line each:
|
|
10
|
-
# participant: [identity_account] or owner (owner participates free)
|
|
11
|
-
# viewer: [identity_account] or participant (widened from `or owner`)
|
|
12
|
-
# can_participate: participant (the reply/takeover bar)
|
|
13
|
-
#
|
|
14
|
-
# The invariants this suite pins:
|
|
15
|
-
# 1. Read and speak are DIFFERENT powers: a granted viewer can see
|
|
16
|
-
# conversations but cannot participate (the DD-010 rejected
|
|
17
|
-
# alternative "widen viewer alone" stays rejected).
|
|
18
|
-
# 2. Participation is NOT configuration: a participant can never
|
|
19
|
-
# edit/delete/grant on the channel.
|
|
20
|
-
# 3. The viewer widening is behavior-preserving for existing grants:
|
|
21
|
-
# owner ⊆ participant ⊆ viewer, so every pre-DD-010 owner/admin
|
|
22
|
-
# read keeps working (asserted below, byte-identical semantics).
|
|
23
|
-
# 4. Conversation READ rides the existing session.can_view composition
|
|
24
|
-
# (`viewer from channel`) unchanged, still read-only — participants
|
|
25
|
-
# inherit view on channel sessions but never
|
|
26
|
-
# can_create_execution_in (DD-012's read-only-by-construction).
|
|
27
|
-
# 5. The personal-session invariant is untouched: a participant sees
|
|
28
|
-
# nothing of anyone's console sessions.
|
|
29
|
-
#
|
|
30
|
-
# Run with:
|
|
31
|
-
# fga model test --tests channel-participation.fga.yaml
|
|
32
|
-
#
|
|
33
|
-
# Scenario: org "acme" has admin alice, member bob (who connected the
|
|
34
|
-
# WhatsApp channel and owns it), member trina (an ISC trainer granted
|
|
35
|
-
# participant — the DD-010 launch persona), member carol (granted plain
|
|
36
|
-
# viewer), and member dave (no relation to the channel). "rival" is
|
|
37
|
-
# another org whose admin eve must see nothing. The channel session is
|
|
38
|
-
# owned by acme's system-channel account; bob also has a personal
|
|
39
|
-
# console session to prove invariant 5.
|
|
40
|
-
name: channel-participation
|
|
41
|
-
model_file: ../model/fga.mod
|
|
42
|
-
|
|
43
|
-
tuples:
|
|
44
|
-
# --- Org roles ---
|
|
45
|
-
- user: identity_account:alice
|
|
46
|
-
relation: admin
|
|
47
|
-
object: organization:acme
|
|
48
|
-
- user: identity_account:bob
|
|
49
|
-
relation: member
|
|
50
|
-
object: organization:acme
|
|
51
|
-
- user: identity_account:trina
|
|
52
|
-
relation: member
|
|
53
|
-
object: organization:acme
|
|
54
|
-
- user: identity_account:carol
|
|
55
|
-
relation: member
|
|
56
|
-
object: organization:acme
|
|
57
|
-
- user: identity_account:dave
|
|
58
|
-
relation: member
|
|
59
|
-
object: organization:acme
|
|
60
|
-
- user: identity_account:eve
|
|
61
|
-
relation: admin
|
|
62
|
-
object: organization:rival
|
|
63
|
-
|
|
64
|
-
# --- The AgentChannel (tuples written on create: org link + creator owner) ---
|
|
65
|
-
- user: organization:acme
|
|
66
|
-
relation: organization
|
|
67
|
-
object: agent_channel:wa-line
|
|
68
|
-
- user: identity_account:bob
|
|
69
|
-
relation: owner
|
|
70
|
-
object: agent_channel:wa-line
|
|
71
|
-
|
|
72
|
-
# --- The DD-010 grants (IamPolicy-written: participant vs plain viewer) ---
|
|
73
|
-
- user: identity_account:trina
|
|
74
|
-
relation: participant
|
|
75
|
-
object: agent_channel:wa-line
|
|
76
|
-
- user: identity_account:carol
|
|
77
|
-
relation: viewer
|
|
78
|
-
object: agent_channel:wa-line
|
|
79
|
-
|
|
80
|
-
# --- A channel session (owned by the org's system-channel account) ---
|
|
81
|
-
- user: organization:acme
|
|
82
|
-
relation: organization
|
|
83
|
-
object: session:member-chat
|
|
84
|
-
- user: identity_account:sys-channel-acme
|
|
85
|
-
relation: owner
|
|
86
|
-
object: session:member-chat
|
|
87
|
-
# The structural link written by ChannelSessionLinkStep:
|
|
88
|
-
- user: agent_channel:wa-line
|
|
89
|
-
relation: channel
|
|
90
|
-
object: session:member-chat
|
|
91
|
-
|
|
92
|
-
# --- Bob's personal console session (invariant 5's control subject) ---
|
|
93
|
-
- user: organization:acme
|
|
94
|
-
relation: organization
|
|
95
|
-
object: session:bobs-chat
|
|
96
|
-
- user: identity_account:bob
|
|
97
|
-
relation: owner
|
|
98
|
-
object: session:bobs-chat
|
|
99
|
-
|
|
100
|
-
tests:
|
|
101
|
-
- name: a granted participant may read and speak but never configure
|
|
102
|
-
check:
|
|
103
|
-
- user: identity_account:trina
|
|
104
|
-
object: agent_channel:wa-line
|
|
105
|
-
assertions:
|
|
106
|
-
can_view: true
|
|
107
|
-
can_participate: true
|
|
108
|
-
can_edit: false
|
|
109
|
-
can_delete: false
|
|
110
|
-
can_grant_access: false
|
|
111
|
-
can_view_access: true
|
|
112
|
-
|
|
113
|
-
- name: a granted viewer may read but never speak — read and speak are different powers
|
|
114
|
-
check:
|
|
115
|
-
- user: identity_account:carol
|
|
116
|
-
object: agent_channel:wa-line
|
|
117
|
-
assertions:
|
|
118
|
-
can_view: true
|
|
119
|
-
can_participate: false
|
|
120
|
-
can_edit: false
|
|
121
|
-
|
|
122
|
-
- name: the channel owner participates without an explicit tuple
|
|
123
|
-
check:
|
|
124
|
-
- user: identity_account:bob
|
|
125
|
-
object: agent_channel:wa-line
|
|
126
|
-
assertions:
|
|
127
|
-
can_view: true
|
|
128
|
-
can_participate: true
|
|
129
|
-
can_edit: true
|
|
130
|
-
can_delete: true
|
|
131
|
-
can_grant_access: true
|
|
132
|
-
|
|
133
|
-
- name: an org admin participates through owner inheritance, no tuple needed
|
|
134
|
-
check:
|
|
135
|
-
- user: identity_account:alice
|
|
136
|
-
object: agent_channel:wa-line
|
|
137
|
-
assertions:
|
|
138
|
-
can_view: true
|
|
139
|
-
can_participate: true
|
|
140
|
-
can_edit: true
|
|
141
|
-
|
|
142
|
-
- name: a plain org member has no access of any kind
|
|
143
|
-
check:
|
|
144
|
-
- user: identity_account:dave
|
|
145
|
-
object: agent_channel:wa-line
|
|
146
|
-
assertions:
|
|
147
|
-
can_view: false
|
|
148
|
-
can_participate: false
|
|
149
|
-
can_edit: false
|
|
150
|
-
can_delete: false
|
|
151
|
-
can_grant_access: false
|
|
152
|
-
can_view_access: false
|
|
153
|
-
|
|
154
|
-
- name: a foreign org admin has no access of any kind
|
|
155
|
-
check:
|
|
156
|
-
- user: identity_account:eve
|
|
157
|
-
object: agent_channel:wa-line
|
|
158
|
-
assertions:
|
|
159
|
-
can_view: false
|
|
160
|
-
can_participate: false
|
|
161
|
-
can_edit: false
|
|
162
|
-
|
|
163
|
-
- name: participants inherit channel-session read through the existing composition, read-only
|
|
164
|
-
check:
|
|
165
|
-
- user: identity_account:trina
|
|
166
|
-
object: session:member-chat
|
|
167
|
-
assertions:
|
|
168
|
-
can_view: true
|
|
169
|
-
can_create_execution_in: false
|
|
170
|
-
can_edit: false
|
|
171
|
-
can_delete: false
|
|
172
|
-
can_grant_access: false
|
|
173
|
-
|
|
174
|
-
- name: the personal-session invariant is untouched — a participant sees no console sessions
|
|
175
|
-
check:
|
|
176
|
-
- user: identity_account:trina
|
|
177
|
-
object: session:bobs-chat
|
|
178
|
-
assertions:
|
|
179
|
-
can_view: false
|
|
180
|
-
can_create_execution_in: false
|
|
181
|
-
|
|
182
|
-
- name: list viewable and participable channels resolve per grant (drives listConversations)
|
|
183
|
-
list_objects:
|
|
184
|
-
- user: identity_account:trina
|
|
185
|
-
type: agent_channel
|
|
186
|
-
assertions:
|
|
187
|
-
can_view:
|
|
188
|
-
- agent_channel:wa-line
|
|
189
|
-
can_participate:
|
|
190
|
-
- agent_channel:wa-line
|
|
191
|
-
- user: identity_account:carol
|
|
192
|
-
type: agent_channel
|
|
193
|
-
assertions:
|
|
194
|
-
can_view:
|
|
195
|
-
- agent_channel:wa-line
|
|
196
|
-
can_participate: []
|
|
197
|
-
- user: identity_account:dave
|
|
198
|
-
type: agent_channel
|
|
199
|
-
assertions:
|
|
200
|
-
can_view: []
|
|
201
|
-
can_participate: []
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/channel-session-visibility.fga.yaml
|
|
2
|
-
# at commit b87dd1170 (the OpenFGA store test the cloud runs against its live model).
|
|
3
|
-
# The body below is byte-identical to the source; the cloud re-runs the LIVE
|
|
4
|
-
# file against this evaluator at the re-pin, so a stale copy is caught there.
|
|
5
|
-
# Store tests for channel-session read-only observability (the session
|
|
6
|
-
# `channel` structural link).
|
|
7
|
-
#
|
|
8
|
-
# A session created by the channel runtime carries a single
|
|
9
|
-
# session#channel@agent_channel:<id>
|
|
10
|
-
# tuple and inherits the channel's viewer set (connector owner + org admins
|
|
11
|
-
# via `admin from organization` on agent_channel) into can_view ONLY —
|
|
12
|
-
# `viewer from channel` is composed into session.can_view, deliberately NOT
|
|
13
|
-
# into session.viewer, so channel observers never gain
|
|
14
|
-
# can_create_execution_in / can_edit / can_delete / can_grant_access.
|
|
15
|
-
# Executions follow through agent_execution's
|
|
16
|
-
# `can_view: viewer or can_view from session`.
|
|
17
|
-
#
|
|
18
|
-
# The personal-session invariant is untouched: console sessions never carry
|
|
19
|
-
# a channel tuple, so `viewer from channel` resolves to nothing for them
|
|
20
|
-
# (pinned below and by session-personal-resource.fga.yaml).
|
|
21
|
-
#
|
|
22
|
-
# Run with:
|
|
23
|
-
# fga model test --tests channel-session-visibility.fga.yaml
|
|
24
|
-
#
|
|
25
|
-
# Scenario: org "acme" has admin alice, member bob (who connected the Slack
|
|
26
|
-
# channel and owns it), and member carol (no relation to the channel).
|
|
27
|
-
# "rival" is another org whose admin eve must see nothing. The channel
|
|
28
|
-
# session is owned by acme's system-channel account; bob also has a normal
|
|
29
|
-
# personal console session to prove the invariant.
|
|
30
|
-
name: channel-session-visibility
|
|
31
|
-
model_file: ../model/fga.mod
|
|
32
|
-
|
|
33
|
-
tuples:
|
|
34
|
-
# --- Org roles ---
|
|
35
|
-
- user: identity_account:alice
|
|
36
|
-
relation: admin
|
|
37
|
-
object: organization:acme
|
|
38
|
-
- user: identity_account:bob
|
|
39
|
-
relation: member
|
|
40
|
-
object: organization:acme
|
|
41
|
-
- user: identity_account:carol
|
|
42
|
-
relation: member
|
|
43
|
-
object: organization:acme
|
|
44
|
-
- user: identity_account:eve
|
|
45
|
-
relation: admin
|
|
46
|
-
object: organization:rival
|
|
47
|
-
|
|
48
|
-
# --- The AgentChannel (tuples written on create: org link + creator owner) ---
|
|
49
|
-
- user: organization:acme
|
|
50
|
-
relation: organization
|
|
51
|
-
object: agent_channel:slack-conn
|
|
52
|
-
- user: identity_account:bob
|
|
53
|
-
relation: owner
|
|
54
|
-
object: agent_channel:slack-conn
|
|
55
|
-
|
|
56
|
-
# --- The channel session (owned by the org's system-channel account) ---
|
|
57
|
-
- user: organization:acme
|
|
58
|
-
relation: organization
|
|
59
|
-
object: session:channel-chat
|
|
60
|
-
- user: identity_account:sys-channel-acme
|
|
61
|
-
relation: owner
|
|
62
|
-
object: session:channel-chat
|
|
63
|
-
# The structural link written by ChannelSessionLinkStep:
|
|
64
|
-
- user: agent_channel:slack-conn
|
|
65
|
-
relation: channel
|
|
66
|
-
object: session:channel-chat
|
|
67
|
-
|
|
68
|
-
# --- An execution inside the channel session ---
|
|
69
|
-
- user: session:channel-chat
|
|
70
|
-
relation: session
|
|
71
|
-
object: agent_execution:channel-run-1
|
|
72
|
-
|
|
73
|
-
# --- bob's ordinary personal console session (NO channel tuple) ---
|
|
74
|
-
- user: organization:acme
|
|
75
|
-
relation: organization
|
|
76
|
-
object: session:bobs-chat
|
|
77
|
-
- user: identity_account:bob
|
|
78
|
-
relation: owner
|
|
79
|
-
object: session:bobs-chat
|
|
80
|
-
- user: session:bobs-chat
|
|
81
|
-
relation: session
|
|
82
|
-
object: agent_execution:bobs-run-1
|
|
83
|
-
|
|
84
|
-
tests:
|
|
85
|
-
- name: channel connector can view the conversation but only view it
|
|
86
|
-
check:
|
|
87
|
-
- user: identity_account:bob
|
|
88
|
-
object: session:channel-chat
|
|
89
|
-
assertions:
|
|
90
|
-
can_view: true
|
|
91
|
-
can_create_execution_in: false
|
|
92
|
-
can_edit: false
|
|
93
|
-
can_delete: false
|
|
94
|
-
can_grant_access: false
|
|
95
|
-
can_view_access: false
|
|
96
|
-
|
|
97
|
-
- name: org admin inherits view through the channel, read-only
|
|
98
|
-
check:
|
|
99
|
-
- user: identity_account:alice
|
|
100
|
-
object: session:channel-chat
|
|
101
|
-
assertions:
|
|
102
|
-
can_view: true
|
|
103
|
-
can_create_execution_in: false
|
|
104
|
-
can_edit: false
|
|
105
|
-
can_delete: false
|
|
106
|
-
can_grant_access: false
|
|
107
|
-
|
|
108
|
-
- name: plain org member without channel access sees nothing
|
|
109
|
-
check:
|
|
110
|
-
- user: identity_account:carol
|
|
111
|
-
object: session:channel-chat
|
|
112
|
-
assertions:
|
|
113
|
-
can_view: false
|
|
114
|
-
can_create_execution_in: false
|
|
115
|
-
|
|
116
|
-
- name: another org's admin sees nothing
|
|
117
|
-
check:
|
|
118
|
-
- user: identity_account:eve
|
|
119
|
-
object: session:channel-chat
|
|
120
|
-
assertions:
|
|
121
|
-
can_view: false
|
|
122
|
-
|
|
123
|
-
- name: the system-channel account keeps full session ownership
|
|
124
|
-
check:
|
|
125
|
-
- user: identity_account:sys-channel-acme
|
|
126
|
-
object: session:channel-chat
|
|
127
|
-
assertions:
|
|
128
|
-
can_view: true
|
|
129
|
-
can_create_execution_in: true
|
|
130
|
-
can_edit: true
|
|
131
|
-
can_delete: true
|
|
132
|
-
|
|
133
|
-
- name: executions inherit read-only channel observability
|
|
134
|
-
check:
|
|
135
|
-
- user: identity_account:bob
|
|
136
|
-
object: agent_execution:channel-run-1
|
|
137
|
-
assertions:
|
|
138
|
-
can_view: true
|
|
139
|
-
can_edit: false
|
|
140
|
-
- user: identity_account:alice
|
|
141
|
-
object: agent_execution:channel-run-1
|
|
142
|
-
assertions:
|
|
143
|
-
can_view: true
|
|
144
|
-
can_edit: false
|
|
145
|
-
- user: identity_account:carol
|
|
146
|
-
object: agent_execution:channel-run-1
|
|
147
|
-
assertions:
|
|
148
|
-
can_view: false
|
|
149
|
-
|
|
150
|
-
- name: personal-session invariant is untouched by the channel model
|
|
151
|
-
check:
|
|
152
|
-
# Admin still has no path into a console session (no channel tuple).
|
|
153
|
-
- user: identity_account:alice
|
|
154
|
-
object: session:bobs-chat
|
|
155
|
-
assertions:
|
|
156
|
-
can_view: false
|
|
157
|
-
can_edit: false
|
|
158
|
-
can_delete: false
|
|
159
|
-
- user: identity_account:alice
|
|
160
|
-
object: agent_execution:bobs-run-1
|
|
161
|
-
assertions:
|
|
162
|
-
can_view: false
|
|
163
|
-
# And the owner's own access is unchanged.
|
|
164
|
-
- user: identity_account:bob
|
|
165
|
-
object: session:bobs-chat
|
|
166
|
-
assertions:
|
|
167
|
-
can_view: true
|
|
168
|
-
can_edit: true
|
|
169
|
-
can_create_execution_in: true
|
|
170
|
-
|
|
171
|
-
- name: list viewable sessions resolves the channel chain (drives listByChannel)
|
|
172
|
-
list_objects:
|
|
173
|
-
- user: identity_account:alice
|
|
174
|
-
type: session
|
|
175
|
-
assertions:
|
|
176
|
-
can_view:
|
|
177
|
-
- session:channel-chat
|
|
178
|
-
- user: identity_account:bob
|
|
179
|
-
type: session
|
|
180
|
-
assertions:
|
|
181
|
-
can_view:
|
|
182
|
-
- session:channel-chat
|
|
183
|
-
- session:bobs-chat
|
|
184
|
-
- user: identity_account:carol
|
|
185
|
-
type: session
|
|
186
|
-
assertions:
|
|
187
|
-
can_view: []
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
# Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/default-instance-inheritance.fga.yaml
|
|
2
|
-
# as changed by stigmer-cloud#765 (the OpenFGA store test the cloud runs against its live model).
|
|
3
|
-
# The body below is byte-identical to the source; the cloud re-runs the LIVE
|
|
4
|
-
# file against this evaluator at the re-pin, so a stale copy is caught there.
|
|
5
|
-
# Store tests for default-instance structural inheritance (default_of).
|
|
6
|
-
#
|
|
7
|
-
# A blueprint's system-managed default instance carries a single
|
|
8
|
-
# instance#default_of@<blueprint>:<id>
|
|
9
|
-
# tuple and inherits the blueprint's ENTIRE viewer set through
|
|
10
|
-
# `viewer from default_of` — org members and platform users
|
|
11
|
-
# (identity_provider#platform_user). No enum-derived
|
|
12
|
-
# visibility tuples are ever written on default instances, so their access
|
|
13
|
-
# can never drift from the template's.
|
|
14
|
-
#
|
|
15
|
-
# Run with:
|
|
16
|
-
# fga model test --tests default-instance-inheritance.fga.yaml
|
|
17
|
-
#
|
|
18
|
-
# Scenario: "planton" is a platform org owning identity_provider:idp1 which
|
|
19
|
-
# manages customer org "acme". Planton authors agents/workflows at every
|
|
20
|
-
# visibility level; each has a default instance linked via default_of.
|
|
21
|
-
# Alice (acme member) reaches default instances of platform-shared
|
|
22
|
-
# blueprints; planton members reach default instances of org-visible ones;
|
|
23
|
-
# personal instances never leak.
|
|
24
|
-
name: default-instance-inheritance
|
|
25
|
-
model_file: ../model/fga.mod
|
|
26
|
-
|
|
27
|
-
tuples:
|
|
28
|
-
# --- Platform tenancy: idp1 is owned by planton and manages acme ---
|
|
29
|
-
- user: organization:planton
|
|
30
|
-
relation: organization
|
|
31
|
-
object: identity_provider:idp1
|
|
32
|
-
- user: organization:acme
|
|
33
|
-
relation: managed_org
|
|
34
|
-
object: identity_provider:idp1
|
|
35
|
-
|
|
36
|
-
# --- Org memberships ---
|
|
37
|
-
- user: identity_account:swarup
|
|
38
|
-
relation: owner
|
|
39
|
-
object: organization:planton
|
|
40
|
-
- user: identity_account:priya
|
|
41
|
-
relation: member
|
|
42
|
-
object: organization:planton
|
|
43
|
-
- user: identity_account:veda
|
|
44
|
-
relation: viewer
|
|
45
|
-
object: organization:planton
|
|
46
|
-
- user: identity_account:alice
|
|
47
|
-
relation: member
|
|
48
|
-
object: organization:acme
|
|
49
|
-
- user: identity_account:mallory
|
|
50
|
-
relation: member
|
|
51
|
-
object: organization:outsider
|
|
52
|
-
|
|
53
|
-
# --- Platform-shared agent + its default instance ---
|
|
54
|
-
# PLATFORM carries the org floor tuple too (viewer@org#viewer — the org's
|
|
55
|
-
# full read audience), exactly as VisibilityTupleReconciler writes it.
|
|
56
|
-
- user: organization:planton
|
|
57
|
-
relation: organization
|
|
58
|
-
object: agent:sara
|
|
59
|
-
- user: identity_account:swarup
|
|
60
|
-
relation: owner
|
|
61
|
-
object: agent:sara
|
|
62
|
-
- user: identity_provider:idp1#platform_user
|
|
63
|
-
relation: platform_viewer
|
|
64
|
-
object: agent:sara
|
|
65
|
-
- user: organization:planton#viewer
|
|
66
|
-
relation: viewer
|
|
67
|
-
object: agent:sara
|
|
68
|
-
- user: organization:planton
|
|
69
|
-
relation: organization
|
|
70
|
-
object: agent_instance:sara-default
|
|
71
|
-
- user: agent:sara
|
|
72
|
-
relation: agent
|
|
73
|
-
object: agent_instance:sara-default
|
|
74
|
-
- user: identity_account:swarup
|
|
75
|
-
relation: owner
|
|
76
|
-
object: agent_instance:sara-default
|
|
77
|
-
- user: agent:sara
|
|
78
|
-
relation: default_of
|
|
79
|
-
object: agent_instance:sara-default
|
|
80
|
-
|
|
81
|
-
# --- Alice's personal instance of the shared agent (NO default_of) ---
|
|
82
|
-
- user: organization:acme
|
|
83
|
-
relation: organization
|
|
84
|
-
object: agent_instance:alice-personal
|
|
85
|
-
- user: agent:sara
|
|
86
|
-
relation: agent
|
|
87
|
-
object: agent_instance:alice-personal
|
|
88
|
-
- user: identity_account:alice
|
|
89
|
-
relation: owner
|
|
90
|
-
object: agent_instance:alice-personal
|
|
91
|
-
|
|
92
|
-
# --- Org-visible agent + its default instance ---
|
|
93
|
-
# ORG visibility is an explicit viewer tuple (viewer@org#viewer) — the
|
|
94
|
-
# unconditional `viewer from organization` grant is gone (private is real).
|
|
95
|
-
- user: organization:planton
|
|
96
|
-
relation: organization
|
|
97
|
-
object: agent:internal-bot
|
|
98
|
-
- user: identity_account:swarup
|
|
99
|
-
relation: owner
|
|
100
|
-
object: agent:internal-bot
|
|
101
|
-
- user: organization:planton#viewer
|
|
102
|
-
relation: viewer
|
|
103
|
-
object: agent:internal-bot
|
|
104
|
-
- user: organization:planton
|
|
105
|
-
relation: organization
|
|
106
|
-
object: agent_instance:internal-default
|
|
107
|
-
- user: agent:internal-bot
|
|
108
|
-
relation: agent
|
|
109
|
-
object: agent_instance:internal-default
|
|
110
|
-
- user: identity_account:swarup
|
|
111
|
-
relation: owner
|
|
112
|
-
object: agent_instance:internal-default
|
|
113
|
-
- user: agent:internal-bot
|
|
114
|
-
relation: default_of
|
|
115
|
-
object: agent_instance:internal-default
|
|
116
|
-
|
|
117
|
-
# --- Platform-shared workflow + its default instance ---
|
|
118
|
-
- user: organization:planton
|
|
119
|
-
relation: organization
|
|
120
|
-
object: workflow:onboarding
|
|
121
|
-
- user: identity_account:swarup
|
|
122
|
-
relation: owner
|
|
123
|
-
object: workflow:onboarding
|
|
124
|
-
- user: identity_provider:idp1#platform_user
|
|
125
|
-
relation: platform_viewer
|
|
126
|
-
object: workflow:onboarding
|
|
127
|
-
- user: organization:planton#viewer
|
|
128
|
-
relation: viewer
|
|
129
|
-
object: workflow:onboarding
|
|
130
|
-
- user: organization:planton
|
|
131
|
-
relation: organization
|
|
132
|
-
object: workflow_instance:onboarding-default
|
|
133
|
-
- user: workflow:onboarding
|
|
134
|
-
relation: workflow
|
|
135
|
-
object: workflow_instance:onboarding-default
|
|
136
|
-
- user: identity_account:swarup
|
|
137
|
-
relation: owner
|
|
138
|
-
object: workflow_instance:onboarding-default
|
|
139
|
-
- user: workflow:onboarding
|
|
140
|
-
relation: default_of
|
|
141
|
-
object: workflow_instance:onboarding-default
|
|
142
|
-
|
|
143
|
-
tests:
|
|
144
|
-
- name: managed-org member reaches the default instance of a platform-shared agent
|
|
145
|
-
check:
|
|
146
|
-
- user: identity_account:alice
|
|
147
|
-
object: agent_instance:sara-default
|
|
148
|
-
assertions:
|
|
149
|
-
can_view: true
|
|
150
|
-
can_execute: true
|
|
151
|
-
can_edit: false
|
|
152
|
-
can_delete: false
|
|
153
|
-
|
|
154
|
-
- name: outsiders get nothing from the default_of link
|
|
155
|
-
check:
|
|
156
|
-
- user: identity_account:mallory
|
|
157
|
-
object: agent_instance:sara-default
|
|
158
|
-
assertions:
|
|
159
|
-
can_view: false
|
|
160
|
-
can_execute: false
|
|
161
|
-
|
|
162
|
-
- name: personal instances never leak through the parent agent
|
|
163
|
-
check:
|
|
164
|
-
# Swarup owns the agent itself, but alice's personal instance has no
|
|
165
|
-
# default_of tuple — only she (its owner) can reach it.
|
|
166
|
-
- user: identity_account:swarup
|
|
167
|
-
object: agent_instance:alice-personal
|
|
168
|
-
assertions:
|
|
169
|
-
can_view: false
|
|
170
|
-
- user: identity_account:alice
|
|
171
|
-
object: agent_instance:alice-personal
|
|
172
|
-
assertions:
|
|
173
|
-
can_view: true
|
|
174
|
-
can_edit: true
|
|
175
|
-
|
|
176
|
-
- name: org members reach the default instance of an org-visible agent
|
|
177
|
-
check:
|
|
178
|
-
- user: identity_account:priya
|
|
179
|
-
object: agent_instance:internal-default
|
|
180
|
-
assertions:
|
|
181
|
-
can_view: true
|
|
182
|
-
can_execute: true
|
|
183
|
-
can_edit: false
|
|
184
|
-
# cloud#257: the default_of chain reaches org viewer-role users too —
|
|
185
|
-
# the viewer-shaped org tuple on the parent agent is the org's full
|
|
186
|
-
# read audience, and the default instance inherits it structurally.
|
|
187
|
-
- user: identity_account:veda
|
|
188
|
-
object: agent_instance:internal-default
|
|
189
|
-
assertions:
|
|
190
|
-
can_view: true
|
|
191
|
-
can_edit: false
|
|
192
|
-
# Managed-org membership grants nothing on non-platform-shared agents.
|
|
193
|
-
- user: identity_account:alice
|
|
194
|
-
object: agent_instance:internal-default
|
|
195
|
-
assertions:
|
|
196
|
-
can_view: false
|
|
197
|
-
|
|
198
|
-
- name: managed-org member reaches the default instance of a platform-shared workflow
|
|
199
|
-
check:
|
|
200
|
-
- user: identity_account:alice
|
|
201
|
-
object: workflow_instance:onboarding-default
|
|
202
|
-
assertions:
|
|
203
|
-
can_view: true
|
|
204
|
-
can_execute: true
|
|
205
|
-
can_edit: false
|
|
206
|
-
|
|
207
|
-
- name: list managed-org member's viewable agent instances resolves the default_of chain
|
|
208
|
-
list_objects:
|
|
209
|
-
- user: identity_account:alice
|
|
210
|
-
type: agent_instance
|
|
211
|
-
assertions:
|
|
212
|
-
can_view:
|
|
213
|
-
- agent_instance:sara-default
|
|
214
|
-
- agent_instance:alice-personal
|