dcg

Snowflake CLI

database.snowflake

Protects modern `snow sql` queries, files, stdin, nested sources, data, ingestion, compute, and account privileges

  • 51blocking rules
  • 0safe patterns
  • 10Critical
  • 27High
  • 14Medium
~/.config/dcg/config.toml
[packs]
enabled = ["database.snowflake"]

Evaluated when a command contains snow, snowsql, Snow, SNOW, DROP, drop, TRUNCATE, truncate, DELETE, delete.

Blocking rules

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

  1. cli-object-drop-database

    Critical

    snow object drop database/schema removes the object and everything inside it.

    Explanation
    Dropping a database or schema removes ALL contained objects (tables, views, stages, pipes, tasks, functions). Time Travel/UNDROP recovery is conditional on retention, edition, and privileges - it is not a substitute for preventing the drop. Verify with `snow object list database` / `snow object describe` and consider `CREATE DATABASE <name>_backup CLONE <name>` first.
  2. delete-all

    Critical

    DELETE without a top-level WHERE clause removes every row.

    Explanation
    Add a reviewed WHERE predicate and run the equivalent SELECT and COUNT first.
  3. drop-database

    Critical

    DROP DATABASE removes the database and every contained schema and object.

    Explanation
    Snowflake Time Travel and UNDROP are conditional on object support, retention, privileges, and subsequent operations; they are not a substitute for preventing the drop.
  4. drop-schema

    Critical

    DROP SCHEMA removes the schema and can remove all contained objects.

    Explanation
    Review the schema contents, prefer RESTRICT where supported, and clone the schema before broad DDL.
  5. drop-table

    Critical

    DROP TABLE removes the active table and its data.

    Explanation
    Verify the fully qualified target, inspect retention, and create a zero-copy clone before dropping the table.
  6. replace-database

    Critical

    CREATE OR REPLACE DATABASE replaces a live database.

    Explanation
    Create and validate a separate database or clone instead of replacing the active database in place.
  7. replace-schema

    Critical

    CREATE OR REPLACE SCHEMA replaces a live schema.

    Explanation
    Clone the schema and test the migration against the clone before changing production.
  8. replace-table

    Critical

    CREATE OR REPLACE TABLE replaces the active table.

    Explanation
    Build and validate a separate table or clone, then use a reviewed cutover operation.
  9. truncate-table

    Critical

    TRUNCATE TABLE removes every row from the target table.

    Explanation
    Preview the row count and clone the table before truncating it.
  10. update-all

    Critical

    UPDATE without a top-level WHERE clause modifies every row.

    Explanation
    Add a reviewed WHERE predicate and preview the exact target rows first.
  11. alter-table-drop-column

    High

    ALTER TABLE DROP COLUMN removes a column and its active data.

    Explanation
    Clone the table and validate all downstream consumers before removing the column.
  12. alter-table-swap

    High

    ALTER TABLE SWAP WITH exchanges table identities atomically.

    Explanation
    Verify both fully qualified tables and compare row counts and schemas before swapping.
  13. broad-grant

    High

    GRANT creates account-wide, all-privilege, or ACCOUNTADMIN access.

    Explanation
    Grant only the required privileges on specific objects to a least-privilege role.
  14. broad-revoke

    High

    REVOKE removes broad privileges or role membership and can break applications immediately.

    Explanation
    Review current grants and identify every affected principal before revoking access.
  15. cli-app-teardown

    High

    snow app teardown drops the Native App and (with --cascade) its owned objects.

    Explanation
    snow app teardown drops the application object and the application package's development artifacts; with --cascade it also drops objects the app owns, databases included. Anyone using the app loses access immediately.
  16. cli-object-drop

    High

    snow object drop permanently removes a Snowflake object.

    Explanation
    snow object drop removes tables, views, stages, streams, tasks, warehouses, users, roles, integrations, and more; --force skips the confirmation prompt. Dropping shared infrastructure can break applications and automation immediately. Inspect first with `snow object describe <type> <name>`.
  17. cli-spcs-drop

    High

    snow spcs ... drop removes container services infrastructure.

    Explanation
    Dropping an SPCS service stops and removes the running workload; dropping a compute pool removes the compute for every service on it; dropping an image repository deletes the stored images.
  18. cli-stage-drop

    High

    snow stage drop removes the stage; internal staged files are not recoverable.

    Explanation
    Dropped stages cannot be recovered - internal stage files are gone, and workflows (COPY INTO, Snowpipe) referencing the stage break immediately. List contents first with `snow stage list-files <stage>`.
  19. cli-stage-remove

    High

    snow stage remove deletes files from a stage.

    Explanation
    Files removed from an internal stage are not covered by Time Travel. Ingestion pipelines expecting those files will silently see nothing to load. Preview with `snow stage list-files <stage>` and consider copying the files out first.
  20. copy-overwrite

    High

    COPY INTO a location with OVERWRITE = TRUE can replace exported files.

    Explanation
    Export to a versioned path and LIST the destination before copying.
  21. drop-data-product

    High

    DROP removes a live view, materialized view, or dynamic table.

    Explanation
    Inspect dependencies and validate a replacement object before removing the live query surface.
  22. drop-ingestion-object

    High

    DROP removes a live stage, pipe, stream, or task.

    Explanation
    Inspect pipeline dependencies and state before removing an ingestion or scheduling object.
  23. drop-principal

    High

    DROP USER or DROP ROLE can break services and revoke access hierarchies.

    Explanation
    Review grants and dependencies, then disable access reversibly before deleting a principal.
  24. drop-security-object

    High

    DROP removes a live integration, network policy, or share.

    Explanation
    Review all consumers, grants, and recovery options before removing the security or sharing object.
  25. drop-warehouse

    High

    DROP WAREHOUSE removes compute used by applications, tasks, or users.

    Explanation
    Inspect warehouse consumers and prefer a reversible suspend only after reviewing active workloads.
  26. execute-task

    High

    EXECUTE TASK immediately starts a task run and may cascade a task graph.

    Explanation
    Inspect the task definition, owner privileges, graph dependencies, and active runs before forcing execution.
  27. insert-overwrite

    High

    INSERT OVERWRITE replaces the target table's current rows.

    Explanation
    Write to and validate a separate table before a reviewed cutover.
  28. interactive-edit

    High

    !edit executes SQL modified in an external editor that dcg cannot inspect in advance.

    Explanation
    Materialize the final SQL in a reviewed local file and execute it with snow sql -f.
  29. pause-pipe

    High

    ALTER PIPE pauses ingestion and can silently make downstream data stale.

    Explanation
    Inspect pipe status and downstream freshness requirements before pausing ingestion.
  30. put-overwrite

    High

    PUT with OVERWRITE = TRUE can replace files in an internal stage.

    Explanation
    Upload to a versioned stage path and LIST existing files first.
  31. remove-stage-files

    High

    REMOVE deletes files from an internal Snowflake stage.

    Explanation
    LIST the exact stage path and verify retention or a backup before removing files.
  32. replace-live-object

    High

    CREATE OR REPLACE replaces a live Snowflake object and may lose grants, state, or configuration.

    Explanation
    Create and validate a separate object before changing the live definition.
  33. shell-escape

    High

    !system runs a shell command from inside the SnowSQL session, outside dcg's shell analysis.

    Explanation
    SnowSQL's !system passes its operand to the operating-system shell. Run that command directly in the shell instead, where dcg evaluates it like any other command.
  34. stdin-unverified

    High

    snow sql receives SQL or a source that dcg cannot completely verify.

    Explanation
    Materialize the exact rendered SQL, keep all !source inputs local, and review every statement before execution.
  35. suspend-task

    High

    ALTER TASK SUSPEND stops scheduled execution.

    Explanation
    Inspect task dependencies and active runs before suspending the task.
  36. suspend-warehouse

    High

    ALTER WAREHOUSE SUSPEND can interrupt active or queued workloads.

    Explanation
    Inspect active queries and dependent tasks before suspending compute.
  37. transfer-ownership

    High

    GRANT OWNERSHIP transfers control and can revoke or copy existing grants.

    Explanation
    Inventory outbound privileges and review COPY/REVOKE CURRENT GRANTS semantics before transferring ownership.
  38. abort-query

    Medium

    !abort cancels an active Snowflake query.

    Explanation
    Inspect query history and confirm the exact query ID before aborting it.
  39. alter-column

    Medium

    ALTER TABLE ALTER COLUMN can break writes and downstream consumers.

    Explanation
    Validate type, nullability, default, and policy changes against a clone first.
  40. bounded-delete

    Medium

    DELETE mutates every row selected by its WHERE predicate.

    Explanation
    Run the equivalent SELECT and COUNT against a clone before deleting rows.
  41. bounded-update

    Medium

    UPDATE mutates every row selected by its WHERE predicate.

    Explanation
    Preview affected rows and validate the update against a clone first.
  42. cli-app-version-drop

    Medium

    snow app version drop removes a Native App version definition.

    Explanation
    Dropping an application package version prevents new installs and upgrades of that version; releases pinned to it break.
  43. cli-dbt-drop

    Medium

    snow dbt drop removes a dbt project object from Snowflake.

    Explanation
    snow dbt drop removes the named DBT PROJECT object; scheduled `snow dbt execute` runs and tasks referencing it fail until it is redeployed.
  44. cli-dcm-drop

    Medium

    snow dcm drop removes a DCM project object from Snowflake.

    Explanation
    snow dcm drop removes the named DCM PROJECT object, including its deployment history in Snowflake.
  45. cli-snowpark-drop

    Medium

    snow snowpark drop removes a deployed procedure or function from Snowflake.

    Explanation
    snow snowpark drop function/procedure drops the named object from Snowflake. Downstream callers (tasks, other procedures, applications) fail until it is redeployed.
  46. copy-into-table

    Medium

    COPY INTO a table can load duplicate, corrupt, or unexpected data.

    Explanation
    Validate the staged files and load into a clone or scratch table first.
  47. drop-programmable-object

    Medium

    DROP removes a file format, sequence, function, or procedure used by workloads.

    Explanation
    Inspect object dependencies and preserve the current definition before removal.
  48. execute-immediate

    Medium

    EXECUTE IMMEDIATE runs generated SQL whose rendered semantics require explicit review.

    Explanation
    Materialize and review the exact rendered SQL, including templates and variables, before executing it.
  49. merge-data

    Medium

    MERGE can update, insert, or delete rows based on source matching.

    Explanation
    Validate source uniqueness and preview matched and unmatched rows against a clone.
  50. rename-object

    Medium

    Renaming a database, schema, or table can break fully qualified consumers.

    Explanation
    Inventory consumers and stage a coordinated cutover before renaming the object.
  51. warehouse-settings

    Medium

    ALTER WAREHOUSE SET can create availability or cost risk.

    Explanation
    Review active consumers, size, scaling, and auto-suspend settings before applying changes.