How to Configure OpenHands Supabase Read Only Access
You set up openhands supabase read only access by creating a dedicated Postgres role. You then grant that role select rights on specific tables for the agent. Many teams start by handing their coding agent the default project password. That shortcut gives an automated tool full admin control over live data. A bad prompt or agent loop can then drop tables or alter rows. How openhands supabase read only access works natively Every Supabase project starts with a default postgres role that holds
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 openhands supabase read only access by creating a dedicated Postgres role. You then grant that role select rights on specific tables for the agent. Many teams start by handing their coding agent the default project password. That shortcut gives an automated tool full admin control over live data. A bad prompt or agent loop can then drop tables or alter rows.
How openhands supabase read only access works natively
Every Supabase project starts with a default postgres role that holds admin privileges. Supabase does not grant full superuser status to prevent destructive database actions. Even so, the default postgres role still holds broad admin power. The project password you set at creation belongs to this postgres role. Supabase advises teams not to share this password with third-party tools. Instead, you should make a fresh database user for each external service.
To lock down OpenHands, an admin logs in through the Supabase dashboard. Queries run in the dashboard run as the postgres admin role. From there, you create a new role made just for the agent. You grant this new role permission to connect and read chosen schemas. You also grant select rights on the tables the agent needs to check. Finally, you pass these new role credentials to the OpenHands runtime. The agent can now inspect table structures and read rows without writing data.
Why you should avoid default roles for agents
Each new Supabase project also includes built-in roles for app traffic. For example, the anon role handles requests when a user has not logged in. Other built-in roles handle logged-in users and backend service tasks. These built-in roles are meant for app APIs, not coding agents. Giving an agent an admin key or service key bypasses basic safety checks.
A dedicated read-only role stops the agent from running write or delete statements. Postgres blocks any attempt by that role to alter schemas or drop tables. This native setup is a strong first step for safe agent testing. It separates human admin duties from automated agent queries inside the database.
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.
Where native database roles fall short in daily operations
Native Postgres roles decide who can log in and which tables they can read. Still, a read-only role cannot inspect what individual queries do in flight. Once OpenHands logs in, it can read every column inside an allowed table. If that table holds customer emails, phone numbers, or card numbers, the agent reads them. The agent may then send those raw values back to an external model.
Static database credentials also create key management work for your team. You have to store the database password inside the OpenHands workspace settings. If multiple engineers run agents, they often share that same static password. When something goes wrong, native logs only show the shared database role name. You cannot tell which engineer or agent task ran a heavy query. Also, a read-only role cannot stop an agent from pulling millions of rows.
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
Should I give OpenHands the default postgres role password?
No, the default postgres role has admin privileges across your project. Supabase recommends creating a separate user for every external service you use.
Does a read-only Postgres role hide sensitive columns from OpenHands?
No, table-level read grants let the role read all rows and columns by default. Without field masking, queries still return raw emails, phone numbers, and card numbers.
How do dashboard queries differ from OpenHands agent queries?
Queries run in the Supabase dashboard execute as the default postgres admin role. OpenHands should log in with its own restricted role so it cannot change data.
Related guides
In this post