How to Configure Amazon Q Supabase Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up an amazon q supabase sandbox, create a scoped database role first. Then connect the AI assistant to a non-production project using that restricted account. Engineering teams often test AI assistants against shared test databases. Many developers take a shortcut and use the default admin password from project creation. When roles are too broad, a bad query can drop tables or expose test records. How an amazon q supabase sandbox works Every Supabase project starts with a default postg

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.

To set up an amazon q supabase sandbox, create a scoped database role first. Then connect the AI assistant to a non-production project using that restricted account. Engineering teams often test AI assistants against shared test databases. Many developers take a shortcut and use the default admin password from project creation. When roles are too broad, a bad query can drop tables or expose test records.

How an amazon q supabase sandbox works

Every Supabase project starts with a default postgres role. This role has admin rights across the database. Supabase does not grant full superuser status to prevent destructive system tasks. Still, the default postgres role still holds broad privileges over schemas and tables. When you run queries in the web dashboard, they run as this admin role.

Supabase advises teams not to share the default postgres password with outside tools. Instead, you should make a dedicated database user for each external service. Supabase also provides built-in roles like anon, authenticated, and service_role for app traffic. For an AI coding assistant, a custom Postgres role works best. You can limit this custom role to specific schemas or read-only views.

Amazon Q Developer can run commands and query databases from your local machine. The agent uses the database credentials stored in your local shell or settings. When the agent sends a query, Postgres checks the permissions of that database role. If the role only has read rights, Postgres blocks any attempt to change rows.

What native database roles solve and what they miss

Native Postgres roles and Row Level Security handle basic login and table rules well. A scoped role stops an AI tool from dropping tables in your sandbox. You can also use column privileges to block access to specific table columns. This setup decides who can log in and which tables they can read.

Still, static database roles leave an operational gap during live agent sessions. A role cannot inspect what individual SQL statements or commands do in flight. Even in a sandbox, developers often copy real customer records to test features. If a table holds emails, phone numbers, card numbers, or national IDs, read roles return them.

AI Sandbox Environments + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native roles are also all-or-nothing once the session starts. If the agent needs to run one schema migration, you must grant write rights. Once granted, the agent holds those write rights for every query that follows. Native settings cannot require human approval for a single risky statement in real time. They also cannot rewrite matched fields like emails or card numbers in query results.

Best practices for safe AI database testing

Start by creating a separate database user just for your AI coding tool. Never pass the default admin password into local agent settings or shell variables. Grant the new user select rights only on the tables needed for the task.

Keep your sandbox data clean of real user details whenever you can. If real emails or phone numbers exist in test tables, use field masking. Masking rewrites matched fields in results before the AI tool processes the output. Finally, review your database logs often to see what queries the agent runs.

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

Should I give Amazon Q the default Supabase postgres password?

No, you should never share the default postgres password with third-party tools. Create a separate database user with limited permissions for the AI assistant instead.

Does Supabase give superuser access to the default admin role?

No, Supabase gives the default postgres role admin rights rather than full superuser access. This restriction blocks destructive system operations while still allowing normal database management.

Why do sandbox databases still need query controls for AI agents?

Sandbox databases often contain copied data like emails, phone numbers, or card numbers. Query controls can block bad commands in flight and rewrite sensitive fields in results.

The query runs. The emails stay hidden.