Repository navigation
Detect remote permission changes on unmanaged resources in config-remote-sync - #7536
ilyakuz-db wants to merge 5 commits into
Conversation
|
Commit: Regression test reportSelected 3 changed tests (limit=20, 0 not selected) 6 tests: regression=2 unreleased=0 coverage=4 failing=0
TestAccept/bundle/config-remote-sync/unmanaged_permissions/DMS=: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): same output as main (8e70c8b) TestAccept/bundle/config-remote-sync/unmanaged_permissions/DMS=true: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): same output as main (8e70c8b) |
✅ Integration test reportCommit: b9f3db2
Top 4 slowest tests (at least 2 minutes):
|
|
The live check in e2-dogfood supports reading unmanaged permissions: three DAB jobs had backend ACLs but no A few things to address before merging:
For unmanaged permissions, this imports the current explicit ACL; it cannot distinguish pre-existing grants from changes made since the last deployment. That seems reasonable if documented as import behavior. |
| var result []dresources.StatePermission | ||
| for _, p := range remote.EmbeddedSlice { | ||
| isCurrentUser := p.UserName == currentUser || p.ServicePrincipalName == currentUser | ||
| if p.Level == iam.PermissionLevelIsOwner || (p.Level == iam.PermissionLevelCanManage && isCurrentUser) { |
There was a problem hiding this comment.
This drops IS_OWNER for every principal, so an owner transferred in the UI is lost and the next deploy's FixPermissions reassigns it to the deployer. Drop only the current user's?
There was a problem hiding this comment.
[AI] Fixed in b9f3db2: only the current user's IS_OWNER/CAN_MANAGE is dropped now (withoutCurrentUserManage in bundle/configsync/permissions.go), so a transferred owner is imported and the next deploy keeps it, adding CAN_MANAGE for the deployer. The pipeline in unmanaged_permissions covers it.
…keep other owners Co-authored-by: Isaac <no-reply@databricks.com>
… permissions, keep the max-level entry location Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
|
[AI] Fixed in b9f3db2:
Also moved the ACL read into |
Co-authored-by: Isaac <no-reply@databricks.com>
Changes
bundle config-remote-syncnow writes remote permission changes back to the config:permissions:block. The current user'sIS_OWNER/CAN_MANAGEis left out because deploy adds it (FixPermissions); an owner transferred to someone else is kept, so the next deploy does not take ownership back. This is an import: the ACL cannot tell grants that existed before the deployment from ones added since.permissions[user_name='a'].level) from the plan's existing.permissionscomparison. Only entries written in the resource's own config are changed; the current user's entry and bundle-level permissions are left alone, and grants are still skipped.The ACL read lives in
configsyncand uses the existing adapters, soCalculatePlanand deploy are unchanged.FixPermissionsnow keeps the entry that sets a principal's level as is when it does not change it. Before, it rebuilt every entry without a source location, so config-remote-sync could not find declared entries in the YAML.Why
Permission changes made in the UI were ignored, so the synced config drifted and the next deploy reverted them.
Tests
Extended
config-remote-sync/unmanaged_permissions: imports a job ACL and a pipeline ACL (the pipeline's transferred owner is kept), deploys, then remotely changes a level, adds a group and removes a user, and checks the second sync writes all three and the following deploy is a no-op. Unit tests for declared-permission changes (including an empty remote ACL), the owner filter, resource selection, ID lookup andFixPermissionslocations. Ranbundle/...unit tests and thebundle/acceptance tests locally (the ruff-based pydabs formatting checks could not run: no ruff on the machine); golangci-lint clean.This pull request and its description were written by Isaac.