How to Configure OpenHands Supabase Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands supabase permissions by creating a dedicated Postgres role with limited database privileges. Then you pass that role and password to the agent workspace instead of the default admin login. Many teams take a shortcut and share the project admin password with their coding agents. That broad role lets an autonomous agent drop tables or read sensitive rows across every schema. How openhands supabase permissions work in Postgres Every Supabase project comes with a default post

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 permissions by creating a dedicated Postgres role with limited database privileges. Then you pass that role and password to the agent workspace instead of the default admin login. Many teams take a shortcut and share the project admin password with their coding agents. That broad role lets an autonomous agent drop tables or read sensitive rows across every schema.

How openhands supabase permissions work in Postgres

Every Supabase project comes with a default postgres role that holds admin privileges. Supabase does not grant true superuser access because superusers can run destructive operations on the database. Instead, the platform gives the default admin role extra privileges for most admin tasks. The password you pick at project creation unlocks this default admin role.

Supabase docs states you should not give this main password to a third-party service. Instead, Supabase recommends creating a brand new database user for each external service or tool. When you run an autonomous coding agent, that agent acts as an external service. It runs shell commands, writes code, and queries your database to test new features.

To set up safe privileges, an admin logs into the dashboard and creates a fresh role. Queries run in the dashboard execute as the default admin role and carry a dashboard source comment. The admin grants the new agent role read or write privileges on specific tables only. You also leave out sensitive tables so the agent cannot alter core user records. Next, you store the new role credentials in the agent workspace variables.

What native database roles solve and what keeps the session active

A dedicated Postgres role solves the problem of blanket database access for your coding agent. It stops the agent from touching schemas or tables outside its assigned scope. If the agent tries to drop an unapproved table, Postgres blocks the command right away. Separating roles also helps your team track which service made a connection to the database.

Still, static database roles only check who logs in and which table they touch. They do not inspect what individual statements do in flight once a session starts. If an agent needs read access to a customer table, a role grants full table reads. Every query then returns raw emails, phone numbers, card numbers, and national IDs to the agent.

Also, a role with write privileges can still run a bad delete query without a filter. Static roles also require you to put a real database password inside the agent container. Because the agent runs shell commands, it can read its own workspace variables and print that password. Native roles set the outer boundary, but they cannot filter live queries or pause risky commands.

AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for scoping agent database sessions

Start by separating development and production projects so coding agents only test against fake data. Even in a staging project, create a dedicated Postgres user just for the agent workflow. Grant table permissions one by one rather than giving access to the entire public schema.

Limit the agent role to select and insert privileges when the task does not need deletes. Review your table grants often as your schema grows and new tables appear. Rotate the database password for the agent role on a regular schedule or after major tasks. Combining strict Postgres roles with statement inspection gives your team control over every query.

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 my coding agent the default postgres role password?

No, the default postgres role has admin privileges across your project. Supabase recommends creating a separate Postgres user for every external service or agent instead.

Does the Supabase default admin role have full Postgres superuser status?

No, Supabase withholds superuser status to prevent destructive system operations. The default postgres role receives admin privileges and specific extra grants for routine management.

Can native Postgres roles hide sensitive fields from an AI agent?

Postgres roles control table and column access, not live data masking. If an agent has select privileges on a column, Postgres returns the raw values in full.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.