How to Configure Dify Supabase Read Only Access
You set up dify supabase read only access by creating a dedicated database user with select permissions. Then you pass those restricted credentials to your Dify workflow or tool setup. Many teams start by pasting their default project password into external AI tools to move fast. That default role carries admin rights and lets an AI agent change or delete production tables. How dify supabase read only access works in Postgres Every Supabase project starts with a default postgres role that hol
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 read only access by creating a dedicated database user with select permissions. Then you pass those restricted credentials to your Dify workflow or tool setup. Many teams start by pasting their default project password into external AI tools to move fast. That default role carries admin rights and lets an AI agent change or delete production tables.
How dify supabase read only access works in Postgres
Every Supabase project starts with a default postgres role that holds admin privileges. Supabase does not grant full superuser status to prevent destructive system changes. Still, this default role can modify schemas, drop tables, and read every row by default. The password you set at project creation belongs to this admin role. Supabase advises that you never share this password with any third-party service. Instead, you should create a distinct database user for each external service you link.
To prepare your database for Dify, you log in through the Supabase dashboard. Queries that run in the dashboard execute as the default admin role. From there, you create a new role designed just for Dify queries. You grant this role usage on the target schema and select rights on specific tables. You also set default privileges so future tables follow the same read rules. Once the role is ready, you place its credentials into your Dify tool setup. Now Dify can run select queries to ground prompts without altering your records.
What native read roles solve and what they leave open
A dedicated read-only user stops accidental writes, updates, and table drops from Dify workflows. If a prompt injection tricks the model into generating a delete statement, Postgres blocks it. The database engine enforces these table permissions before any row changes happen. This setup solves the basic problem of destructive writes from an AI app.
Still, static database roles only check who logs in and which tables they can read. They do not inspect what individual queries do in flight or what data returns. If a readable table holds emails, phone numbers, card numbers, or national IDs, Dify pulls them all. A broad select query can still dump millions of sensitive rows into a model prompt. You also have to rotate passwords by hand across every Dify app when team members leave. Native roles lack field-level masking for live results and per-query approval controls.
Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why shared credentials create audit blind spots
When Dify connects with a single database user, every workflow shares that one identity. Your database logs only show that the shared Dify role ran a select statement. You cannot tell which specific builder, workflow test, or end user triggered that query. Sharing the default admin role makes this worse because dashboard queries use that same account. Separating human tests from automated AI runs requires clear attribution on every database session.
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 use the default postgres password to connect Dify to Supabase?
No, the default postgres password grants admin rights over your database tables and schemas. Supabase recommends creating a separate user for every external service so you can limit its permissions.
Does a read-only Postgres role hide sensitive columns from Dify prompts?
Not by default, because table-level select rights allow reading every column in that table. Unless you restrict specific columns or mask results, queries will return emails, phone numbers, and card numbers.
Can I use the built-in anon role for Dify database queries?
The built-in anon role is meant for public API requests that rely on row-level security rules. For direct Postgres connections from a backend service like Dify, a dedicated database role is clearer to manage.
Related guides
In this post