PostgreSQL wire
Relays authentication, preserves the upstream role by default, blocks unsafe statements, and rewrites eligible reads for masking.
Safe Boundary places enforcement in the data path you choose: a PostgreSQL wire proxy, a local MCP server, or an HTTP filter in front of Supabase PostgREST.
POSTGRESQLWhy this exists
The wire proxy and HTTP filter run in infrastructure you control. The MCP package runs locally and connects directly to PostgreSQL. Query text and results do not need to traverse a Spectral Core-hosted data path.
Each surface parses the request before execution, applies configured masking and blocking policy, and emits a compatible audit record. The protocol mechanics differ, but the security intent remains consistent.
What it does
Relays authentication, preserves the upstream role by default, blocks unsafe statements, and rewrites eligible reads for masking.
Runs as a local stdio server, applies read-only and masking policy, denies dangerous functions, and bounds returned rows and bytes per session.
Forwards JWT and apikey headers, preserves upstream RLS, masks JSON or CSV, and blocks leaky filters on protected columns.
How it fits
The policy intent is shared, but the evidence and bypass conditions are surface-specific.
| Decision | PostgreSQL wire | MCP server | Supabase REST |
|---|---|---|---|
| Best for | Apps, ORMs, psql, BI tools | Local AI tool calls | Browser and service HTTP clients |
| Identity available | Upstream database role | Local agent metadata plus database auth | Forwarded JWT/apikey and selected role |
| Distinct boundary | TLS termination and direct DB URLs | Process-local budgets and labels | Original PostgREST URL and other Supabase products |
How it works
Point the client at the appropriate Safe Boundary endpoint.
Interpret SQL or PostgREST structure instead of relying on regex.
Block, mask, or observe according to configured policy.
Write the decision and available attribution into the shared audit shape.
Protected when
Important boundaries
Continue the story
See why database permissions alone do not govern every AI-era data path.
Understand trust boundaries, credentials, identity, and bypass conditions.
Route constrained callers through the boundary and close direct access paths.
Start in observe mode and validate the policy against representative traffic before you enforce it. That gives the team evidence for each decision, along with explicit bypass controls for the cases that need a deliberate exception.