How to Configure Windsurf Supabase Least Privilege
You set up windsurf supabase least privilege by making a custom database role with small grants. Then you give that role to your coding agent instead of the default admin role. Many teams skip this step when they first test an AI assistant. They put the default project password into a local shell file for speed. That choice gives the agent full admin rights over every table and row. If the agent makes a bad query, it can drop tables or read private user data. How windsurf supabase least privil
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up windsurf supabase least privilege by making a custom database role with small grants. Then you give that role to your coding agent instead of the default admin role. Many teams skip this step when they first test an AI assistant. They put the default project password into a local shell file for speed. That choice gives the agent full admin rights over every table and row. If the agent makes a bad query, it can drop tables or read private user data.
How windsurf supabase least privilege works in practice
Cognition renamed Windsurf to Devin Desktop in June 2026, while keeping the same IDE features. Inside the editor, the agent can run terminal commands in its own shell with user approval. This dedicated shell loads your normal shell setup on macOS or Linux. That means the agent can read local shell variables and aliases on your machine. The legacy Cascade agent also talks to local tool servers that you set up.
Every Supabase project starts with a default postgres role that holds admin rights. Supabase does not grant full superuser status to prevent harmful system actions. Still, the default role still has wide power across your schemas and tables. When you set up your project, you create a password for this admin role. Supabase warns teams not to share this password with outside tools or services. Instead, you should make a fresh database user for each tool that needs database work.
To lock things down, you create a dedicated role just for your AI coding agent. You grant this role read rights only on the specific tables it needs to inspect. You also leave out write or delete rights on production schemas. When the agent runs a terminal command or tool call, it uses this limited login. The database then blocks any command that tries to step outside those table grants.
What native database roles solve and what stays exposed
Native database roles do a great job of limiting which tables an agent can touch. They stop an agent from dropping a schema if the role lacks admin grants. They also keep the main admin password out of your project files. Built-in roles like anon and authenticated work alongside row rules to gate app traffic. A custom role for your editor brings that same basic boundary to local agent tasks.
Least Privilege Principle + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static database roles only check who logs in at the start of a session. Once the agent logs in with a read role, it can read every column in allowed tables by default. If an allowed table holds emails, phone numbers, or card numbers, the agent pulls them into context. A static role also cannot tell a safe query from a risky bulk read in flight. Plus, the plain password for that custom role still sits in a local file on disk.
Why local shell variables create hidden risks for coding agents
Because the editor loads your shell profile, any secret saved there is open to the agent. Developers often store database URLs in shell files so local scripts can run fast. When the agent runs a shell command, it inherits those exact credentials right away. Even if you prompt the agent to be careful, the underlying shell has full power. A real safety setup must check every query in flight and mask fields like national IDs.
Check every Postgres query on the wire
Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.
Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.
Frequently asked questions
Should I give the default Supabase postgres password to my AI coding agent?
No, the default postgres role has admin privileges across your database. Supabase advises creating a separate database user for each external tool or service you use.
How does Windsurf or Devin Desktop reach my database during a coding session?
The agent runs commands in a dedicated shell that loads your local shell setup and variables. It can also reach external systems through tool servers that you configure on your machine.
Can a read-only Postgres role stop an agent from pulling sensitive user columns?
A basic table grant lets the role read all rows and columns in that table by default. Without column rules or runtime masking, queries still return emails, phone numbers, and card numbers.
Related guides
In this post