Uh oh!
There was an error while loading. Please reload this page.
Support IS_OWNER as a top-level permission - #1387
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #1387 +/- ##
==========================================
+ Coverage 52.25% 53.63% +1.37%
==========================================
Files 317 351 +34 Lines 18004 20290 +2286 ==========================================
+ Hits 9408 10882 +1474 - Misses 7903 8610 +707 - Partials 693 798 +105 ☔ View full report in Codecov by Sentry. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| return diag.Errorf("'run_as' must be set for all jobs when using 'mode: production'") | ||
| // We need to verify that there is only a single deployment of the current target. | ||
| // A good way to enforce this is to explicitly set root_path or run_as. | ||
| if !isExplicitRootSet(b) && !isRunAsSet(r) { |
There was a problem hiding this comment.
We used to require
run_as: alice@company.com
but when considering collaborative deployment, we prefer
root_path: /Users/Alice
This change makes it so either restriction is allowed for mode: production.
There was a problem hiding this comment.
Can we also warn if only run_as is set? It doesn't prevent multiple deployments.
| // Only show a warning in case a principal was used for backward compatibility | ||
| // with projects from before the DABs GA. | ||
| if isPrincipalUsed { | ||
| return diag.Warningf("target with 'mode: production' should specify explicit 'workspace.root_path' to make sure only one copy is deployed") |
There was a problem hiding this comment.
Service principals still have an exception, like they used to.
| var allowedLevels = []string{CAN_MANAGE, CAN_VIEW, CAN_RUN, IS_OWNER} | ||
| var levelsMap = map[string](map[string]string){ | ||
| "jobs": { | ||
| IS_OWNER: "IS_OWNER", |
There was a problem hiding this comment.
Only a few resources, like jobs, actually have an "owner": https://docs.databricks.com/en/security/auth-authz/access-control/index.html. For almost all the others we don't distinguish between the owner and the other can-manage users.
Note that clusters is a special case here. They don't have an owner permission but treat the creator as a kind of owner that has special privileges. There's even a special API for changing that notion of "owner": https://docs.databricks.com/api/workspace/clusters/changeowner. Once we do clusters we should discuss if we want this notion of an owner to affect how clusters are created, or if we perhaps want to show a warning when someone who doesn't have IS_OWNER would be the first creator of a cluster.
lennartkats-db
commented
Jul 11, 2024
@pietern could you take another look? |
| return diag.Errorf("'run_as' must be set for all jobs when using 'mode: production'") | ||
| // We need to verify that there is only a single deployment of the current target. | ||
| // A good way to enforce this is to explicitly set root_path or run_as. | ||
| if !isExplicitRootSet(b) && !isRunAsSet(r) { |
There was a problem hiding this comment.
Can we also warn if only run_as is set? It doesn't prevent multiple deployments.
Uh oh!
There was an error while loading. Please reload this page.
| return &workspaceRootPermissions{} | ||
| func ApplyFolderPermissions() bundle.Mutator { | ||
| return &applyFolderPermissions{} | ||
| } |
There was a problem hiding this comment.
Why the rename? The mutator still applies only to the workspace root path.
There was a problem hiding this comment.
The mutator still applies only to the workspace root path.
That seems like a bug :(
In any case I renamed this so apply_folder_permisions to make it a bit shorter and to reflect that it applies permissions to folders, while its sister mutator apply_resource_permissions applies permissions to resources.
There was a problem hiding this comment.
Btw I don't think we should change the semantics of this module at this time, but we should include this in the upcoming work on permission warnings.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pietern
commented
Jul 15, 2024
@andrewnester Could you take a look as well? |
bff5c98 to
ef6a43eComparelennartkats-db
commented
Aug 6, 2024
Let's have another brief live discussion about this before merging it @pietern |
lennartkats-db
commented
Aug 22, 2024
As discussed, we're going to take this work in a different direction. Closing this for now. |
## Changes This updates the templates to include a `permissions` section. Having a permissions section is a best practice, is helpful to understand the notion of permissions, and helps diagnose permission errors (#1386). This is a cherry-pick from #1387. This change was verified to work both in dev and prod. Existing unit tests validate the validity of the templates in these modes.
…ent (#1712) ## Changes This updates `mode: production` to allow `root_path` to indicate uniqueness. Historically, we required `run_as` for this, which isn't actually very effective for that purpose. `run_as` also had the problem that it doesn't work for pipelines. This is a cherry-pick from #1387 --------- Co-authored-by: Pieter Noordhuis <pcnoordhuis@gmail.com>
## Changes This updates the templates to include a `permissions` section. Having a permissions section is a best practice, is helpful to understand the notion of permissions, and helps diagnose permission errors (#1386). This is a cherry-pick from #1387. This change was verified to work both in dev and prod. Existing unit tests validate the validity of the templates in these modes.
…ent (#1712) ## Changes This updates `mode: production` to allow `root_path` to indicate uniqueness. Historically, we required `run_as` for this, which isn't actually very effective for that purpose. `run_as` also had the problem that it doesn't work for pipelines. This is a cherry-pick from #1387 --------- Co-authored-by: Pieter Noordhuis <pcnoordhuis@gmail.com>
Changes
This adds a top-level IS_OWNER permission to help with collaborative deployment scenarios:
mode: productionnow accepts a top-level owner as an alternative to a run_as identity.Tests
Unit tests, manual experimentation.