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 6b5b356
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 (ANALYZE, VERBOSE,
an option list), since some drivers run every statement after EXPLAIN and EXPLAIN ANALYZE
executes it; a parenthesized query is still explained.
- Writes that ran as reads: Snowflake ->> statement chains; dbt Jinja anywhere in the SQL on the dbt
route; Spark TRANSFORM ... USING <script>; 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 and Oracle q'...' quotes 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 followed by a target is found wherever it sits
(statement, block or handler start, THEN/ELSE, CREATE TASK ... AS, routine bodies, BEGIN ATOMIC,
ALTER TABLE ... TRUNCATE PARTITION); DROP CATALOG, DROP NAMESPACE, DROP EXTERNAL SCHEMA and DROP
PLUGGABLE DATABASE are blocked.
- Columns named truncate, throw or nextval, and CASE ... THEN truncate, read as columns 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` are refused even with `--allow-write`. The block reads the SQL text, so it is best effort: statements built at run time, for example by a stored procedure, are not seen. For a hard guarantee, connect with a database user that lacks `DROP`and`TRUNCATE`.
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.
55
55
56
56
Tool results go to the model of the agent that called the tool. `sql_execute` returns result rows, `warehouse_list` shows one sample row per table of a local database, and `schema_inspect` and `sql_execute` with `tables` return value profiles per column; set `ALTIMATE_DISABLE_SCHEMA_VALUES=1` to leave the value profiles out. Keep passwords and keys out of `warehouse_add` arguments, which end up in the calling agent's transcript: reference credentials from a connections file or `ALTIMATE_CODE_CONN_*` variables instead.
0 commit comments