How to Configure n8n Supabase Read Only Access
You set up n8n supabase read only access by creating a dedicated Postgres database role. You then grant that role select rights on specific tables for your workflow. Many teams skip this step and use the default admin credentials instead. Every Supabase project includes a default postgres role with broad admin privileges. Supabase warns against sharing this password with third-party services. Instead, you should make a new user for every external service. Broad roles let automated workflows chan
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 n8n supabase read only access by creating a dedicated Postgres database role. You then grant that role select rights on specific tables for your workflow. Many teams skip this step and use the default admin credentials instead. Every Supabase project includes a default postgres role with broad admin privileges. Supabase warns against sharing this password with third-party services. Instead, you should make a new user for every external service. Broad roles let automated workflows change or delete production records by mistake.
How to set up n8n supabase read only access
Start inside your Supabase project dashboard to create the restricted user. Queries you run in the dashboard execute as the default postgres admin role. Although Supabase does not give out full superuser access, this role holds admin privileges. You use those admin rights to create a separate database user for n8n. Give this new user a strong password and a clear name. Grant it usage rights on the target schema, and grant select rights on allowed tables. Do not grant insert, update, or delete permissions to this user.
Next, open your n8n workspace and add a Postgres credential entry. Enter the host details, the database name, and the new read-only user credentials. You can now attach this credential to standard Postgres nodes or AI workflows. In n8n, an AI Agent node combines a chat model with one or more tools. The agent decides which tools to call to finish a task. You must attach at least one tool sub-node to an AI Agent node. For SQL tasks, n8n recommends using a Postgres tool sub-node with a recent Agent node. When the agent runs, it logs in with your restricted Supabase role.
What native read-only roles solve and what they miss
A dedicated read-only role stops workflows and AI agents from modifying your tables. If an AI agent builds a delete statement, Postgres blocks the command right away. Creating a separate user per service also makes key rotation much safer. If you need to revoke access for n8n, you drop or update that single role. Other services keep running without interruption.
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. A read-only user can still run a heavy query that scans millions of rows. That single bad query can slow down the database for your main app. Also, select access on a table exposes every column in those rows by default. If a table holds emails, phone numbers, card numbers, or national IDs, queries return them. When an n8n AI Agent node runs, those fields flow into the chat model prompt. Storing long-lived passwords inside workflow settings also creates a secret management burden for your team.
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 AI agent workflows need query-level controls
Older n8n versions offered a dedicated SQL Agent mode. That agent could read natural language questions, write SQL queries, and run them. From n8n 1.82.0, the agent type setting is deprecated. Now, all AI Agent nodes work as a Tools Agent. Node version 1 is removed in n8n 3.0. Besides built-in database nodes, n8n offers a registry of MCP servers and custom tools. Teams can also attach a Call n8n Workflow Tool, a Custom Code Tool, or an HTTP Request Tool.
Because the agent chooses which tools to call, query behavior is dynamic. Every prompt from a user can produce a brand new SQL statement. Database roles cannot mask sensitive fields like emails or card numbers on the fly. They also cannot require human approval before a broad select query runs. Teams need a way to inspect queries and rewrite matched fields in results.
Run guardrails and masking on the Postgres connection
Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.
On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.
Frequently asked questions
Should I use the default postgres role for n8n workflows?
No, the default postgres role has admin privileges across your database. Supabase states you should never share its password with third-party services unless you trust them completely. Always create a separate, limited database user for n8n instead.
How do I connect an n8n AI Agent to Supabase?
Add an AI Agent node in n8n and attach a chat model to it. Then connect a Postgres tool sub-node configured with your read-only Supabase user credentials. The agent will use that tool to run read queries when needed.
Does a read-only Postgres role hide sensitive columns from n8n?
No, standard table-level select permissions allow the user to read every column in that table by default. Without field-level masking, queries will still return emails, phone numbers, card numbers, and national IDs.
Related guides
In this post