How to Configure Devin Postgres Permissions
You set up devin postgres permissions by creating a limited database role for the agent. You then grant read privileges only on specific tables and columns. Many teams start by giving their coding agent a standard developer login. This broad role lets the agent change schemas, drop tables, or read private customer data. A small mistake in an agent task can then break production tables or expose sensitive records. How native devin postgres permissions work PostgreSQL manages database actions t
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 devin postgres permissions by creating a limited database role for the agent. You then grant read privileges only on specific tables and columns. Many teams start by giving their coding agent a standard developer login. This broad role lets the agent change schemas, drop tables, or read private customer data. A small mistake in an agent task can then break production tables or expose sensitive records.
How native devin postgres permissions work
PostgreSQL manages database actions through roles and object privileges. Teams often create a group role to manage privileges across multiple users or agents. You then grant the agent role membership in that group role. This keeps permission changes simple as your team adds more automated tools.
For a coding agent, read-only privileges are the safest starting point. The SELECT privilege lets a role read from a table, view, or materialized view. You do not have to grant SELECT on an entire table. PostgreSQL lets you grant SELECT on specific columns of a table instead. This helps you keep the agent away from columns that hold passwords or keys. Still, the SELECT privilege also allows COPY TO, which lets the role export table data.
You must also check what the special PUBLIC role allows in your database. Every role on the system receives privileges granted to PUBLIC. By default, PUBLIC gets CONNECT and TEMPORARY privileges on databases. PUBLIC also gets EXECUTE privileges on functions and procedures by default. An object owner can revoke these default grants to lock down the agent role.
Schema creation rules also matter when you set up devin postgres permissions. In PostgreSQL 15 and later, regular users cannot create objects in the public schema by default. Older databases, or ones upgraded from earlier versions, still allow this behavior. On those systems, an admin must revoke CREATE on the public schema from PUBLIC. Otherwise, the agent can create new tables or views inside the public schema.
What native roles solve and what they miss
Native database roles solve the problem of who can log in and touch specific objects. A well-scoped role stops an agent from dropping tables or reading restricted columns. It sets a clear boundary at the table and column level before work begins.
AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Yet static roles cannot inspect what individual statements do while the agent works. Once a role has SELECT on a column, it can read every row in that column by default. Native grants cannot rewrite sensitive values like emails, phone numbers, card numbers, or national IDs in query results. They also cannot pause a risky command for human approval when an agent needs a one-time write. Finally, shared role credentials make it hard to tie a specific query back to one agent task.
Steps to tighten agent database roles
Start by creating a dedicated role just for your coding agent. Do not share a human engineer login with an automated tool. Next, revoke default PUBLIC privileges on databases and functions that the agent does not need. Check your database version and revoke CREATE on the public schema from PUBLIC if needed.
Grant SELECT only on the exact tables and columns required for the current task. Avoid table-wide grants on tables that store customer records or secrets. Review these grants often as your schema grows and new tables appear. New objects do not inherit custom restrictions unless you update your default privileges.
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. It runs beside your database and reads the Postgres wire protocol. 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 check the statement by its effect, table, or pattern. They refuse bad deletes or drops with a real Postgres error. On the way back, hoop.dev data masking rewrites sensitive values in returned rows based on your rules. Every query and 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
Can I limit Devin to reading only certain columns in PostgreSQL?
Yes. PostgreSQL lets you grant the SELECT privilege on specific columns of a table or view. The agent role will only be able to read the columns you name in the grant.
Why can my read-only agent role still run functions or create temp tables?
PostgreSQL grants CONNECT, TEMPORARY, and EXECUTE on functions to the PUBLIC role by default. Every database role gets PUBLIC privileges unless the object owner revokes them.
How do I stop an agent from creating objects in the public schema?
PostgreSQL 15 and newer block this by default. On older or upgraded databases, an admin must revoke the CREATE privilege on the public schema from PUBLIC.
Related guides
In this post