direct: Do not drop MANAGE and other privileges not implied by ALL_PRIVILEGES - #6733
Merged
Merged
Conversation
…rants ALL_PRIVILEGES does not imply MANAGE, READ_METADATA, EXTERNAL_USE_SCHEMA or EXTERNAL_USE_LOCATION. normalizeAssignments collapsed a principal holding ALL_PRIVILEGES down to just ALL_PRIVILEGES, so granting e.g. [MANAGE, ALL_PRIVILEGES] silently sent only ALL_PRIVILEGES and dropped MANAGE. Keep the four excluded privileges through the collapse, and revoke a dropped excluded privilege by name in buildGrantChanges (the ALL_PRIVILEGES "wipe" is skipped when ALL_PRIVILEGES stays granted, so it can't clear them otherwise). Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Both engines now send the same PATCH and read back the same grants, so the per-engine out.requests/out.grants files are folded into output.txt. Extend the normalizeAssignments unit test to all four privileges ALL_PRIVILEGES excludes. Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
Integration test reportCommit: 3af49a3
Top 3 slowest tests (at least 2 minutes):
|
pietern
approved these changes
Sep 17, 2026
hejcman-enverus
pushed a commit
to hejcman-enverus/databricks_cli
that referenced
this pull request
Sep 18, 2026
…atabricks#6743) ## Changes - `direct`: route all grant-revocation paths in `buildGrantChanges` through `grantRemovals`. When `ALL_PRIVILEGES` stays granted, keep it out of `Remove` and revoke only the no-longer-wanted excluded privileges (as databricks#6733 already did); otherwise remove `ALL_PRIVILEGES` (clearing everything it implies) plus the excluded privileges (`MANAGE`, `READ_METADATA`, `EXTERNAL_USE_SCHEMA`, `EXTERNAL_USE_LOCATION`) by name. - `testserver`: model `Remove: [ALL_PRIVILEGES]` the way the real backend does — it clears implied privileges but leaves the four excluded ones — instead of wiping the principal. - New acceptance test `grants/schemas/remove_principal_manage`. ## Why Follow-up to databricks#6733. Revoking a principal (or downgrading it off `ALL_PRIVILEGES`) sent `Remove: [ALL_PRIVILEGES]`, which the backend does not apply to the privileges `ALL_PRIVILEGES` excludes. Those lingered, so the principal never went away and every plan/deploy reported a change — a perpetual update. The fake server's full-wipe model hid this; fixing it surfaced the bug. It is pre-existing (a principal granted only `[MANAGE]` reproduces it), and databricks#6733 made it more reachable by letting `MANAGE` land alongside `ALL_PRIVILEGES`. ## Tests `remove_principal_manage` (direct engine, local + cloud) plus `buildGrantChanges` unit cases. Verified on aws-cli: reproduced the perpetual update before the fix and confirmed convergence after. Terraform is excluded because it sends a precise `Remove: [MANAGE]` and already converges. This pull request and its description were written by Isaac. --------- Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Keep the four privileges Unity Catalog does not include in
ALL_PRIVILEGES(MANAGE,READ_METADATA,EXTERNAL_USE_SCHEMA,EXTERNAL_USE_LOCATION) when normalizing grants, and revoke a dropped one by name.Why
On the direct engine, granting e.g.
[MANAGE, ALL_PRIVILEGES]silently sent onlyALL_PRIVILEGES.normalizeAssignments(added in #6064 for #6030) collapsed any principal holdingALL_PRIVILEGESdown to justALL_PRIVILEGESon both the config and the read side, soMANAGEwas dropped from the request and the missing grant went unnoticed in the plan. Terraform sends both, which is why the bug showed up only after the engine default changed.ALL_PRIVILEGESdoes not imply these four: https://docs.databricks.com/aws/en/data-governance/unity-catalog/manage-privileges/privilegesTests
New acceptance tests
grants/schemas/all_privileges_manage(grantMANAGE+ALL_PRIVILEGES) andgrants/schemas/manage_out_of_band(an out-of-bandMANAGEgrant is reconciled without a perpetual update), plus unit coverage. Local + cloud, both engines.This pull request and its description were written by Isaac.