How to Configure Windsurf Postgres Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a windsurf postgres sandbox, create a restricted database role with read-only rights. Then point your AI coding agent to an isolated database instance using that role. Teams often give coding agents their own local database keys to speed up work. When roles have broad rights, an agent can change tables or read private user rows. A good sandbox limits what the agent can touch from the start. How a windsurf postgres sandbox works with native roles Cognition renamed Windsurf to Devin D

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.

To set up a windsurf postgres sandbox, create a restricted database role with read-only rights. Then point your AI coding agent to an isolated database instance using that role. Teams often give coding agents their own local database keys to speed up work. When roles have broad rights, an agent can change tables or read private user rows. A good sandbox limits what the agent can touch from the start.

How a windsurf postgres sandbox works with native roles

Cognition renamed Windsurf to Devin Desktop in June 2026. The app keeps the same editor and features under this new name. Its coding agent can run terminal commands on its own after the user approves. The agent runs inside a dedicated shell that loads the user shell setup. Because of this, your shell aliases and database keys are open to the agent. Its legacy Cascade agent also talks to external tools through Model Context Protocol servers.

To keep the agent safe, you must lock down the Postgres role it uses. Start by making a group role for your sandbox users. You can grant specific user roles membership in this group role. Next, check what the special PUBLIC role allows in your database. By default, every role gets the PUBLIC rights to connect and make temp tables. The PUBLIC role also lets users run functions and procedures unless the owner revokes them.

In Postgres 15 and newer, users cannot make objects in the public schema by default. If you upgraded from an older version, revoke create rights on that schema from PUBLIC. Then grant the SELECT right to your agent role on safe tables only. Postgres lets you grant SELECT on a whole table or just on specific columns. Keep in mind that the SELECT right also allows the role to export table data.

Why native roles are not enough for agent queries

Native Postgres roles do a great job of blocking table drops and bad writes. They also help you group users and manage schema access across your team. Still, database roles only check who logs in and which tables they can read. They do not inspect what individual queries do while they run in flight.

AI Sandbox Environments + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Even in a test database, tables often hold real emails, phone numbers, or card numbers. If a table has ten thousand rows, the SELECT right lets the agent read all of them. A single broad query can pull national IDs into the agent prompt window. Also, storing raw database keys in a shell file leaves them open to any terminal command. Teams need a way to check queries and rewrite sensitive fields like emails in results.

Steps to harden your database setup

First, remove raw database passwords from your shell profile so the agent shell stays clean. Second, revoke default execute rights from the PUBLIC role on sensitive database procedures. Third, grant column-level SELECT rights so the agent skips columns with card numbers or phone numbers. Fourth, review every terminal command the coding agent asks to run before you approve it. These habits shrink the risk of an agent reading or changing the wrong data.

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

Did Windsurf change its name?

Yes, Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same editor features, and old help links now point to Devin Desktop docs.

Can the coding agent read my local shell variables?

Yes, the agent runs commands in a dedicated shell that loads your normal shell setup. Any database keys or aliases in your shell profile are available to the agent.

Does the Postgres SELECT right allow data exports?

Yes, granting SELECT on a table or column also allows the COPY TO export command. You can limit exposure by granting SELECT only on specific safe columns.

The query runs. The emails stay hidden.