You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 13c911c
Browse filesBrowse the repository at this point in the historyBrowse files
fix: harden SQL classification for the tool CLI and MCP server
Refuses more writes that would run as reads, and blocks more ways of writing DROP DATABASE,
DROP SCHEMA or TRUNCATE.
- sql_explain explains one statement and refuses EXPLAIN options in its input. Some drivers run
every statement after EXPLAIN, and EXPLAIN ANALYZE executes the statement.
- Writes that ran as reads: Snowflake ->> statement chains; dbt Jinja anywhere in the SQL on the dbt
route; Spark TRANSFORM ... USING; and functions that write or call outside systems (ClickHouse
jdbc, Spark reflect/java_method, Databricks http_request/remote_query, DuckDB bigquery_execute,
ducklake_*, postgres_attach/sqlite_attach, Snowflake GETNEXTVAL). Sequence advances through a
quoted or commented NEXTVAL, in Oracle, Snowflake and MariaDB.
- Lexing: Spark and MySQL /*+ hints holding a quote, Oracle q'...' quotes, a Spark -- comment
ending in a backslash and a /* inside a comment where nesting is unknown are uncertain.
ClickHouse heredocs are strings.
- Hard block (best effort, now documented as such):
- a write's literals are read as SQL with escapes decoded as each engine reads them;
- TRUNCATE is found at statement, block and handler starts and after THEN/ELSE, including
quoted, dotted and IF EXISTS targets;
- DROP CATALOG, DROP NAMESPACE, DROP EXTERNAL SCHEMA and DROP PLUGGABLE DATABASE are blocked.
- Columns and aliases named truncate, throw or nextval, and CASE ... THEN truncate, are reads
again.
- data_diff reads an empty target_warehouse as the source warehouse in both layers. The dbt
dialect check follows the dbt adapter the daemon has already created.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copy file name to clipboardExpand all lines: docs/docs/usage/tool.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Only the data tools are exposed. Coding tools (`bash`, `read`, `edit`, ...), `db
51
51
52
52
Runs are read-only by default. Reads such as `sql_execute` on a SELECT and `schema_inspect` are allowed; anything else is refused with `Permission denied: <kind>. Re-run with --allow-write to enable writes.` Tools that change local configuration (`warehouse_add`, `warehouse_remove`, `warehouse_install_driver`) also need `--allow-write`.
53
53
54
-
`DROP DATABASE`, `DROP SCHEMA` and `TRUNCATE`stay blocked even with `--allow-write`.
54
+
`DROP DATABASE`, `DROP SCHEMA` and `TRUNCATE`are refused even with `--allow-write` when the SQL check recognises them. The check reads the SQL text, so it is best effort: a statement the warehouse builds or decodes at run time (dynamic SQL assembled by concatenation, a stored routine, an unusual literal encoding) can get past it. For a hard guarantee, connect with a database user that has no `DROP` or `TRUNCATE` privilege.
0 commit comments