dcg

Databricks CLI

database.databricks

Protects against destructive Databricks CLI operations like account workspaces delete, bundle destroy, recursive workspace/fs deletion, permanent cluster deletion, secret-scope removal, arbitrary REST DELETE calls, and high-impact resource deletes

  • 19blocking rules
  • 0safe patterns
  • 11Critical
  • 8High
~/.config/dcg/config.toml
[packs]
enabled = ["database.databricks"]

Evaluated when a command contains databricks, bundle, permanent-delete, delete-scope, delete-secret, delete-acl.

Blocking rules

Each rule ID is database.databricks:<name>. Use it in allowlists and [policy.rules].

  1. databricks-account-identity-delete

    Critical

    databricks account identity deletion removes an account-wide user, service principal, or group.

    Explanation
    Account-level identities are shared by every workspace in the account. Deleting a service principal breaks the jobs, automation, API access, and compute it owns everywhere at once; deleting a user or group orphans assets and grants across workspaces. Databricks itself recommends deactivation over deletion when the goal is only to stop access. Inspect the identity first: databricks account service-principals get <ID> (or the matching `get`)
  2. databricks-account-workspaces-delete

    Critical

    databricks account workspaces delete removes an ENTIRE workspace.

    Explanation
    Deleting a workspace removes the whole environment — notebooks, jobs, clusters, and workspace-local configuration — for every user of that workspace at once. This is an account-level control-plane operation with no undo. Confirm the target first: databricks account workspaces get <WORKSPACE_ID>
  3. databricks-apps-delete-auto-approve

    Critical

    databricks apps delete --auto-approve destroys the app's deployed resources without confirmation.

    Explanation
    Run from a Databricks Apps project directory without a name, `apps delete` tears down every resource the project deployed — the same blast radius as `bundle destroy`. `--auto-approve` skips the CLI's own interactive confirmation, so a wrong profile or directory destroys the deployment silently. Review the app first: databricks apps list
  4. databricks-bundle-destroy

    Critical

    databricks bundle destroy permanently deletes every resource the bundle deployed.

    Explanation
    `bundle destroy` tears down all jobs, pipelines, and artifacts previously deployed by the bundle. With `--auto-approve` even the CLI's own confirmation prompt is skipped, so a wrong target/profile destroys the production deployment silently. Review what would be destroyed first: databricks bundle summary
  5. databricks-catalogs-delete-force

    Critical

    databricks catalogs delete --force removes a catalog even when it still contains schemas and tables.

    Explanation
    `--force` overrides the non-empty check: every schema, table, volume, function, and model under the catalog goes with it in one call. Unity Catalog object deletion has no undo. See what the catalog contains first: databricks schemas list <CATALOG>
  6. databricks-clusters-permanent-delete

    Critical

    databricks clusters permanent-delete removes a cluster rather than terminating it.

    Explanation
    Permanent deletion removes the cluster configuration itself — libraries, init scripts, and spark conf — not just the running compute. A terminated cluster can be restarted; a permanently deleted one must be rebuilt. Terminate instead when you just need the compute stopped: databricks clusters delete <CLUSTER_ID>
  7. databricks-fs-rm-recursive

    Critical

    databricks fs rm -r recursively deletes data in DBFS or Unity Catalog Volumes.

    Explanation
    Recursive removal deletes the directory and everything under it in one call. DBFS and Volume paths often back tables and checkpoints; there is no time-travel for raw files. Inspect the path first: databricks fs ls <PATH>
  8. databricks-metastores-delete

    Critical

    databricks metastores delete removes an entire Unity Catalog metastore.

    Explanation
    The metastore is the top of the Unity Catalog hierarchy: every catalog, schema, table, volume, and grant in it hangs off this one object. With `--force` Databricks deletes the metastore even when it is not empty, so a single command can sever an organization's entire governed data estate. The account-level spelling (`databricks account metastores delete`) is the same operation through the account API. Confirm the target first: databricks metastores get <METASTORE_ID>
  9. databricks-schemas-delete-force

    Critical

    databricks schemas delete --force removes a schema even when it still contains tables.

    Explanation
    `--force` overrides the non-empty check: every table, volume, and function in the schema is deleted with it. There is no recycle bin for Unity Catalog objects. See what the schema contains first: databricks tables list <CATALOG> <SCHEMA>
  10. databricks-secrets-delete-scope

    Critical

    databricks secrets delete-scope removes the scope with ALL its secrets and ACLs.

    Explanation
    Deleting a scope removes every secret and ACL inside it in one operation. Jobs and notebooks that read those secrets start failing immediately, and the secret values cannot be read back out beforehand through the CLI. List the blast radius first: databricks secrets list-secrets <SCOPE>
  11. databricks-workspace-delete-recursive

    Critical

    databricks workspace delete --recursive removes a whole workspace directory tree.

    Explanation
    Recursive workspace deletion removes the directory and every notebook and file under it. Workspace object deletion cannot be undone. Inspect the tree first: databricks workspace list <PATH>
  12. databricks-api-delete

    High

    databricks api delete performs an arbitrary REST DELETE against the workspace or account API.

    Explanation
    The generic API escape hatch can delete any resource the token can reach, including ones no specific CLI rule covers. Treat it like the destructive endpoint it targets. Inspect the resource first: databricks api get <PATH>
  13. databricks-apps-delete

    High

    databricks apps delete removes a Databricks App and its deployed resources.

    Explanation
    Deleting an app removes its deployments and compute. From a project directory with no explicit name it targets the project's own app, so the blast radius depends on the working directory as much as the argv. Review the app first: databricks apps get <APP_NAME>
  14. databricks-catalogs-delete

    High

    databricks catalogs delete removes a Unity Catalog catalog.

    Explanation
    A catalog is a top-level data namespace. Even without `--force` (which refuses when the catalog is non-empty), deleting one removes its grants and registration and cannot be undone. Confirm the target first: databricks catalogs get <CATALOG>
  15. databricks-fs-rm

    High

    databricks fs rm deletes a file in DBFS or a Unity Catalog Volume.

    Explanation
    File deletion in DBFS/Volumes is immediate and unrecoverable; files there frequently back external tables, ML artifacts, and streaming checkpoints. Confirm the target first: databricks fs ls <PATH>
  16. databricks-resource-delete

    High

    databricks resource delete removes a job, pipeline, repo, policy, pool, warehouse, or token.

    Explanation
    Deleting these resources removes their configuration and history: a deleted job loses its run history and schedule, a deleted pipeline its update log, a deleted token cannot be recreated with the same value. Recreating any of them from scratch requires the original definition. Capture the definition first: databricks jobs get <JOB_ID> (or the matching `get` for the resource)
  17. databricks-schemas-delete

    High

    databricks schemas delete removes a Unity Catalog schema.

    Explanation
    Schema deletion removes the namespace and its grants. Without `--force` the CLI refuses a non-empty schema, but the deletion itself still cannot be undone. Confirm the target first: databricks schemas get <CATALOG.SCHEMA>
  18. databricks-secrets-delete

    High

    databricks secrets delete-secret/delete-acl removes a secret or its access control.

    Explanation
    Secret values are write-only through the CLI: once deleted, the value cannot be recovered — only re-created from wherever it originally came from. Removing an ACL can lock a principal out of secrets it depends on. Record what exists first: databricks secrets list-secrets <SCOPE>
  19. databricks-workspace-delete

    High

    databricks workspace delete removes a workspace object; deletion cannot be undone.

    Explanation
    Workspace object deletion is immediate and has no recycle bin. A deleted notebook is gone unless it was exported or lives in a Repo. Export a copy first: databricks workspace export <PATH> --file backup