dify
dify copied to clipboard
RBAC whitelist migrations turn on "Automatically include workspace members" and open existing apps and datasets to every member
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.
After upgrading to the version with automatic_include_workspace_members, our existing apps had the toggle turned on and every workspace member was added with the default access policy. Before the upgrade, only the maintainer, the workspace owner and admins, and members granted access one by one could open these apps. After the upgrade, every member can open and edit them and read their logs.
The migration commands cause this (api/commands/rbac.py, main c352bd2ce7):
rbac-migrate-resource-whitelist-scopesis registered asmigrate_only_me_resource_whitelist_scopes_to_automatic_include(api/commands/data_migration.py). It turns resources whose old scope isonly_meintoautomatic_include_workspace_members=trueand grantsdefaultto every workspace member. A resource that was private to its maintainer becomes open to everyone.migrate_resource_whitelist_scopes_to_automatic_include(imported but not registered) maps old scopealltotrueand grantsdefaultto every member.rbac-migrate-dataset-permissionsmapsall_team_memberstotruefor datasets.
Some workspaces want automatic inclusion, but for workspaces where access is granted member by member, the upgrade silently widens access, and there is no supported way to undo it.
Proposal (opt-in, the current behavior stays the default):
- Add an option to the migrations, for example
--keep-automatic-include-off. With it, every app and dataset getsautomatic_include_workspace_members=falsewhatever its old scope was. The members listed in the legacy whitelist config keep access, and existing per-member policy bindings are kept.replace_whitelistclears per-member bindings, so the command reads them first and writes them back. Workspace members are not granteddefaultin bulk. - Add a repair command for workspaces that have already been migrated, for example
rbac-turn-off-automatic-include. It turns the toggle off for apps and datasets, and removes only thedefaultbindings that the migration added. It keeps the maintainer, the members in the legacy whitelist config, and members with any non-defaultpolicy. Owners and admins keep their locked bindings. It supports--tenant-id,--resource-typeand--dry-run, like the other RBAC commands.
2. Additional context or comments
- Related: #41304 added the scope migration, #41363 added the only_me backfill, and #43311 / #43315 excluded owners and admins from migrated bindings. #46855 changes the default for new apps to off.
- The legacy whitelist config (
legacy_whitelist_config) is still available from the RBAC service after the migration, so the repair command can tell which members were listed before.
3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.