Can Supabase Edge Functions be isolated from project-wide privileged credentials? #52749
|
I'm developing a multi-tenant POS system with public order-processing functions and separate privileged device-administration operations. Our security requirement is that compromising a public order-processing Edge Function must not allow an attacker to provision, rotate, revoke, replace or reassign devices. According to the Supabase documentation, hosted Edge Functions automatically receive environment variables including SUPABASE_DB_URL, SUPABASE_SECRET_KEYS and the legacy SUPABASE_SERVICE_ROLE_KEY. My questions are: Is there a supported way to prevent a specific hosted Edge Function from accessing these privileged credentials? Can individual functions have isolated secrets or restricted execution identities, so that arbitrary code execution within one function cannot obtain project-wide privileges? Is this possible on a paid plan, such as Pro, Team or Enterprise? If not, what architecture does Supabase recommend for isolating public-facing functions from privileged device-administration operations? We've considered running public order processing in an independently hosted Deno service using a restricted PostgreSQL role, but would prefer to retain Supabase Edge Functions if secure isolation is supported. I'm specifically asking about protection against a compromised function runtime, not merely authentication of incoming HTTP requests or Row Level Security. Any official guidance would be appreciated. |
Replies: 1 comment 1 reply
Direct Answers to Your Questions1 & 2. Can hosted Edge Functions have isolated secrets, restricted execution identities, or be prevented from receiving project-wide credentials?No, not within a single Supabase project. 3. Is per-function credential isolation available on Pro, Team, or Enterprise?No. While Team and Enterprise plans offer features such as dedicated compute, custom vanity domains, SOC2/HIPAA compliance, and VPC peering/Direct Connections, the Edge Function secret management model remains project-wide across all tiers. Recommended Architectures for Zero-Trust / Blast-Radius IsolationIf your security requirement dictates that a compromised order-processing runtime (e.g., via Remote Code Execution or a vulnerable third-party Deno module) must have zero path to device provisioning or administrative keys, you should not rely on application-layer logic within the same project. Here are the standard production patterns used to achieve physical blast-radius isolation: Architecture A: Multi-Project (Dual-Project) Isolation Pattern (Recommended for Supabase)Split your system into two isolated Supabase projects:
Even if an attacker gains full arbitrary code execution in Project A's Edge Function and dumps Architecture B: External Isolated Compute for Public Ingestion (AWS Lambda / Deno Subhosting / Cloudflare Workers)If you prefer maintaining a single database but require strict runtime-level credential isolation:
SummaryIf maintaining hosted Supabase Edge Functions is preferred, separating the untrusted ingestion workload into its own dedicated Supabase project (Architecture A) is the cleanest, most maintainable, and verifiable isolation boundary. |
Direct Answers to Your Questions
1 & 2. Can hosted Edge Functions have isolated secrets, restricted execution identities, or be prevented from receiving project-wide credentials?
No, not within a single Supabase project.
In the hosted Supabase Edge Runtime, default environment variables (
SUPABASE_URL,SUPABASE_ANON_KEY,SUPABASE_SERVICE_ROLE_KEY,SUPABASE_DB_URL) and any secrets configured viasupabase secrets setare project-scoped. Every Edge Function deployed to a given project shares the same ambient secret store in its worker runtime. There is currently no per-function secret masking, function-level IAM identity, or secret access control policy in the hosted Edge Runtime.3. Is per-f…