How to Configure Windsurf Neon Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up windsurf neon least privilege by creating a restricted Postgres role for your agent. Then you grant that role read or write rules on specific tables only. Many teams skip this step when they first test AI coding tools. They give the agent the default database owner key instead. That broad key lets an automated prompt drop tables or read every row. How windsurf neon least privilege works in practice Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same IDE f

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 neon least privilege by creating a restricted Postgres role for your agent. Then you grant that role read or write rules on specific tables only. Many teams skip this step when they first test AI coding tools. They give the agent the default database owner key instead. That broad key lets an automated prompt drop tables or read every row.

How windsurf neon least privilege works in practice

Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same IDE features and the Cascade agent. The agent runs terminal commands on its own after the user gives permission. It opens a dedicated shell using zsh on macOS or bash on Linux. That shell loads the user profile, aliases, and local variables. The agent also talks to external tools through the Model Context Protocol.

When the agent queries a Neon database, it uses the keys found in your shell. Or it uses the database string passed to its local MCP server. To limit risk, you create a dedicated Postgres role inside your Neon branch. You strip public schema creation rights from this new role. Next, you grant select permissions only on the tables needed for the task. If the agent must test migrations, you point it to an isolated Neon branch. You never put the production database owner key in your local shell profile.

What native database roles solve and what they miss

Native Postgres roles in Neon stop an agent from touching blocked tables. They also stop a read-only user from running delete or drop commands. Branching in Neon gives developers a safe copy of the schema for tests. These native controls decide which database role can log in and query tables.

Still, static database roles cannot check what individual queries do in flight. If a role has select access to a user table, it reads every column by default. The agent pulls emails, phone numbers, card numbers, and national IDs into its context. Also, a role that needs write access for one fix can still run a bad update. Sharing static database keys in local files makes rotation hard for your security team. When five developers share one agent role, the database log shows one user name. You cannot tell which person or prompt ran a risky command.

Least Privilege Principle + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Securing local shell variables and agent tools

Because the IDE loads your shell profile, any exported key is open to the agent. Developers often store database URLs in plain text files on their laptops. If the agent runs a shell script, it can read those local files. Teams should remove long-lived production keys from local shell profiles right away. Instead, give the agent a role that only works on non-sensitive development data. When the agent needs to check real data, you need controls that inspect each query.

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

How does Windsurf reach a Neon Postgres database?

Windsurf, now called Devin Desktop, runs commands in a dedicated zsh or bash shell. It reads database keys from your shell profile or through a configured MCP server.

Why is the default Neon role risky for AI coding agents?

The default Neon role owns the database and can drop tables or read all data. If an agent makes a mistake with that key, it can break your whole database.

Can Postgres roles hide sensitive columns from AI prompts?

Standard table grants allow or block access to the whole table or specific columns. They cannot rewrite emails or card numbers inside query results on the fly.

The query runs. The emails stay hidden.