• AgentArmorHQ teamTeam4d agoNeeds helpSolved

    Why does Supabase MCP execute_sql ask for confirmation on UPDATE statements with a semicolon inside a string value?

    With the Supabase MCP server's execute_sql tool, UPDATE statements whose quoted string values contain a semicolon are flagged as UPDATE without WHERE or as destructive. In clients that cannot answer the confirmation, the call waits until the tool timeout, and in some clients it is declined with only a status and no explanation. The check splits the SQL on semicolons before removing quoted text.

    Originally asked on GitHub: https://github.com/supabase/mcp/issues/457

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: partly addressed. PR #459 is reported in the thread to fix the UPDATE half of the problem for single-quoted semicolons. The reporter says it also covers an apostrophe inside a dollar-quoted value. The checkDestructiveQuery half (quoted 'delete', 'drop' or 'truncate' after a semicolon) is still open, and a commenter reports that dollar-quoted values containing semicolons are still flagged on #459's head.

      What the thread checked on #459's head by calling isUpdateWithoutWhere directly: UPDATE films SET title = 'review; no adoption' WHERE id = 1; returns false, and UPDATE films SET title = null; still returns true. Procedural bodies such as DO $$ BEGIN PERFORM 1; UPDATE films SET title = null; END $$; stay flagged by design.

      Workaround used by the reporter: keep semicolons out of SQL text by sending the value hex-encoded and decoding it in SQL with convert_from(decode('...', 'hex'), 'UTF8'). Another commenter moved free-text writes to base64 with convert_from(decode('...', 'base64'), 'UTF8') and keeps semicolons out of literals. The reporter kept the confirmation enabled because it protects other statements.

      Security note: the confirmation guards destructive statements, so disabling it to avoid these prompts removes that protection.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      Reporter removed semicolons from the SQL text by sending the value hex-encoded and decoding it in SQL with convert_from(decode('...','hex'),'UTF8'), keeping the confirmation enabled.

      Source: https://github.com/supabase/mcp/issues/457 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @kelliepatry tried on GitHub (Worked)

      Commenter ran seven direct isUpdateWithoutWhere checks against PR #459's head, including quoted-semicolon UPDATEs and a dollar-quoted procedural body, and got the expected results.

      Source: https://github.com/supabase/mcp/issues/457#issuecomment-6093181150 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @hexproof-dev tried on GitHub (Outcome unclear)

      Commenter moved free-text writes to base64 decoding in SQL (convert_from(decode('...','base64'),'UTF8')) and keeps semicolons out of literals.

      Source: https://github.com/supabase/mcp/issues/457#issuecomment-6154727444 (opens external site)

      Did this work for you?

    Add your answer or comment