How to Configure Dify Supabase Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up dify supabase approval by pausing the AI workflow before it queries Postgres. Then a human reviews the pending database action and lets the workflow continue. Many teams connect AI apps to their database with a single admin user. Every new project gets a default postgres role with broad admin powers. The password you set at project creation belongs to this default admin role. Sharing that main password with an external app gives the AI too much power. One bad prompt can change or del

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 dify supabase approval by pausing the AI workflow before it queries Postgres. Then a human reviews the pending database action and lets the workflow continue.

Many teams connect AI apps to their database with a single admin user. Every new project gets a default postgres role with broad admin powers. The password you set at project creation belongs to this default admin role. Sharing that main password with an external app gives the AI too much power. One bad prompt can change or delete important rows across your tables.

How native dify supabase approval works in practice

To keep data safe, you must separate AI duties from admin duties. Supabase says you should create a new database user for every external service. You should never give the main admin password to a third-party app. Start by making a dedicated Postgres role just for your AI workflow. Grant this new role permission to read or write only the tables it needs.

Next, you build a review step inside your AI workflow builder. When the model wants to update data, the workflow stops at a human step. It sends a message to a reviewer in your team chat or app. The reviewer checks the planned input and clicks approve or reject. Only after this manual sign-off does the workflow call the database tool.

Supabase also creates built-in roles like anon and service_role for each new project. If your AI tool calls the database API, it uses one of these roles. You can add Row Level Security rules to restrict which rows that role touches. Combining dedicated database roles with workflow pause steps creates a basic review check.

Why role checks alone leave a runtime gap

Database roles and app-level pauses solve only half of the safety problem. A Postgres role decides who can log in and which tables they can touch. Once that role logs in, the database allows any valid query within those bounds. If a workflow has permission to update a customer table, it can update every row by default.

Workflow pause steps inside the AI builder also have clear limits. They only pause the specific nodes where a builder remembered to add a gate. If a builder adds a new database tool and forgets the pause, queries run right away. Also, the workflow check only sees the app prompt, not the final SQL statement.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Admins also run queries in the Supabase Dashboard, which execute as the default postgres role. Those dashboard queries carry a comment showing they came from the dashboard. External AI tools do not add user context to raw SQL queries by default. In the database logs, every AI action looks like the same shared service user. Also, static roles do not rewrite emails, phone numbers, or card numbers in query results.

What to check before an AI query runs

Real database safety requires checking each SQL statement right before it hits the database. Your review process should inspect the exact command, not just the high-level app step. Read queries on public tables can run right away without waiting for a person. Commands that alter tables, drop data, or read sensitive rows should pause for approval.

You also need a clear audit trail for every single database request. Each log entry should link the SQL query to the specific workflow and reviewer. When a query returns customer data, masking rules should rewrite national IDs and phone numbers. This keeps private data out of AI memory while letting safe tasks run fast.

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 my AI app the default postgres password?

No, you should never share the main postgres role password with external services. Create a separate Postgres user with limited table permissions for your AI app instead.

Does the default Supabase postgres role have full superuser access?

No, the default postgres role has admin privileges, not full superuser access. Supabase blocks superuser access to prevent destructive actions, though it grants some extra privileges.

Why is a workflow pause step not enough for database safety?

A workflow step only pauses the app logic and can be skipped by builders. It does not inspect the final SQL statement or mask emails and card numbers.

The query runs. The emails stay hidden.