dify icon indicating copy to clipboard operation
dify copied to clipboard

RBAC whitelist migrations turn on "Automatically include workspace members" and open existing apps and datasets to every member

Open ryuta-kobayashi-15 opened this issue 1 day ago • 0 comments

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-scopes is registered as migrate_only_me_resource_whitelist_scopes_to_automatic_include (api/commands/data_migration.py). It turns resources whose old scope is only_me into automatic_include_workspace_members=true and grants default to 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 scope all to true and grants default to every member.
  • rbac-migrate-dataset-permissions maps all_team_members to true for 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):

  1. Add an option to the migrations, for example --keep-automatic-include-off. With it, every app and dataset gets automatic_include_workspace_members=false whatever its old scope was. The members listed in the legacy whitelist config keep access, and existing per-member policy bindings are kept. replace_whitelist clears per-member bindings, so the command reads them first and writes them back. Workspace members are not granted default in bulk.
  2. 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 the default bindings that the migration added. It keeps the maintainer, the members in the legacy whitelist config, and members with any non-default policy. Owners and admins keep their locked bindings. It supports --tenant-id, --resource-type and --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.

ryuta-kobayashi-15 avatar Dec 05 '26 06:12 ryuta-kobayashi-15