How to Configure Gemini CLI Supabase Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up gemini cli supabase approval by turning on local command prompts. You also pair those prompts with a scoped Postgres role. Many teams start by giving their AI coding tool the main project password. That password belongs to the default admin role. When an agent uses that role, a bad query can alter or drop whole tables. How gemini cli supabase approval works with native roles Every Supabase project starts with a default Postgres role that holds admin rights. It is not a full superus

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 gemini cli supabase approval by turning on local command prompts. You also pair those prompts with a scoped Postgres role. Many teams start by giving their AI coding tool the main project password. That password belongs to the default admin role. When an agent uses that role, a bad query can alter or drop whole tables.

How gemini cli supabase approval works with native roles

Every Supabase project starts with a default Postgres role that holds admin rights. It is not a full superuser, because the platform blocks the most destructive system tasks. Still, the password you set at project creation belongs to this admin role. The vendor warns against sharing this password with outside tools. Instead, you should create a new database user for each tool or service.

On the client side, the terminal agent can run shell commands and call external tools. By default, the agent asks the developer to approve commands before they run. When the agent wants to inspect a table or change a schema, it prepares a query. The user sees the prompt in the terminal and decides whether to let it run. Once approved, the tool sends the query to the database using the local database credentials.

Supabase also includes built-in roles for app traffic, such as the anonymous role. These roles work with Row Level Security to restrict which rows an app user can read. Direct database tools often bypass these app roles if they log in as the admin user. Setting up a custom role with limited table grants is the safest native path. You grant read rights on specific tables and require manual confirmation for every local command.

What native setup solves and what it leaves open

Combining a scoped database user with local terminal prompts stops many accidents. A read-only Postgres role prevents an agent from dropping tables or deleting rows. Local prompts let a developer catch obvious mistakes before the command leaves the machine. This setup handles basic login control and stops unapproved scripts from starting on their own.

Still, native roles and local prompts leave a big operational gap. Database roles decide who can log in and which tables they can touch. They do not inspect what individual SQL statements do in flight. If an agent needs write rights to run migrations, the database role must allow writes. Once that role has write access, a hasty click in the terminal approves the whole command. A developer might approve a broad update statement without spotting a missing filter clause.

Approval Chains & Escalation + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Local prompts also put the burden on the person sitting at the keyboard. Terminal approvals do not involve a second reviewer from the security or data team. Also, native roles do not mask sensitive fields in query results. If a table holds emails, phone numbers, card numbers, or national IDs, a read query returns them. Data masking is needed to rewrite matched fields in results before the agent reads them.

Why statement-level checks matter for AI agents

AI coding agents work fast and often chain several database queries together. A human user can get tired after reviewing dozens of terminal prompts in a single hour. When prompt fatigue sets in, people start approving commands without reading every line of SQL. Relying only on local clicks does not scale across an engineering team.

Teams need a way to pause risky statements while letting safe read queries pass. For example, reading a schema can run right away, while an update waits for a teammate. You also want central logs that record which person and agent ran each query. Central controls keep database credentials off local laptops and turn approvals into a shared team step.

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, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. 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 refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every 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

Should I give my AI agent the default Postgres password?

No, the default Postgres password grants admin privileges across the project. You should create a separate database user with narrow table rights for your agent.

Does a local terminal prompt stop all bad database queries?

No, a local prompt only asks the local user to click approve. If the user misses a bad filter clause, the database will still run the query.

Can native Postgres roles hide sensitive columns from AI tools?

Column grants can block access to a whole column, which often breaks select queries. Rewriting matched fields like emails or card numbers in results keeps queries working safely.

The query runs. The emails stay hidden.