How to Configure Windsurf Postgres Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up windsurf postgres approval by pairing editor command prompts with strict database roles. You also restrict table rights before the coding agent runs a single query. Teams often let their editor use a shared admin login during local work. That broad role lets an autonomous agent drop tables or read secret rows by mistake. A safer setup limits both what the agent can run and what the database allows. How windsurf postgres approval works with native roles In June 2026, Cognition renam

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 postgres approval by pairing editor command prompts with strict database roles. You also restrict table rights before the coding agent runs a single query. Teams often let their editor use a shared admin login during local work. That broad role lets an autonomous agent drop tables or read secret rows by mistake. A safer setup limits both what the agent can run and what the database allows.

How windsurf postgres approval works with native roles

In June 2026, Cognition renamed Windsurf to Devin Desktop while keeping the same IDE features. Its agent can run terminal commands on its own when the user gives permission. Those commands run in a dedicated shell that loads the local user setup. That means shell aliases and saved database keys are ready for the agent to use. The legacy Cascade agent also talks to local MCP servers when teams set them up.

Because the agent shares the user shell, local prompts are your first check. You can make the editor ask for permission before it runs a terminal command. Yet clicking approve in a code editor only checks the shell call itself. Once the query leaves the editor, PostgreSQL takes over and checks the database role.

You should build a dedicated group role in PostgreSQL for your coding agents. Users or tools join that group role instead of using a personal admin login. For read tasks, grant the SELECT right only on the specific columns the agent needs. Remember that SELECT also lets the role export table data through the copy command. You should also check what the special PUBLIC role allows inside your database.

By default, every role gets rights to log in and make temporary tables through PUBLIC. The PUBLIC role also lets users run functions and stored procedures right out of the box. A database owner can take away these default PUBLIC rights to lock down the system. In PostgreSQL 15 and newer, regular users cannot make new objects in the public schema. On older databases, an admin must remove that create right from PUBLIC by hand.

Why native roles and local prompts leave gaps

Local editor prompts and database roles solve the problem of who can log in. They also stop an agent from writing to tables when it only has read rights. Still, this native setup leaves a wide gap during active work.

Approval Chains & Escalation + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Editor prompts suffer from fatigue when an agent runs dozens of commands in a row. A tired developer will soon click approve without reading the full SQL query text. Even worse, an MCP tool might run a database query without showing the raw SQL. If the agent needs write rights to fix a bug, static roles cannot save you. A role that allows row updates can delete every row if a WHERE clause is missing by default.

What to check before an agent query runs

Database roles apply the same static rules to every query in a session. They cannot pause a single risky DELETE statement to ask a team lead for approval. They also cannot rewrite sensitive fields like emails, phone numbers, or card numbers in results. When an agent pulls sample rows to debug code, raw national IDs enter the prompt context.

To fix this, teams need checks that inspect each statement in flight. High-risk queries should wait for a human check before reaching the database engine. At the same time, safe read queries should have sensitive fields masked in the returned rows. This keeps work moving fast while stopping bad writes and data leaks.

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

Does Devin Desktop use the same setup as Windsurf for database tasks?

Yes, Windsurf became Devin Desktop in June 2026 and kept the same IDE features. Its agent still runs terminal commands with user permission and reads your local shell setup.

Can a read-only PostgreSQL role still run functions or copy data?

Yes, the SELECT privilege also allows bulk exports using the copy command. Also, the default PUBLIC role lets any user run functions unless the owner removes that right.

Why are editor command prompts not enough for database safety?

Local prompts only ask the developer running the editor to click approve. They do not require a second reviewer for risky writes or mask emails and card numbers.

The query runs. The emails stay hidden.