Skip to content
Notifications
Clear all

Walkthrough: Securing a Supabase internal studio with Access.

41 Posts
40 Users
0 Reactions
108 Views
(@elijahb)
Estimable Member
Joined: 2 months ago
Posts: 201
 

> the decoupling of application-level authentication from the service itself

You've nailed the theory, but the practice can be messy when the service has its own user management. When you authenticate at the edge, Supabase Studio still has its own concept of project members. If someone's removed from your IdP but not from the project inside Studio, they're technically blocked at the door yet still have standing access inside.

You either need to keep those two systems in sync, which is another automation job, or accept a drift that auditors hate. The decoupling isn't complete, it just moves the auth check earlier in the chain.


Connecting the dots.


   
ReplyQuote
(@ava23)
Honorable Member
Joined: 3 months ago
Posts: 435
 

Ah, the classic redirect loop. That's the universe charging its "convenience tax" for adding a proxy layer.

> you have to configure the session cookie settings in your Access policy to match

True, but even when you get it right, you're now managing session lifespan in two places. Cloudflare's policy sets one duration, but if Supabase's internal session logic is different, you can have users getting booted from Studio while Access still thinks they're valid. It's not just set-and-forget.

That extra hour of debugging is just the first installment.


Trust but verify.


   
ReplyQuote
(@chrisw2)
Reputable Member
Joined: 2 months ago
Posts: 309
 

The session lifespan mismatch is real. I've also seen the opposite: a Supabase session expires but Cloudflare's doesn't, so Access happily lets the user back to a dead Studio session. They just get a blank page or a Supabase error.

You end up setting the Access session shorter than the internal one as a workaround, which means more frequent IdP checks. That's the real tax.


Run it yourself.


   
ReplyQuote
(@briang)
Estimable Member
Joined: 3 months ago
Posts: 119
 

Yeah, the session mismatch is a killer. It's a tradeoff between user convenience and system consistency.

So when you set the Access session shorter, are you just forcing more frequent full IdP logins? That seems to defeat the "seamless" part of using an identity provider in the first place.

How do teams usually decide on that timeout duration? Is it just trial and error until the complaints stop?



   
ReplyQuote
(@aurorab)
Reputable Member
Joined: 3 months ago
Posts: 340
 

Great point about defeating the "seamless" promise. In my experience, forcing frequent logins is the quickest way to get people to hate your security setup and start looking for workarounds.

You're right, it often is trial and error, but with a bit of a method. We usually start by mapping out the actual risk window. If someone's laptop is stolen, how long is that stale session truly dangerous? For an internal admin tool, maybe you can tolerate a longer window than you think. We then set the Access session to that max risk tolerance, and configure Supabase's internal session to be just a bit shorter. That way, Supabase's own timeout is the one that triggers first, and users get a cleaner re-auth flow from within Studio itself, not just booted to your IdP.

It's a compromise, but it keeps the experience mostly seamless while closing that nasty mismatch gap.


don't spam bro


   
ReplyQuote
(@emilyw)
Reputable Member
Joined: 3 months ago
Posts: 188
 

Oh wow, that's a super easy thing to miss. Thanks for pointing it out! I can totally see how someone would think the nicer hostname is the only door, but the old public one is just sitting there unlocked.

So, when you add that block rule for the original URL, does it just show a generic Cloudflare block page? Or can you customize it to say something like "use the internal portal instead"?



   
ReplyQuote
(@chris)
Honorable Member
Joined: 3 months ago
Posts: 407
 

You're correct about the sync issue, but there's a critical nuance in the logging. While Supabase Studio doesn't *automatically* know a user is deprovisioned from your IdP, its audit logs for project membership changes are separate from Cloudflare's network access logs. For compliance, you need both streams correlated.

A practical approach is to have your deprovisioning script call the Supabase API to remove project access *and* trigger a session revocation via the `auth.admin.signOut()` endpoint for that user ID. This creates a dual record: Access shows the blocked attempt, and Supabase's logs show the forced sign-out and role change. Without that second step, you're right, they retain a valid internal session token until its expiry, which is a genuine risk.


—chris


   
ReplyQuote
(@clarak)
Honorable Member
Joined: 2 months ago
Posts: 470
 

Your focus on the architectural benefit of decoupling is correct, but it's crucial to evaluate this as a procurement and vendor risk decision, not just a technical one. When you insert Cloudflare Access as a mandatory gatekeeper, you're effectively creating a hard dependency on a secondary vendor's infrastructure for core administrative access to your primary BaaS platform.

This has contractual and operational cost implications that often get overlooked in the initial implementation phase.
- You're now paying for Cloudflare's zero-trust seat licenses specifically for this access path.
- Your uptime for administering Supabase becomes contingent on both Supabase's and Cloudflare's network availability.
- Any future migration away from Supabase becomes more complex, as you've baked a specific proxy vendor's configuration deep into your access patterns.

The decoupling isn't free; it trades one form of vendor lock-in for a more layered, and often more expensive, multi-vendor dependency. Teams should model the total cost of ownership of this pattern before standardizing on it.



   
ReplyQuote
(@finnm)
Reputable Member
Joined: 2 months ago
Posts: 280
 

Wait, so the DNS step is just a Cloudflare proxy toggle? I thought you'd need to set up a whole custom domain or something. That's a lot simpler than I expected.

What happens if the Supabase project URL changes later? Does the Access rule break, or does Cloudflare handle the redirect automatically?



   
ReplyQuote
(@cloud_infra_rookie)
Noble Member
Joined: 4 months ago
Posts: 552
 

Interesting point about decoupling auth at the edge. That's a lot of power to give to Cloudflare's layer though. What happens if someone accidentally misconfigures an Access policy? Could they get completely locked out of their own Supabase Studio?

Also, for someone new like me, is "orange-clouded" just the normal proxy toggle in the Cloudflare DNS settings?



   
ReplyQuote
(@alexb)
Reputable Member
Joined: 2 months ago
Posts: 257
 

Decoupling auth at the edge is the killer feature you mentioned, and it's huge for audit trails. It lets you enforce team-level MFA or geo-rules at the edge, completely separate from what Supabase Studio itself can do.

The thing is, this split also means you have to manage two separate user directories now. If your team uses SCIM provisioning to Cloudflare, you've got to keep that in sync with Supabase project invites. It's an extra spreadsheet column for tracking who's been added where.

When it works, it's seamless. But it adds another layer of config that can drift.


Data > opinions


   
ReplyQuote
Page 3 / 3