How to Configure OpenHands Supabase Audit Log
You set up an openhands supabase audit log by creating a dedicated database role for your agent. Then you record every query that this role runs inside your Postgres database. Teams often start by giving their coding agent the default admin password created at project setup. Supabase notes that the default postgres role has admin rights, though not full superuser rights. Supabase warns against sharing this admin password with outside tools unless you trust them completely. Instead, the docs tel
Audit Log Integrity + End-to-End Encryption: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up an openhands supabase audit log by creating a dedicated database role for your agent. Then you record every query that this role runs inside your Postgres database.
Teams often start by giving their coding agent the default admin password created at project setup. Supabase notes that the default postgres role has admin rights, though not full superuser rights. Supabase warns against sharing this admin password with outside tools unless you trust them completely. Instead, the docs tell teams to make a fresh database user for each tool. When an agent uses a broad admin role, one bad command can drop tables or read private rows. A shared role also makes it hard to tell agent actions apart from human queries.
How the openhands supabase audit log works in practice
A clean setup starts with role separation inside your Supabase Postgres database. Every new project comes with default roles like the postgres admin role and built-in API roles. Rather than handing those default keys to OpenHands, you create a separate role just for the agent. You grant this new role only the table and schema permissions it needs for its task.
When someone runs a query in the Supabase Dashboard, the database runs it as the postgres role. Those dashboard queries carry a source comment to mark where they came from. By contrast, queries from your agent will show the dedicated agent role name in your database records. You then configure your database logging to capture statements run by that specific role. Each time OpenHands reads a schema or edits a table, the database writes an entry. This entry shows the database role, the time, and the statement that ran.
Why native roles and logs are only half the puzzle
Giving OpenHands its own Postgres user solves the basic problem of shared credentials. Your team can see which database role logged in and which tables it can touch. You also keep the main postgres admin password out of the agent work space. If the agent only needs to read data, a read-only role stops table drops.
Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, native database roles only check who logs in and which tables they can reach. They do not inspect what individual queries do while they are in flight. If an agent has read rights on a customer table, it can still pull every row. Standard logs record that the query happened after the data has already left the database. Native roles cannot pause a risky update to wait for a human check. They also do not rewrite sensitive fields like emails, phone numbers, card numbers, or national IDs in query results. When an autonomous agent runs many commands per minute, after-the-fact logs arrive too late to stop mistakes.
Scoping agent permissions before queries run
Before you let an AI agent run queries against real project data, audit your table grants. Remove broad admin rights and give the agent role access to safe tables only. Keep raw database passwords out of agent task prompts and local text files. Finally, pair your database role setup with controls that inspect statements and rewrite sensitive fields in results.
Add query and result controls beside Postgres
Grants and pools govern who logs into PostgreSQL. Yet every query in an open session still runs with that role's full scope. In practice, hoop.dev runs beside your database as a sidecar for your Postgres. It reads plain and prepared queries on the wire with no change to your users or drivers.
When a tool or agent sends SQL, hoop.dev Postgres controls check each statement against your deny rules. An AI Analyzer you configure can also score intent or hold a risky query for human review. Matched sensitive columns in result rows are masked in memory before they reach the caller. Each query and decision is logged per listener, which generates evidence for SOC 2, HIPAA, and GDPR audits. View the binary on GitHub.
Frequently asked questions
Should OpenHands use the default Supabase postgres password?
No, Supabase recommends creating a new database user for each external service you use. You should keep the default postgres admin password private and never share it with an agent.
How can I tell dashboard queries apart from OpenHands queries?
Queries run in the Supabase Dashboard execute as the postgres role and include a dashboard source comment. When OpenHands uses its own dedicated role, its queries log under that separate role name.
Does a Supabase audit log hide sensitive fields from OpenHands?
No, an audit log only records statements that run against the database for later review. To hide emails, phone numbers, or card numbers, you need data masking that rewrites matched fields in results.
Related guides
In this post