Re: Multi-tenancy with RLS

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multi-tenancy with RLS
Date: 2016-01-04 05:43:55
Message-ID: CAJrrPGcMgGeMqb5sFt8HZD+dwzWVgDOTdcUR+x_v0ni+=WgKgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 30, 2015 at 11:28 AM, Haribabu Kommi
<kommi(dot)haribabu(at)gmail(dot)com> wrote:
> On Thu, Dec 17, 2015 at 12:46 PM, Haribabu Kommi
> <kommi(dot)haribabu(at)gmail(dot)com> wrote:
>> Rebased patch is attached as it is having an OID conflict with the
>> latest set of changes
>> in the master branch.
>
> Here I attached new series of patches with a slightly different approach.
> Instead of creating the policies on the system catalog tables whenever
> the catalog security command is executed, just enable row level security
> on the system catalog tables. During the relation build, in
> RelationBuildRowSecurity function, if it is a system relation, frame the
> policy using the policy query which we earlier used to create by parsing it.
>
> With the above approach, in case of any problems in the policy, to use
> the corrected policy, user just needs to replace the binaries. whereas in
> earlier approach, either pg_upgrade or disabling and enabling of catalog
> security is required.
>
> Currently it is changed only for shared system catalog tables and also the
> way of enabling catalog security on shared system catalog tables is through
> initdb only. This also can be changed later. I will do similar changes for
> remaining catalog tables.
>
> Any comments on the approach?

Instead of creating policies during the "alter database" command for database
catalog tables, generating at relation building is leading to an
infinite recursion
loop because of transformExpr call for the qual. Any ideas to handle the same?

Here I attached updated patches to HEAD.

Regards,
Hari Babu
Fujitsu Australia

Attachment Content-Type Size
4_database_catalog_tenancy_v4.patch application/octet-stream 92.8 KB
3_shared_catalog_tenancy_v3.patch application/octet-stream 19.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-01-04 06:09:27 Re: 9.5 BLOCKER: regrole and regnamespace and quotes
Previous Message Jim Nasby 2016-01-04 05:31:10 Re: 9.5 BLOCKER: regrole and regnamespace and quotes