Live data from Hacker News

Shipping Multi-Tenant SaaS Using Postgres Row-Level Security

thenile.dev

121–123 of 123 posts

Re: Shipping Multi-Tenant SaaS Using Postgres Row-Level Security

#121
post #91
post #88

Earlier quoted context omitted.

That seems like a bug to me, and a significant one as well. The underlining promise of RLS (sometimes even referred to as “virtual private database”) in an RDBMS, is that data should never leak because it’s handled transparently by the db. This seems like a significant leakage point that the user has to personally manage.

This pretty much mirrors stored procedures though which have the option of running as the definer or the invoker. Breaking this with “when RLS is enabled stored procedures and views set to run with the permissions of the definer intersect with the RLS policy of the invoker” is crazy weird. Maybe it would actually be good behavior but it would super super unintuitive.

Assuming correct, it's an absolutely horrible default that needs to be changed.

Imagine if the default Unix permission was to set files with setuid.

Re: Shipping Multi-Tenant SaaS Using Postgres Row-Level Security

#122

I find adding loads of stuff to Postgres exciting and fun, but I want all of my logic in the code in GitHub, rather that floating around in my global data store. Has anyone thought about a data layer that allows you to define this stuff programmatically rather than in SQL but then it configures your data layer to work like this. Not necessarily an ORM but more a business logic layer that compiles everything down to u…

You're describing an ORM, or perhaps SQLAlchemy, which has a lower level interface. .sql files work fine in version control as well. "create or replace …" pattern can make them idempotent.

Re: Shipping Multi-Tenant SaaS Using Postgres Row-Level Security

#123

Earlier quoted context omitted.

Is account creation automated? I know there are some resources where you can only have one per region (I think you can only have one AWS::EC2::VPCEndpoint per... type and service per region) but I don't know if letting multiple tenants use the same VPC endpoint is a risk or not.

You can have an instance of a VPC Endpoint per VPC. You can have multiple VPC's all with the same VPC Endpoints. You just get billed for them ;-)

Oh yes that makes complete sense - I'm living in a world where our internal AWS management team deploys our VPCs for us (one per account unless you have very special needs).
Post reply on HN