How to Configure Goose Neon Read Only Access
You set up goose neon read only access by using a restricted Postgres role. You can also route the agent to a dedicated read replica endpoint. Many teams start by giving their AI agent the default database owner key. That shortcut is fast, but it creates a big risk for your data. An agent with write rights can drop tables or alter rows by mistake. Scoping the database role and endpoint stops those bad writes before they happen. How goose neon read only access works in Postgres Goose connects
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 goose neon read only access by using a restricted Postgres role. You can also route the agent to a dedicated read replica endpoint. Many teams start by giving their AI agent the default database owner key. That shortcut is fast, but it creates a big risk for your data. An agent with write rights can drop tables or alter rows by mistake. Scoping the database role and endpoint stops those bad writes before they happen.
How goose neon read only access works in Postgres
Goose connects to your database through a local extension or command tool. It reads a database connection string from your local machine to log in. When you create a new Neon project, the default role owns everything. You must create a separate Postgres role that only has select privileges. Grant this new role permission to connect to the target database and schema. Then grant select privileges on the existing tables and future tables in that schema. Neon also lets you create read-only compute endpoints for any database branch. A read-only compute endpoint rejects all write statements at the compute level. Pairing a read-only compute endpoint with a select-only role gives you two defenses. You then pass this restricted connection string to the Goose database extension. Now the agent can inspect schemas and run queries without changing any rows.
What native roles solve and where gaps remain
Native database roles and read-only endpoints solve the problem of accidental data changes. If the agent tries to delete a table, Postgres blocks the command right away. This setup is essential when you let an AI agent explore data. Still, database roles only decide who can log in and which tables open. They do not inspect what individual queries do while they run in flight. A read-only role still lets the agent read every column in an allowed table by default. If that table holds customer emails, phone numbers, or card numbers, the agent gets them. The agent then sends those raw query results to an external language model. Also, storing plain database keys on developer laptops creates another big security risk. Anyone with local file access can copy that key and query the database. Native roles also lack central audit logs that tie queries to specific team members. Everyone sharing the same role looks identical inside the standard database log files.
Managing secrets and sensitive columns for AI agents
To close these gaps, teams must separate table access from sensitive column data. You can create restricted Postgres views that leave out sensitive columns from the start. Grant the agent role select rights on the views instead of the base tables. This keeps private fields out of the agent context window during debugging tasks. Still, maintaining custom views for every table takes a lot of ongoing work. Schema changes can break those views and slow down your data engineering team. Teams also need a better way to handle local database keys on laptops. Rotating static keys by hand across many developer machines takes time and fails often. A strong setup removes static database passwords from local config files and checks every query.
Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
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 a Neon read-only compute endpoint block schema changes?
Yes, a Neon read-only compute endpoint runs Postgres in hot standby recovery mode. It rejects all data writes, table drops, and schema changes at the server level.
Why should I use both a read-only endpoint and a restricted Postgres role?
A read-only endpoint blocks writes across the whole database, while a role limits table visibility. Using both ensures the agent cannot write data or read restricted internal tables.
How does data masking handle sensitive fields during Goose queries?
Data masking rewrites matched fields like emails, phone numbers, and card numbers in query results. The agent receives the masked output so private customer data does not leak outward.
Related guides
In this post