How to Configure Dify Supabase Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up dify supabase credentials by creating a dedicated database user with limited permissions. Then you add those login details to your AI workflow tool. Many teams skip this step and paste the default admin password into their app. Broad permissions let an AI workflow read, change, or delete any table by mistake. How to set up dify supabase credentials with database roles Every new Supabase project comes with a default postgres role. This default role has admin privileges across the da

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 credentials by creating a dedicated database user with limited permissions. Then you add those login details to your AI workflow tool. Many teams skip this step and paste the default admin password into their app. Broad permissions let an AI workflow read, change, or delete any table by mistake.

How to set up dify supabase credentials with database roles

Every new Supabase project comes with a default postgres role. This default role has admin privileges across the database. Supabase does not give out full superuser rights because those allow destructive actions. Instead, the default postgres role gets extra permissions to handle admin work.

When you create a project, you set the password for this default postgres role. Supabase warns teams not to share this password with third-party apps. Instead, you should make a fresh database user for each outside service. This rule applies when you link Dify to your database.

Start by logging into your Supabase dashboard. Queries that you run in the dashboard run as the default postgres role. They also carry a dashboard source comment in the logs. From there, create a new database role just for Dify.

Grant this new role read or write access only to the tables Dify needs. Do not give the new role admin privileges. Once the role is ready, put the host, database name, user, and password into Dify. Now your AI workflows can run queries using that restricted account.

What native database roles solve and what they miss

Using a custom database role stops Dify from touching tables outside its scope. It also makes key rotation much easier for your team. If you need to cut off access, you can drop or change that single user. Your other apps and services will keep running without any downtime.

Supabase also ships with built-in roles like anon, authenticated, and service_role. Teams use these roles to manage app traffic and security rules. A dedicated role for Dify fits into this same model. It separates your AI tool from your main admin account.

Ephemeral Credentials + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, static database roles only check who logs in at the start. Once the user logs in, the database trusts every valid query for those tables. A bad prompt in Dify could still run a massive read or delete query. Static roles cannot inspect individual SQL statements while they run in flight.

Database roles also do not rewrite sensitive fields inside query results. If a permitted table holds emails, phone numbers, card numbers, or national IDs, queries return them. Static credentials also sit stored inside the third-party app settings. Teams still have to rotate passwords by hand and track what each workflow queried.

Why query-level controls matter for AI workflows

AI agents and workflows build queries based on user input. This makes their database traffic much harder to predict than standard app traffic. A role that needs read access to a customer table might fetch thousands of rows. Without runtime checks, you cannot stop a runaway query before it finishes.

Teams also need to protect private data during AI runs. Data masking rewrites matched fields like emails or card numbers in query results. This keeps raw personal details out of model prompts and chat logs. Combining least-privilege roles with runtime controls gives teams a safer setup.

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 I use the default postgres password for Dify?

No, you should never give the default postgres password to outside services. That role has admin privileges, so create a separate database user for Dify instead.

How do queries run in the Supabase dashboard?

Queries in the Supabase dashboard run under the default postgres admin role. They also include a comment showing the dashboard as the source.

Can a custom database role hide sensitive columns by itself?

A role can block access to whole tables or columns, which breaks queries that need them. To return rows with masked emails or phone numbers, you need runtime data masking.

The query runs. The emails stay hidden.