Repository navigation
acc: record config-remote-sync permission results when another identity syncs #8146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
232e35b
08a9b53
122d4e0
5a0b1c9
7caa85e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| workspace: | ||
| root_path: /Workspace/Users/$TEST_SP_APPLICATION_ID/.bundle/test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: test-job-$UNIQUE_NAME |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Cloud = true | ||
| RunsOnDbr = false | ||
| GOOS.windows = false | ||
| CloudEnvs.azure = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
|
|
||
| === The service principal deploys a job that declares no permissions | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Created jobs.my_job | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| === The current identity is granted CAN_MANAGE on the job, outside the bundle | ||
|
|
||
| CAN_MANAGE [USERNAME] | ||
| IS_OWNER [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The current identity runs config-remote-sync | ||
|
|
||
| >>> [CLI] bundle config-remote-sync --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.my_job | ||
| permissions: add | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -9,2 +9,5 @@ | ||
| my_job: | ||
| name: test-job-[UNIQUE_NAME] | ||
| + permissions: | ||
| + - level: IS_OWNER | ||
| + service_principal_name: [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The service principal deploys the synced config | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Created jobs.my_job.permissions | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 1 unchanged | ||
|
|
||
| === The job's ACL after the deploy | ||
|
|
||
| IS_OWNER [TEST_SP_APPLICATION_ID] | ||
|
|
||
| >>> as-test-sp [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.jobs.my_job | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME] | ||
|
|
||
| Destroy: 1 deleted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace as-test-sp $CLI bundle destroy --auto-approve | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| title "The service principal deploys a job that declares no permissions" | ||
| trace as-test-sp $CLI bundle deploy | ||
| job_id=$(as-test-sp $CLI bundle summary -o json | jq -r '.resources.jobs.my_job.id') | ||
|
|
||
| title "The current identity is granted CAN_MANAGE on the job, outside the bundle\n" | ||
| $CLI permissions set jobs $job_id --json '{"access_control_list":[ | ||
| {"permission_level":"IS_OWNER","service_principal_name":"'"$TEST_SP_APPLICATION_ID"'"}, | ||
| {"permission_level":"CAN_MANAGE","'"$CURRENT_USER_FIELD"'":"'"$CURRENT_USER_NAME"'"} | ||
| ]}' > /dev/null | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nice to have] |
||
| print_acl jobs $job_id | ||
|
|
||
| title "The current identity runs config-remote-sync" | ||
| sync_and_show_diff | ||
|
|
||
| title "The service principal deploys the synced config" | ||
| trace as-test-sp $CLI bundle deploy | ||
|
|
||
| title "The job's ACL after the deploy\n" | ||
| print_acl jobs $job_id | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Badness = "Run by an identity other than the deployer, config-remote-sync leaves that identity's own CAN_MANAGE out of the permissions it imports (it assumes the syncing identity is the one that deploys), so the deployer's next deploy revokes it. The job declared no permissions, so before the sync that deploy left the ACL alone." |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| workspace: | ||
| root_path: /Workspace/Users/$TEST_SP_APPLICATION_ID/.bundle/test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: test-job-$UNIQUE_NAME | ||
| permissions: | ||
| - level: CAN_VIEW | ||
| group_name: users |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Cloud = true | ||
| RunsOnDbr = false | ||
| GOOS.windows = false | ||
| CloudEnvs.azure = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
|
|
||
| === The service principal deploys a job that declares permissions | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Created jobs.my_job | ||
| Created jobs.my_job.permissions | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 2 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| === The job's ACL after the deploy | ||
|
|
||
| CAN_VIEW users | ||
| IS_OWNER [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The current identity runs config-remote-sync without any remote change | ||
|
|
||
| >>> [CLI] bundle config-remote-sync --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.my_job | ||
| permissions[service_principal_name='[TEST_SP_APPLICATION_ID]']: add | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -12,2 +12,4 @@ | ||
| - level: CAN_VIEW | ||
| group_name: users | ||
| + - level: IS_OWNER | ||
| + service_principal_name: [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The current identity is granted CAN_MANAGE on the job, outside the bundle | ||
|
|
||
| CAN_MANAGE [USERNAME] | ||
| CAN_VIEW users | ||
| IS_OWNER [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The current identity runs config-remote-sync | ||
|
|
||
| >>> [CLI] bundle config-remote-sync --save | ||
| No changes detected. | ||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
|
|
||
| === The service principal deploys the synced config | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Updated jobs.my_job.permissions | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 1 unchanged | ||
|
|
||
| === The job's ACL after the deploy | ||
|
|
||
| CAN_VIEW users | ||
| IS_OWNER [TEST_SP_APPLICATION_ID] | ||
|
|
||
| >>> as-test-sp [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.jobs.my_job | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME] | ||
|
|
||
| Destroy: 1 deleted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace as-test-sp $CLI bundle destroy --auto-approve | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| title "The service principal deploys a job that declares permissions" | ||
| trace as-test-sp $CLI bundle deploy | ||
| job_id=$(as-test-sp $CLI bundle summary -o json | jq -r '.resources.jobs.my_job.id') | ||
|
|
||
| title "The job's ACL after the deploy\n" | ||
| print_acl jobs $job_id | ||
|
|
||
| title "The current identity runs config-remote-sync without any remote change" | ||
| sync_and_show_diff | ||
|
|
||
| title "The current identity is granted CAN_MANAGE on the job, outside the bundle\n" | ||
| $CLI permissions set jobs $job_id --json '{"access_control_list":[ | ||
| {"permission_level":"IS_OWNER","service_principal_name":"'"$TEST_SP_APPLICATION_ID"'"}, | ||
| {"permission_level":"CAN_MANAGE","'"$CURRENT_USER_FIELD"'":"'"$CURRENT_USER_NAME"'"}, | ||
| {"permission_level":"CAN_VIEW","group_name":"users"} | ||
| ]}' > /dev/null | ||
| print_acl jobs $job_id | ||
|
|
||
| title "The current identity runs config-remote-sync" | ||
| sync_and_show_diff | ||
|
|
||
| title "The service principal deploys the synced config" | ||
| trace as-test-sp $CLI bundle deploy | ||
|
|
||
| title "The job's ACL after the deploy\n" | ||
| print_acl jobs $job_id |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Badness = "Run by an identity other than the deployer, config-remote-sync adds the deployer's IS_OWNER to the declared permissions although nobody changed the ACL. It also reports no change for a grant made to the syncing identity itself, so the deployer's next deploy revokes that grant (the revoke predates the permissions sync, which was meant to prevent it)." |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| workspace: | ||
| root_path: /Workspace/Users/$TEST_SP_APPLICATION_ID/.bundle/test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| experiments: | ||
| my_experiment: | ||
| name: /Users/$TEST_SP_APPLICATION_ID/test-experiment-$UNIQUE_NAME |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Cloud = true | ||
| RunsOnDbr = false | ||
| GOOS.windows = false | ||
| CloudEnvs.azure = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
|
|
||
| === The service principal deploys an experiment that declares no permissions | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Created experiments.my_experiment | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| === The current identity is granted CAN_MANAGE on the experiment, outside the bundle | ||
|
|
||
| CAN_MANAGE [TEST_SP_APPLICATION_ID] | ||
| CAN_MANAGE [USERNAME] | ||
|
|
||
| === The current identity runs config-remote-sync | ||
|
|
||
| >>> [CLI] bundle config-remote-sync --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.experiments.my_experiment | ||
| permissions: add | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -9,2 +9,5 @@ | ||
| my_experiment: | ||
| name: /Users/[TEST_SP_APPLICATION_ID]/test-experiment-[UNIQUE_NAME] | ||
| + permissions: | ||
| + - level: CAN_MANAGE | ||
| + service_principal_name: [TEST_SP_APPLICATION_ID] | ||
|
|
||
| === The service principal deploys the synced config | ||
|
|
||
| >>> as-test-sp [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/files... | ||
| Created experiments.my_experiment.permissions | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 1 unchanged | ||
|
|
||
| === The experiment's ACL after the deploy | ||
|
|
||
| CAN_MANAGE [TEST_SP_APPLICATION_ID] | ||
|
|
||
| >>> as-test-sp [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.experiments.my_experiment | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME] | ||
|
|
||
| Destroy: 1 deleted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace as-test-sp $CLI bundle destroy --auto-approve | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| title "The service principal deploys an experiment that declares no permissions" | ||
| trace as-test-sp $CLI bundle deploy | ||
| experiment_id=$(as-test-sp $CLI bundle summary -o json | jq -r '.resources.experiments.my_experiment.id') | ||
|
|
||
| title "The current identity is granted CAN_MANAGE on the experiment, outside the bundle\n" | ||
| $CLI permissions set experiments $experiment_id --json '{"access_control_list":[ | ||
| {"permission_level":"CAN_MANAGE","service_principal_name":"'"$TEST_SP_APPLICATION_ID"'"}, | ||
| {"permission_level":"CAN_MANAGE","'"$CURRENT_USER_FIELD"'":"'"$CURRENT_USER_NAME"'"} | ||
| ]}' > /dev/null | ||
| print_acl experiments $experiment_id | ||
|
|
||
| title "The current identity runs config-remote-sync" | ||
| sync_and_show_diff | ||
|
|
||
| title "The service principal deploys the synced config" | ||
| trace as-test-sp $CLI bundle deploy | ||
|
|
||
| title "The experiment's ACL after the deploy\n" | ||
| print_acl experiments $experiment_id |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Badness = "Same as ../can_manage for a resource type without IS_OWNER: the syncing identity's own CAN_MANAGE is left out of the imported permissions, so the deployer's next deploy revokes it." |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| workspace: | ||
| root_path: /Workspace/Users/$TEST_SP_APPLICATION_ID/.bundle/test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: test-job-$UNIQUE_NAME |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Cloud = true | ||
| RunsOnDbr = false | ||
| GOOS.windows = false | ||
| CloudEnvs.azure = false | ||
| EnvMatrix.DMS = ["", "true"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nice to have]
testing.mdasks for theacceptance/bin/helpers instead of inlinejqpipelines, andread_id.py my_jobprints the ID from state and registers the[MY_JOB_ID]replacement. Could this bejob_id=$(as-test-sp read_id.py my_job)? Inowner/scriptandhandover/script(lines 10–11) that would also replace the hand-writtenjqplusadd_repl "$job_id" MY_JOB_IDpair. The same pipeline appears in every other new script, andother_targetwould useread_id.py -t staging/-t prod.