How to Configure Windsurf Supabase Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a windsurf supabase prevent delete rule by creating a restricted database role. You then take away delete rights from the role that the AI agent uses. Most teams start by giving their coding tool the main project password. That default role has admin rights and can drop tables or wipe rows by mistake. A safer setup uses a custom role that only reads data or inserts new rows. How windsurf supabase prevent delete works at the role level Cognition now calls Windsurf by the new name De

End-to-End Encryption: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up a windsurf supabase prevent delete rule by creating a restricted database role. You then take away delete rights from the role that the AI agent uses. Most teams start by giving their coding tool the main project password. That default role has admin rights and can drop tables or wipe rows by mistake. A safer setup uses a custom role that only reads data or inserts new rows.

How windsurf supabase prevent delete works at the role level

Cognition now calls Windsurf by the new name Devin Desktop in its docs. The IDE includes an agent that runs terminal commands with your permission. It opens a dedicated shell on your computer to run those tasks. That shell loads your local profile and reads your stored database keys. The legacy Cascade agent also links to external tools through Model Context Protocol servers.

Every new Supabase project comes with a default admin role for Postgres. This default role is not a full superuser, because superusers can do destructive system tasks. Still, the default role still has full admin rights over your project tables. You create the password for this admin role when you start the project. Supabase says you should not give this admin password to third-party tools. Instead, Supabase recommends that you make a separate database user for every service.

To stop deletes, you make a custom Postgres role just for your coding agent. You grant that role permission to read tables and insert or update rows. You leave out the delete privilege and any right to drop tables. You then put the new role credentials into the local shell or tool settings. When the agent tries to run a delete statement, the database blocks it right away.

What native database roles solve and what they leave open

A custom database role solves the problem of broad admin rights in your editor. It stops an agent from wiping a table when a prompt goes wrong. It also separates your agent traffic from queries that run in the project dashboard. Dashboard queries run under the default admin role and include a dashboard source comment.

Still, static database roles only check who logs in at the start of a session. They do not inspect what individual statements or commands try to do in flight. First, a developer might need the agent to run a safe, single-row cleanup during debugging. With a static role, you must edit database grants and change them back later. Second, the agent runs in a local shell that reads your shell profile. If your admin key sits in that file, the agent can still use it. Third, table grants do not mask sensitive fields in query results. If the agent reads a user table, it pulls back raw emails and phone numbers. Card numbers and national IDs also come back in plain text unless you rewrite results.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why shell variables and local tool files need careful checks

The agent terminal loads your standard shell setup on macOS or Linux. Any database string saved in your local shell files is open to the agent. Developers often save the default admin password there to run schema migrations. If the agent runs a script from that shell, it inherits those admin rights.

You should store only the restricted role password in the folder where the agent works. Keep your admin password out of the shell files that load for every new terminal. You should also check the settings for any Model Context Protocol server you use. Make sure those servers log in with the restricted role instead of the project admin. This habit keeps your database safe even when the agent runs commands on its own.

Add query and result controls beside Postgres

Grants and pools govern who logs into PostgreSQL. Yet every query in an open session still runs with that role's full scope. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your Postgres. For every plain or prepared query an agent or human runs against production, hoop.dev decides to pass, mask, block, or escalate it for review.

When a tool or agent sends SQL, hoop.dev Postgres controls block banned statements before execution or hold risky ones for human approval via an AI Analyzer you configure. Matched sensitive columns in result rows are masked in memory before they reach the caller. Each query and decision is logged per listener, which generates evidence for SOC 2, HIPAA, and GDPR audits. View the binary on GitHub.

Frequently asked questions

Does the default Supabase role allow an agent to delete tables?

Yes, the default Postgres role in Supabase has admin rights over your database. If you give that password to your agent, it can delete rows and drop tables.

How does the Windsurf agent reach my Supabase database?

Windsurf, now called Devin Desktop, runs terminal commands in a shell that loads your profile. It can also reach your database through a configured Model Context Protocol server.

Can database role grants hide sensitive user data from the agent?

Standard table grants only control who can read, write, or delete from a table. To hide emails, phone numbers, or card numbers, you must rewrite matched fields in results.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.