Repository navigation
fix: discourage host-filesystem access in raw-SQL tool descriptions - #410
Conversation
Coverage Report for CI Build 34176164896Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.1%) to 96.404%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
…erver instructions) LLMs driving the MCP server attempt to load the host's local filesystem into the customer database via SQL (COPY FROM '/path', COPY FROM PROGRAM, pg_read_file, pg_ls_dir, lo_import). These fail at the DB layer (the project's Postgres role isn't a superuser), but the server offers no guidance that the host boundary exists. - Primary (reliable): a shared HOST_BOUNDARY_NOTE appended to the two raw-SQL tool descriptions (execute_sql, apply_migration). A client cannot invoke a tool without ingesting its description, whereas the server `instructions` ride on the optional `server/discover` response and aren't guaranteed to be injected. Factored into one constant to prevent the two from drifting. - Defense-in-depth: a terse host-boundary line in the server `instructions`, for clients that do inject them (mirrors the existing dual-placement of the untrusted-data / injection warning). This is the exfil-OUT counterpart to the injection-IN guidance already present (AI-794 / wrapWithUntrustedDataBoundary). Co-Authored-By: Claude Opus 4.8 <[email protected]>
a085927 to
704eb33
Compare
commit: |
Rodriguespn
left a comment
There was a problem hiding this comment.
Hey Allan, this looks good — clean approach, and I've verified the note lands on exactly execute_sql + apply_migration and the instructions line ships on initialize. One thing I'd like before we merge:
The clause ("shared Supabase infrastructure; its host filesystem and OS are not the user's") is accurate for hosted/mgmt-api, where the alerts came from, but the same string ships to self-hosted Studio (here), where the user owns the host, and there it's actually load-bearing, since installs predating the superuser removal connect as supabase_admin, where these primitives genuinely succeed.
So I'd make the wording deployment-neutral so it's true everywhere:
const HOST_BOUNDARY_NOTE =
" Never read server-side files or run OS commands via SQL (e.g. `COPY ... FROM '/path'`, `COPY ... FROM PROGRAM`, `pg_read_file`, `pg_ls_dir`, `lo_import`) — load external data from the client side instead.";And in server.ts:
-- The project database runs on shared Supabase infrastructure; its host filesystem and OS are not the user's. Do not read server-side files or run OS commands via SQL.
++ SQL runs on the project's database server. Never read server-side files or run OS commands via SQL.Instruction and examples unchanged, only the rationale. Keeps the single shared constant, no per-platform branch, no drift.
Two small nits, non-blocking:
- qualify the "role isn't a superuser" line in the PR body (true for hosted, not for old self-hosted installs),
- Note in the PR that ChatGPT snapshots/freezes tool descriptions + instructions, so it needs a plugin resubmission to take effect there. No action from your side needed, this one is on us. Also, low risk since the MCP connection on Chatgpt is serverless and (hopefully) sandboxed by OpenAI
…ack) Per review: the same mcp-server-supabase ships to self-hosted Studio, where the "shared Supabase infrastructure / not the user's" rationale is false (the user owns the host, and pre-superuser-removal installs connect as supabase_admin where these primitives succeed). Drop the deployment-specific rationale; keep the imperative + examples, which are true everywhere. Single shared constant unchanged — no per-platform branch, no drift. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Thanks Pedro — good catch. Applied the deployment-neutral wording verbatim (dropped the "shared Supabase infrastructure / not the user's" rationale from both |
|
Confirmed — the applied wording matches exactly what I proposed: |
Rodriguespn
left a comment
There was a problem hiding this comment.
Round 2: verified. HOST_BOUNDARY_NOTE is a single shared constant appended to both execute_sql and apply_migration descriptions, deployment-neutral (no "shared Supabase infrastructure"/"not the user's" language), keeps the imperative and all four examples (COPY ... FROM '/path', COPY ... FROM PROGRAM, pg_read_file, pg_ls_dir, lo_import). server.ts guideline line is now deployment-neutral: "SQL runs on the project's database server. Never read server-side files or run OS commands via SQL." Only the two expected files touched, no per-platform branching, no wording drift between the two tool descriptions. Addresses my round-1 feedback. Approving.
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-server-supabase: 0.13.0</summary> ## [0.13.0](mcp-server-supabase-v0.12.0...mcp-server-supabase-v0.13.0) (2026-09-17) ### ⚠ BREAKING CHANGES * **mcp:** confirm destructive SQL via elicitation and rename costConfirmation option ([#408](#408)) ### Features * add --http local HTTP entry to mcp-server-supabase ([#401](#401)) ([ff063b4](ff063b4)) * **management:** add v2 api client ([#419](#419)) ([02ca542](02ca542)) * **mcp:** confirm destructive SQL via elicitation and rename costConfirmation option ([#408](#408)) ([c9c4e3f](c9c4e3f)) * support skip_elicitations in the local HTTP server ([#434](#434)) ([9442e82](9442e82)) * URL-mode secret collection for create_edge_function_secret ([#412](#412)) ([fb88629](fb88629)) ### Bug Fixes * discourage host-filesystem access in raw-SQL tool descriptions ([#410](#410)) ([641ed1e](641ed1e)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
What
Appends a shared
HOST_BOUNDARY_NOTEto the descriptions of the two raw-SQL tools —execute_sqlandapply_migration— and a matching one-line reminder in the serverinstructions, discouraging the model from reading server-side files or running OS commands via SQL (COPY … FROM '/path',COPY … FROM PROGRAM,pg_read_file,pg_ls_dir,lo_import).Why
Cut tripwire noise on the managed fleet. LLMs driving the MCP attempt host-filesystem reads via SQL, and the tripwire fires on the attempt — it records that the SQL ran, not whether it succeeded — so every probe generates alert noise regardless of outcome. Discouraging the model from making the attempt reduces the volume at the source. This is the exfil-OUT counterpart to the injection-IN guidance already present (AI-794 /
wrapWithUntrustedDataBoundary).Design
serverinstructions. Per the 2026 MCP spec,instructionsrides on the optionalserver/discoverresponse and isn't guaranteed to be injected; a client cannot invoke a tool without ingesting its description — so the description is the reliable delivery vehicle. The server-instructions line is added too, as opportunistic defense-in-depth.apply_migrationforwards arbitrary SQL too; these two are the only raw-SQL entry points.HOST_BOUNDARY_NOTE) to keep the two descriptions from drifting, mirroring the existingwrapWithUntrustedDataBoundaryfactoring.mcp-server-supabasealso ships to self-hosted Studio, where a "Supabase-managed infrastructure" rationale would be false (the operator owns the host). No self-hosted benefit is claimed; the goal is purely managed noise.FYI (per review)
ChatGPT snapshots/freezes MCP tool descriptions + instructions, so this needs a plugin resubmission to take effect there — tracked on the Supabase side, no action here.
Testing
String-concat append to two tool descriptions + one instructions bullet (type-trivial). No test asserts the raw-SQL description text (the
untrusted user dataassertions target the result wrapper), and the instructions test compares against the exported constant, so it stays in sync. Local suite not run — CI validates format/typecheck/tests.🤖 Generated with Claude Code