Make the access policy for automatically included workspace members configurable
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
With RBAC enabled, turning on Automatically include workspace members for an app grants every workspace member the default access policy (follow role permissions). Members who join the workspace later get the same policy. There is no way to choose a different policy.
In our workspaces, many members share one workspace, but each app should be opened and edited only by its maintainer, the workspace owner and admins, and members granted access one by one. Other members may see the app in the list, but should not open it, edit it, or read its logs. The built-in Preview App policy (app.can_preview) is exactly this, but the toggle can only grant default. So turning the toggle on by mistake opens the app to the whole workspace at once.
The policy is fixed in api/tasks/initialize_created_app_rbac_access_task.py: APP_RBAC_DEFAULT_ACCESS_POLICY_ID = "default" is used for apps, datasets and agents, both in initialize_created_app_rbac_access_task (toggle turned on) and in sync_joined_workspace_member_rbac_access_task (new member joins).
Proposal:
- Add settings for the policy granted to automatically included members, one per resource type, for example
RBAC_AUTO_INCLUDE_APP_ACCESS_POLICY_KEY,RBAC_AUTO_INCLUDE_DATASET_ACCESS_POLICY_KEYandRBAC_AUTO_INCLUDE_AGENT_ACCESS_POLICY_KEY. The default staysdefault, so nothing changes unless an operator sets them. - The settings take a policy key such as
app.can_preview, not an ID. Built-in policy IDs are different in each workspace (we checked 28 workspaces and found 28 different IDs forapp.can_preview), so the task looks up the ID in each workspace withRBACService.AccessPolicies.list. If the key is not found, it falls back todefaultand logs a warning. - Members who are already in the whitelist keep their current policies. Today the task appends the policy to everyone, and we confirmed that appending
Preview Appto a member who already hasFull Controladds a second policy instead of leaving the member as is. The task should skip members who already have a binding. - Owners and admins are not affected. Their bindings are locked and stay
default.
2. Additional context or comments
- Related: #41363 added automatic inclusion of new members, and #46855 / #46860 change the default of the toggle for new apps to off.
- We checked on Dify Enterprise with RBAC that the RBAC service accepts
policy_idset to thePreview Apppolicy inappend_whitelist_members_batch, and that the member then has onlyapp.acl.previewfor that app. - Turning the toggle on by itself does not add members. The members are added by the task above, so this change is on the API side only.
3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.