How to Configure Windsurf Postgres Credentials
You set up windsurf postgres credentials by storing database keys in your shell profile or MCP config. Then you link the AI editor to a restricted database role. Note that Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same IDE and features. Most teams start by putting a local database string into an editor config file. When that role has broad permissions, a bad prompt can alter tables or leak private rows. How windsurf postgres credentials work in the editor In De
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 credentials by storing database keys in your shell profile or MCP config. Then you link the AI editor to a restricted database role. Note that Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same IDE and features. Most teams start by putting a local database string into an editor config file. When that role has broad permissions, a bad prompt can alter tables or leak private rows.
How windsurf postgres credentials work in the editor
In Devin Desktop, the agent runs terminal commands on its own with user permission. It opens a dedicated terminal that uses zsh on macOS or bash on Linux. That terminal loads your local shell settings right away. Any aliases and variables you set up in your shell become open to the agent. The legacy Cascade agent also links to MCP servers that you define in your local config. When the agent queries a database, it uses the keys stored in those local files.
Because the agent reads your shell variables, you should never give it your primary admin key. Instead, you create a dedicated Postgres role just for the coding agent. Postgres lets you set up group roles to manage permissions when you have many users. You then add individual accounts as members of that group role. This keeps your database permissions clean and easy to review across your team.
How to lock down the Postgres role
A safe setup starts by cutting back what the database role can do by default. In Postgres, a special role called PUBLIC gives basic rights to every role on the system. By default, PUBLIC gets the right to log in and make temporary tables on databases. It also gets the right to run functions and procedures. The database owner can take away these default rights to tighten security.
You also need to check who can make new objects in the public schema. In Postgres 15 and newer, the default setup blocks users from creating objects there. Older databases, or ones upgraded from older versions, still let anyone create objects in public. An admin must fix this by taking the create right away from the PUBLIC role.
Once you clear out default rights, you grant read privileges only where the agent needs them. The select privilege lets a role read from any column of a table or view. You can also grant select on specific columns of a table or materialized view. Keep in mind that the select privilege also allows the copy command to export data. By granting select only on safe columns, you stop the agent from reading secret columns.
Ephemeral Credentials + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they miss
Native Postgres roles and local config files solve the basic login problem. They decide which database user can log in from the editor. They also control which tables and columns that user can read or write. If the agent tries to drop a table without permission, Postgres blocks the command.
Still, static roles leave a big operational gap during live coding sessions. First, storing plain keys in shell profiles or config files leaves secrets sitting on developer laptops. Any process or terminal command that the agent runs can read those stored keys. Second, database roles only check who logs in and which objects they touch. They do not inspect what individual queries do in flight. If a table holds emails, phone numbers, card numbers, or national IDs, select returns them all. A static role cannot rewrite matched fields in results before they reach the AI model. It also cannot ask a human to approve a risky query while letting safe reads pass.
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
Did Windsurf change its name to Devin Desktop?
Yes, Cognition renamed Windsurf to Devin Desktop on June 2, 2026. The editor keeps the same features, and old docs links now go to the new site.
Can the agent read database keys from my shell profile?
Yes, the agent runs commands in a terminal that loads your zsh or bash settings. Any database keys stored in your shell variables are open to the agent.
How do I limit which columns the agent can read in Postgres?
You can grant the select privilege on specific columns of a table or view. This lets the agent query safe columns while blocking it from reading others.
Related guides
In this post