Re: RLS without leakproof restrictions? - Mailing list pgsql-general

From Tom Lane
Subject Re: RLS without leakproof restrictions?
Date
Msg-id 4136571.1677037565@sss.pgh.pa.us
Whole thread Raw
In response to RLS without leakproof restrictions?  (Tom Dunstan <pgsql@tomd.cc>)
Responses Re: RLS without leakproof restrictions?  (Tom Dunstan <pgsql@tomd.cc>)
List pgsql-general
Tom Dunstan <pgsql@tomd.cc> writes:
> I'm currently researching different strategies for retrofitting some
> multi-tenant functionality into our existing Postgres-backed application.
> One of the options is using RLS policies to do row filtering. This is quite
> attractive as I dread the maintenance and auditing burden of adding
> filtering clauses to the majority of our queries. I'm somewhat concerned
> though about getting unexpected query plans based on the planner avoiding
> non-leakproof functions until row filtering has occurred - warning about
> this seems common in articles on RLS.

> Our application is the only "user" of the database, and we do not pass
> database errors through to the user interface, so for our case leakproof
> plans are overkill - we'd just like the implicit filtering clauses added
> based on some session GUCs that we set.

> Is there any way to get what we're looking for here? I don't see anything
> documented on CREATE POLICY, ALTER TABLE or any GUCs.

If you're happy allowing the application to decide if the filters will
be enforced, maybe just create some views embodying those filters, and
query those views when you want restrictions?

> Alternatively, are the concerns about changed plans unfounded?

Hard to tell without experimentation.

            regards, tom lane



pgsql-general by date:

Previous
From: Tom Dunstan
Date:
Subject: Re: RLS without leakproof restrictions?
Next
From: Tom Dunstan
Date:
Subject: Re: RLS without leakproof restrictions?