How to Configure Goose Postgres Permissions
You set up goose postgres permissions by creating a dedicated database role for your agent. Then you grant that role read or write rules on specific tables and columns. Many teams start by giving the Goose agent a shared developer login. This shortcut creates huge risks when an AI agent runs queries on its own. Broad roles let the agent read secret rows or drop important tables by mistake. How goose postgres permissions work in practice Goose connects to your Postgres database using a standar
AI Agent Permissions + End-to-End Encryption: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up goose postgres permissions by creating a dedicated database role for your agent. Then you grant that role read or write rules on specific tables and columns. Many teams start by giving the Goose agent a shared developer login. This shortcut creates huge risks when an AI agent runs queries on its own. Broad roles let the agent read secret rows or drop important tables by mistake.
How goose postgres permissions work in practice
Goose connects to your Postgres database using a standard database user and password. Postgres checks the rules tied to that specific role before running any query. You should never give the agent an admin role or a shared human login. Instead, create a group role that holds the exact rules the agent needs. Then you create a login user for Goose and add it to that group role.
If Goose only needs to inspect data, grant the SELECT privilege on those specific tables. Postgres also lets you grant SELECT on specific columns instead of the whole table. This column rule stops the agent from querying columns that hold user passwords or keys. Keep in mind that the SELECT privilege also lets the role run COPY TO exports. You must also check what the special PUBLIC role allows on your database.
By default, every database role gets rules from the PUBLIC group. PUBLIC gives every role CONNECT and TEMPORARY rights on the database. It also gives EXECUTE rights on all functions and procedures unless the owner revokes them. In Postgres 15 and newer, users cannot create objects in the public schema by default. If you upgraded from an older version, you must revoke CREATE on the public schema from PUBLIC.
What native roles solve and what they miss
Native database roles do a great job of deciding who can log in. They also draw clear borders around which tables and columns a role can touch. Setting up a least-privilege role for Goose stops it from modifying schemas it should not touch. It also blocks the agent from running functions when you revoke default PUBLIC execute rules. This native setup is a strong first step for any team using AI agents.
AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static database privileges cannot inspect what happens inside an allowed query in flight. Once Goose logs in with SELECT rights on a customer table, it can pull every row. Native roles do not rewrite sensitive fields like emails or phone numbers in query results. They also cannot pause a risky query to ask a human for approval first. Finally, static roles require you to store long-lived database passwords on the machine running Goose.
Teams also struggle to audit which human prompt triggered a specific SQL statement. Standard Postgres logs only show that the shared Goose role ran a query. They do not link the database action back to the individual engineer using the agent. When multiple engineers run Goose, you lose track of who asked for what data. Fixing these gaps requires controls that work on each query as it runs.
Run guardrails and masking on the Postgres connection
Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.
On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.
Frequently asked questions
Can I restrict Goose to read only certain columns in Postgres?
Yes, Postgres lets you grant the SELECT privilege on specific columns of a table or view. If Goose queries a restricted column on that table, the database blocks the query.
Why can my read-only Goose role still run functions and create temp tables?
Postgres grants CONNECT, TEMPORARY, and function EXECUTE rights to the special PUBLIC role by default. The object owner must revoke those default privileges from PUBLIC to lock down the role.
Does a read-only Postgres role stop Goose from exposing emails or card numbers?
Only if you block those columns entirely with column-level SELECT rules. If Goose needs to query a column containing emails or card numbers, native roles return the raw text unless masking rewrites matched fields in results.
Related guides
In this post