Skip to content

execute_sql runs DELETE / UPDATE without WHERE inside a CTE without the destructive confirmation #563

Closed as not planned

Description

@3mo0o0ry2001

Describe the bug

With a client that supports elicitation, execute_sql asks for confirmation before delete from films. When the same operation is in a WITH query, it runs without asking. isDestructiveSql only checks whether a statement starts with drop|delete|truncate or update, so a statement that starts with WITH is never classified as destructive.

To reproduce

isDestructiveSql from packages/mcp-server-supabase/src/tools/destructive-sql.ts, main @ 9092ab9, v0.17.0:

query result
delete from films asks
with x as (select 1) delete from films runs
with d as (delete from films returning *) select count(*) from d runs
with u as (update films set title = 'x' returning *) select 1 runs

Expected behavior

All three WITH queries ask for confirmation, like the first query does.

Notes

#426 parses SQL and covers "operations in executing CTEs", and #532 reports the related MERGE case. Since #426 is still open, I can add a small fix on the current regex path with tests for these cases, if that's useful until the parser lands. Happy to follow whichever approach you prefer.

Activity

  1. added
    bug
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions